#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.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"
Go to the source code of this file.
Functions | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Set CallerID Application") | |
static int | load_module (void) |
static int | setcallerid_exec (struct ast_channel *chan, void *data) |
static int | setcallerid_pres_exec (struct ast_channel *chan, void *data) |
static int | unload_module (void) |
Variables | |
static char * | app = "SetCallerID" |
static char * | app2 = "SetCallerPres" |
static char * | descrip |
static char * | descrip2 |
static char * | synopsis = "Set CallerID" |
static char * | synopsis2 = "Set CallerID Presentation" |
Definition in file app_setcallerid.c.
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Set CallerID Application" | ||||
) |
static int load_module | ( | void | ) | [static] |
Definition at line 149 of file app_setcallerid.c.
References ast_register_application(), setcallerid_exec(), and setcallerid_pres_exec().
00150 { 00151 int res; 00152 00153 res = ast_register_application(app2, setcallerid_pres_exec, synopsis2, descrip2); 00154 res |= ast_register_application(app, setcallerid_exec, synopsis, descrip); 00155 00156 return res; 00157 }
static int setcallerid_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 96 of file app_setcallerid.c.
References ast_callerid_split(), ast_log(), ast_module_user_add, ast_module_user_remove, ast_set_callerid(), ast_strdupa, ast_strlen_zero(), LOG_WARNING, and name.
Referenced by load_module().
00097 { 00098 int res = 0; 00099 char *tmp = NULL; 00100 char name[256]; 00101 char num[256]; 00102 struct ast_module_user *u; 00103 char *opt; 00104 int anitoo = 0; 00105 static int dep_warning = 0; 00106 00107 if (ast_strlen_zero(data)) { 00108 ast_log(LOG_WARNING, "SetCallerID requires an argument!\n"); 00109 return 0; 00110 } 00111 00112 u = ast_module_user_add(chan); 00113 00114 if (!dep_warning) { 00115 dep_warning = 1; 00116 ast_log(LOG_WARNING, "SetCallerID is deprecated. Please use Set(CALLERID(all)=...) or Set(CALLERID(ani)=...) instead.\n"); 00117 } 00118 00119 tmp = ast_strdupa(data); 00120 00121 opt = strchr(tmp, '|'); 00122 if (opt) { 00123 *opt = '\0'; 00124 opt++; 00125 if (*opt == 'a') 00126 anitoo = 1; 00127 } 00128 00129 ast_callerid_split(tmp, name, sizeof(name), num, sizeof(num)); 00130 ast_set_callerid(chan, num, name, anitoo ? num : NULL); 00131 00132 ast_module_user_remove(u); 00133 00134 return res; 00135 }
static int setcallerid_pres_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 67 of file app_setcallerid.c.
References ast_log(), ast_module_user_add, ast_module_user_remove, ast_parse_caller_presentation(), ast_channel::cid, ast_callerid::cid_pres, and LOG_WARNING.
Referenced by load_module().
00068 { 00069 struct ast_module_user *u; 00070 int pres = -1; 00071 00072 u = ast_module_user_add(chan); 00073 00074 pres = ast_parse_caller_presentation(data); 00075 00076 if (pres < 0) { 00077 ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n", 00078 (char *) data); 00079 ast_module_user_remove(u); 00080 return 0; 00081 } 00082 00083 chan->cid.cid_pres = pres; 00084 ast_module_user_remove(u); 00085 return 0; 00086 }
static int unload_module | ( | void | ) | [static] |
Definition at line 137 of file app_setcallerid.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00138 { 00139 int res; 00140 00141 res = ast_unregister_application(app2); 00142 res |= ast_unregister_application(app); 00143 00144 ast_module_user_hangup_all(); 00145 00146 return res; 00147 }
char* app = "SetCallerID" [static] |
Definition at line 88 of file app_setcallerid.c.
char* app2 = "SetCallerPres" [static] |
Definition at line 46 of file app_setcallerid.c.
char* descrip [static] |
Initial value:
" SetCallerID(clid[|a]): Set Caller*ID on a call to a new\n" "value. Sets ANI as well if a flag is used. \n"
Definition at line 92 of file app_setcallerid.c.
char* descrip2 [static] |
Definition at line 51 of file app_setcallerid.c.
char* synopsis = "Set CallerID" [static] |
Definition at line 90 of file app_setcallerid.c.
char* synopsis2 = "Set CallerID Presentation" [static] |
Definition at line 48 of file app_setcallerid.c.