54 static char *app =
"GetCPEID";
56 static int cpeid_setstatus(
struct ast_channel *chan,
char *stuff[],
int voice)
58 int justify[5] = { ADSI_JUST_CENT, ADSI_JUST_LEFT, ADSI_JUST_LEFT, ADSI_JUST_LEFT };
67 static int cpeid_exec(
struct ast_channel *chan,
const char *idata)
70 unsigned char cpeid[4];
73 int width, height, buttons;
77 for (x = 0; x < 4; x++)
80 strcpy(data[0],
"** CPE Info **");
81 strcpy(data[1],
"Identifying CPE...");
82 strcpy(data[2],
"Please wait...");
85 cpeid_setstatus(chan, data, 0);
89 ast_verb(3,
"Got CPEID of '%02hhx:%02hhx:%02hhx:%02hhx' on '%s'\n",
90 cpeid[0], cpeid[1], cpeid[2], cpeid[3], ast_channel_name(chan));
93 strcpy(data[1],
"Measuring CPE...");
94 strcpy(data[2],
"Please wait...");
95 cpeid_setstatus(chan, data, 0);
96 res = ast_adsi_get_cpeinfo(chan, &width, &height, &buttons, 0);
98 ast_verb(3,
"CPE has %d lines, %d columns, and %d buttons on '%s'\n", height, width, buttons, ast_channel_name(chan));
104 snprintf(data[1], 80,
"CPEID: %02hhx:%02hhx:%02hhx:%02hhx",
105 cpeid[0], cpeid[1], cpeid[2], cpeid[3]);
107 strcpy(data[1],
"CPEID Unknown");
109 snprintf(data[2], 80,
"Geom: %dx%d, %d buttons", width, height, buttons);
111 strcpy(data[2],
"Geometry unknown");
112 strcpy(data[3],
"Press # to exit");
113 cpeid_setstatus(chan, data, 1);
123 ast_adsi_unload_session(chan);
130 static int unload_module(
void)
135 static int load_module(
void)
141 .support_level = AST_MODULE_SUPPORT_DEPRECATED,
143 .unload = unload_module,
144 .requires =
"res_adsi",
Main Channel structure associated with a channel.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
int ast_adsi_load_session(struct ast_channel *chan, unsigned char *app, int ver, int data)
Check if scripts for a given app are already loaded. Version may be -1, if any version is okay...
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
ADSI Support (built upon Caller*ID)
int ast_unregister_application(const char *app)
Unregister an application.
int ast_adsi_get_cpeid(struct ast_channel *chan, unsigned char *cpeid, int voice)
General Asterisk PBX channel definitions.
Core PBX routines and definitions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_adsi_print(struct ast_channel *chan, char **lines, int *align, int voice)
Display some stuff on the screen.