#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "asterisk.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"
#include "asterisk/utils.h"
Include dependency graph for app_setcidname.c:
Go to the source code of this file.
Functions | |
char * | description (void) |
Provides a description of the module. | |
char * | key () |
Returns the ASTERISK_GPL_KEY. | |
int | load_module (void) |
Initialize the module. | |
static int | setcallerid_exec (struct ast_channel *chan, void *data) |
int | unload_module (void) |
Cleanup all module structures, sockets, etc. | |
int | usecount (void) |
Provides a usecount. | |
Variables | |
static char * | app = "SetCIDName" |
static char * | descrip |
LOCAL_USER_DECL | |
STANDARD_LOCAL_USER | |
static char * | synopsis = "Set CallerID Name" |
static char * | tdesc = "Set CallerID Name" |
Definition in file app_setcidname.c.
|
Provides a description of the module.
Definition at line 117 of file app_setcidname.c. 00118 { 00119 return tdesc; 00120 }
|
|
Returns the ASTERISK_GPL_KEY. This returns the ASTERISK_GPL_KEY, signifiying that you agree to the terms of the GPL stated in the ASTERISK_GPL_KEY. Your module will not load if it does not return the EXACT message:
char *key(void) { return ASTERISK_GPL_KEY; }
Definition at line 129 of file app_setcidname.c. References ASTERISK_GPL_KEY. 00130 { 00131 return ASTERISK_GPL_KEY; 00132 }
|
|
Initialize the module. Initialize the Agents module. This function is being called by Asterisk when loading the module. Among other thing it registers applications, cli commands and reads the cofiguration file.
Definition at line 112 of file app_setcidname.c. References ast_register_application(), and setcallerid_exec(). 00113 { 00114 return ast_register_application(app, setcallerid_exec, synopsis, descrip); 00115 }
|
|
Definition at line 63 of file app_setcidname.c. References ast_log(), ast_set_callerid(), ast_strdupa, ast_strlen_zero(), localuser::chan, LOCAL_USER_ADD, LOCAL_USER_REMOVE, LOG_ERROR, and LOG_WARNING. 00064 { 00065 char *tmp = NULL; 00066 struct localuser *u; 00067 char *opt; 00068 static int deprecation_warning = 0; 00069 00070 if (!deprecation_warning) { 00071 ast_log(LOG_WARNING, "SetCIDName is deprecated, please use Set(CALLERID(name)=value) instead.\n"); 00072 deprecation_warning = 1; 00073 } 00074 00075 if (ast_strlen_zero(data)) { 00076 ast_log(LOG_ERROR, "SetCIDName requires an argument!\n"); 00077 return 0; 00078 } 00079 00080 LOCAL_USER_ADD(u); 00081 00082 tmp = ast_strdupa(data); 00083 if (!tmp) { 00084 ast_log(LOG_ERROR, "Out of memory\n"); 00085 LOCAL_USER_REMOVE(u); 00086 return -1; 00087 } 00088 00089 opt = strchr(tmp, '|'); 00090 if (opt) { 00091 *opt = '\0'; 00092 } 00093 00094 ast_set_callerid(chan, NULL, tmp, NULL); 00095 00096 LOCAL_USER_REMOVE(u); 00097 00098 return 0; 00099 }
|
|
Cleanup all module structures, sockets, etc. This is called at exit. Any registrations and memory allocations need to be unregistered and free'd here. Nothing else will do these for you (until exit).
Definition at line 101 of file app_setcidname.c. References ast_unregister_application(), and STANDARD_HANGUP_LOCALUSERS. 00102 { 00103 int res; 00104 00105 res = ast_unregister_application(app); 00106 00107 STANDARD_HANGUP_LOCALUSERS; 00108 00109 return res; 00110 }
|
|
Provides a usecount. This function will be called by various parts of asterisk. Basically, all it has to do is to return a usecount when called. You will need to maintain your usecount within the module somewhere. The usecount should be how many channels provided by this module are in use.
Definition at line 122 of file app_setcidname.c. References STANDARD_USECOUNT. 00123 { 00124 int res; 00125 STANDARD_USECOUNT(res); 00126 return res; 00127 }
|
|
Definition at line 47 of file app_setcidname.c. |
|
Definition at line 51 of file app_setcidname.c. |
|
Definition at line 61 of file app_setcidname.c. |
|
Definition at line 59 of file app_setcidname.c. |
|
Definition at line 49 of file app_setcidname.c. |
|
Definition at line 45 of file app_setcidname.c. |