app_setcallerid.c File Reference

App to set callerid presentation. More...

#include "asterisk.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/image.h"
#include "asterisk/callerid.h"

Include dependency graph for app_setcallerid.c:

Go to the source code of this file.

Functions

 AST_MODULE_INFO_STANDARD_DEPRECATED (ASTERISK_GPL_KEY,"Set CallerID Presentation Application")
static int load_module (void)
static int setcallerid_pres_exec (struct ast_channel *chan, const char *data)
static int unload_module (void)

Variables

static char * app2 = "SetCallerPres"


Detailed Description

App to set callerid presentation.

Author:
Mark Spencer <markster@digium.com>

Definition in file app_setcallerid.c.


Function Documentation

AST_MODULE_INFO_STANDARD_DEPRECATED ( ASTERISK_GPL_KEY  ,
"Set CallerID Presentation Application"   
)

static int load_module ( void   )  [static]

Definition at line 125 of file app_setcallerid.c.

References ast_register_application_xml, and setcallerid_pres_exec().

static int setcallerid_pres_exec ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 93 of file app_setcallerid.c.

References ast_channel_caller(), ast_log, ast_parse_caller_presentation(), ast_party_caller::id, LOG_WARNING, ast_party_id::name, ast_party_id::number, ast_party_number::presentation, and ast_party_name::presentation.

Referenced by load_module().

00094 {
00095    int pres = -1;
00096    static int deprecated = 0;
00097 
00098    if (!deprecated) {
00099       deprecated = 1;
00100       ast_log(LOG_WARNING, "SetCallerPres is deprecated.  Please use Set(CALLERPRES()=%s) instead.\n", (char *)data);
00101    }
00102 
00103    /* For interface consistency, permit the argument to be specified as a number */
00104    if (sscanf(data, "%30d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
00105       pres = ast_parse_caller_presentation(data);
00106    }
00107 
00108    if (pres < 0) {
00109       ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n",
00110          (char *) data);
00111       return 0;
00112    }
00113    
00114    /* Set the combined caller id presentation. */
00115    ast_channel_caller(chan)->id.name.presentation = pres;
00116    ast_channel_caller(chan)->id.number.presentation = pres;
00117    return 0;
00118 }

static int unload_module ( void   )  [static]

Definition at line 120 of file app_setcallerid.c.

References ast_unregister_application().

00121 {
00122    return ast_unregister_application(app2);
00123 }


Variable Documentation

char* app2 = "SetCallerPres" [static]

Definition at line 91 of file app_setcallerid.c.


Generated on Thu Apr 16 06:28:42 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6