#include <string.h>
#include <stdlib.h>
#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/options.h"
#include "asterisk/transcap.h"
Include dependency graph for app_settransfercapability.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 | settransfercapability_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 = "SetTransferCapability" |
static char * | descrip |
LOCAL_USER_DECL | |
STANDARD_LOCAL_USER | |
static char * | synopsis = "Set ISDN Transfer Capability" |
struct { | |
char * name | |
int val | |
} | transcaps [] |
Definition in file app_settransfercapability.c.
char* description | ( | void | ) |
Provides a description of the module.
Definition at line 130 of file app_settransfercapability.c.
00131 { 00132 return synopsis; 00133 }
char* key | ( | void | ) |
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 142 of file app_settransfercapability.c.
References ASTERISK_GPL_KEY.
00143 { 00144 return ASTERISK_GPL_KEY; 00145 }
int load_module | ( | void | ) |
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 125 of file app_settransfercapability.c.
References ast_register_application(), and settransfercapability_exec().
00126 { 00127 return ast_register_application(app, settransfercapability_exec, synopsis, descrip); 00128 }
static int settransfercapability_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 72 of file app_settransfercapability.c.
References ast_log(), ast_strdupa, ast_verbose(), localuser::chan, LOCAL_USER_ADD, LOCAL_USER_REMOVE, LOG_WARNING, name, option_verbose, transcaps, ast_channel::transfercapability, and VERBOSE_PREFIX_3.
Referenced by load_module().
00073 { 00074 char *tmp = NULL; 00075 struct localuser *u; 00076 int x; 00077 char *opts; 00078 int transfercapability = -1; 00079 00080 LOCAL_USER_ADD(u); 00081 00082 if (data) 00083 tmp = ast_strdupa(data); 00084 else 00085 tmp = ""; 00086 00087 opts = strchr(tmp, '|'); 00088 if (opts) 00089 *opts = '\0'; 00090 00091 for (x = 0; x < (sizeof(transcaps) / sizeof(transcaps[0])); x++) { 00092 if (!strcasecmp(transcaps[x].name, tmp)) { 00093 transfercapability = transcaps[x].val; 00094 break; 00095 } 00096 } 00097 if (transfercapability < 0) { 00098 ast_log(LOG_WARNING, "'%s' is not a valid transfer capability (see 'show application SetTransferCapability')\n", tmp); 00099 LOCAL_USER_REMOVE(u); 00100 return 0; 00101 } 00102 00103 chan->transfercapability = (unsigned short)transfercapability; 00104 00105 if (option_verbose > 2) 00106 ast_verbose(VERBOSE_PREFIX_3 "Setting transfer capability to: 0x%.2x - %s.\n", transfercapability, tmp); 00107 00108 LOCAL_USER_REMOVE(u); 00109 00110 return 0; 00111 }
int unload_module | ( | void | ) |
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 114 of file app_settransfercapability.c.
References ast_unregister_application(), and STANDARD_HANGUP_LOCALUSERS.
00115 { 00116 int res; 00117 00118 res = ast_unregister_application(app); 00119 00120 STANDARD_HANGUP_LOCALUSERS; 00121 00122 return res; 00123 }
int usecount | ( | void | ) |
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 135 of file app_settransfercapability.c.
References STANDARD_USECOUNT.
00136 { 00137 int res; 00138 STANDARD_USECOUNT(res); 00139 return res; 00140 }
char* app = "SetTransferCapability" [static] |
Definition at line 41 of file app_settransfercapability.c.
char* descrip [static] |
Definition at line 58 of file app_settransfercapability.c.
Definition at line 47 of file app_settransfercapability.c.
char* name |
Definition at line 49 of file app_settransfercapability.c.
Definition at line 45 of file app_settransfercapability.c.
char* synopsis = "Set ISDN Transfer Capability" [static] |
Definition at line 43 of file app_settransfercapability.c.
struct { ... } transcaps[] [static] |
Referenced by settransfercapability_exec().
int val |
Definition at line 49 of file app_settransfercapability.c.