#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/adsi.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | cpeid_exec (struct ast_channel *chan, void *idata) |
static int | cpeid_setstatus (struct ast_channel *chan, char *stuff[], int voice) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Get ADSI CPE ID" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } |
static char * | app = "GetCPEID" |
static struct ast_module_info * | ast_module_info = &__mod_info |
static char * | descrip |
static char * | synopsis = "Get ADSI CPE ID" |
Definition in file app_getcpeid.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 130 of file app_getcpeid.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 130 of file app_getcpeid.c.
static int cpeid_exec | ( | struct ast_channel * | chan, | |
void * | idata | |||
) | [static] |
Definition at line 59 of file app_getcpeid.c.
References ast_adsi_get_cpeid, ast_adsi_get_cpeinfo, ast_adsi_load_session, ast_adsi_unload_session, ast_verb, ast_waitfordigit(), buttons, chan, cpeid_setstatus(), height, ast_channel::name, and width.
Referenced by load_module().
00060 { 00061 int res=0; 00062 unsigned char cpeid[4]; 00063 int gotgeometry = 0; 00064 int gotcpeid = 0; 00065 int width, height, buttons; 00066 char *data[4]; 00067 unsigned int x; 00068 00069 for (x = 0; x < 4; x++) 00070 data[x] = alloca(80); 00071 00072 strcpy(data[0], "** CPE Info **"); 00073 strcpy(data[1], "Identifying CPE..."); 00074 strcpy(data[2], "Please wait..."); 00075 res = ast_adsi_load_session(chan, NULL, 0, 1); 00076 if (res > 0) { 00077 cpeid_setstatus(chan, data, 0); 00078 res = ast_adsi_get_cpeid(chan, cpeid, 0); 00079 if (res > 0) { 00080 gotcpeid = 1; 00081 ast_verb(3, "Got CPEID of '%02x:%02x:%02x:%02x' on '%s'\n", cpeid[0], cpeid[1], cpeid[2], cpeid[3], chan->name); 00082 } 00083 if (res > -1) { 00084 strcpy(data[1], "Measuring CPE..."); 00085 strcpy(data[2], "Please wait..."); 00086 cpeid_setstatus(chan, data, 0); 00087 res = ast_adsi_get_cpeinfo(chan, &width, &height, &buttons, 0); 00088 if (res > -1) { 00089 ast_verb(3, "CPE has %d lines, %d columns, and %d buttons on '%s'\n", height, width, buttons, chan->name); 00090 gotgeometry = 1; 00091 } 00092 } 00093 if (res > -1) { 00094 if (gotcpeid) 00095 snprintf(data[1], 80, "CPEID: %02x:%02x:%02x:%02x", cpeid[0], cpeid[1], cpeid[2], cpeid[3]); 00096 else 00097 strcpy(data[1], "CPEID Unknown"); 00098 if (gotgeometry) 00099 snprintf(data[2], 80, "Geom: %dx%d, %d buttons", width, height, buttons); 00100 else 00101 strcpy(data[2], "Geometry unknown"); 00102 strcpy(data[3], "Press # to exit"); 00103 cpeid_setstatus(chan, data, 1); 00104 for(;;) { 00105 res = ast_waitfordigit(chan, 1000); 00106 if (res < 0) 00107 break; 00108 if (res == '#') { 00109 res = 0; 00110 break; 00111 } 00112 } 00113 ast_adsi_unload_session(chan); 00114 } 00115 } 00116 00117 return res; 00118 }
static int cpeid_setstatus | ( | struct ast_channel * | chan, | |
char * | stuff[], | |||
int | voice | |||
) | [static] |
Definition at line 48 of file app_getcpeid.c.
References ADSI_JUST_CENT, ADSI_JUST_LEFT, ast_adsi_print, chan, and justify.
Referenced by cpeid_exec().
00049 { 00050 int justify[5] = { ADSI_JUST_CENT, ADSI_JUST_LEFT, ADSI_JUST_LEFT, ADSI_JUST_LEFT }; 00051 char *tmp[5]; 00052 int x; 00053 for (x=0;x<4;x++) 00054 tmp[x] = stuff[x]; 00055 tmp[4] = NULL; 00056 return ast_adsi_print(chan, tmp, justify, voice); 00057 }
static int load_module | ( | void | ) | [static] |
Definition at line 125 of file app_getcpeid.c.
References ast_register_application, and cpeid_exec().
00126 { 00127 return ast_register_application(app, cpeid_exec, synopsis, descrip); 00128 }
static int unload_module | ( | void | ) | [static] |
Definition at line 120 of file app_getcpeid.c.
References ast_unregister_application().
00121 { 00122 return ast_unregister_application(app); 00123 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Get ADSI CPE ID" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 130 of file app_getcpeid.c.
char* app = "GetCPEID" [static] |
Definition at line 39 of file app_getcpeid.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 130 of file app_getcpeid.c.
char* descrip [static] |
Initial value:
" GetCPEID(): Obtains and displays ADSI CPE ID and other information in order\n" "to properly setup dahdi.conf for on-hook operations.\n"
Definition at line 43 of file app_getcpeid.c.
char* synopsis = "Get ADSI CPE ID" [static] |
Definition at line 41 of file app_getcpeid.c.