53 #define DEFAULT_ADSI_MAX_RETRIES 3
55 #define ADSI_MAX_INTRO 20
56 #define ADSI_MAX_SPEED_DIAL 6
58 #define ADSI_FLAG_DATAMODE (1 << 8)
60 static int maxretries = DEFAULT_ADSI_MAX_RETRIES;
63 #define ADSI_SPEED_DIAL 10
65 static char intro[ADSI_MAX_INTRO][20];
66 static int aligns[ADSI_MAX_INTRO];
68 #define SPEEDDIAL_MAX_LEN 20
69 static char speeddial[ADSI_MAX_SPEED_DIAL][3][SPEEDDIAL_MAX_LEN];
71 static int alignment = 0;
73 static int adsi_begin_download(
struct ast_channel *chan,
char *service,
unsigned char *fdn,
unsigned char *sec,
int version);
74 static int adsi_end_download(
struct ast_channel *chan);
75 static int adsi_channel_restore(
struct ast_channel *chan);
76 static int adsi_print(
struct ast_channel *chan,
char **lines,
int *align,
int voice);
77 static int adsi_load_session(
struct ast_channel *chan,
unsigned char *app,
int ver,
int data);
78 static int adsi_unload_session(
struct ast_channel *chan);
79 static int adsi_transmit_message(
struct ast_channel *chan,
unsigned char *msg,
int msglen,
int msgtype);
80 static int adsi_transmit_message_full(
struct ast_channel *chan,
unsigned char *msg,
int msglen,
int msgtype,
int dowait);
81 static int adsi_read_encoded_dtmf(
struct ast_channel *chan,
unsigned char *buf,
int maxlen);
82 static int adsi_connect_session(
unsigned char *buf,
unsigned char *fdn,
int ver);
83 static int adsi_query_cpeid(
unsigned char *buf);
84 static int adsi_query_cpeinfo(
unsigned char *buf);
85 static int adsi_get_cpeid(
struct ast_channel *chan,
unsigned char *cpeid,
int voice);
86 static int adsi_get_cpeinfo(
struct ast_channel *chan,
int *width,
int *height,
int *buttons,
int voice);
87 static int adsi_download_connect(
unsigned char *buf,
char *service,
unsigned char *fdn,
unsigned char *sec,
int ver);
88 static int adsi_disconnect_session(
unsigned char *buf);
89 static int adsi_download_disconnect(
unsigned char *buf);
90 static int adsi_data_mode(
unsigned char *buf);
91 static int adsi_clear_soft_keys(
unsigned char *buf);
92 static int adsi_clear_screen(
unsigned char *buf);
93 static int adsi_voice_mode(
unsigned char *buf,
int when);
94 static int adsi_available(
struct ast_channel *chan);
95 static int adsi_display(
unsigned char *buf,
int page,
int line,
int just,
int wrap,
char *col1,
char *col2);
96 static int adsi_set_line(
unsigned char *buf,
int page,
int line);
97 static int adsi_load_soft_key(
unsigned char *buf,
int key,
const char *llabel,
const char *slabel,
char *ret,
int data);
98 static int adsi_set_keys(
unsigned char *buf,
unsigned char *
keys);
99 static int adsi_input_control(
unsigned char *buf,
int page,
int line,
int display,
int format,
int just);
100 static int adsi_input_format(
unsigned char *buf,
int num,
int dir,
int wrap,
char *format1,
char *format2);
102 static int adsi_generate(
unsigned char *buf,
int msgtype,
unsigned char *msg,
int msglen,
int msgnum,
int last,
struct ast_format *codec)
104 int sum, x, bytes = 0;
106 float cr = 1.0, ci = 0.0, scont = 0.0;
114 for (x = 0; x < 150; x++) {
124 PUT_CLID(msglen + 1);
132 for (x = 0; x < msglen; x++) {
138 PUT_CLID(256-(sum & 0xff));
143 for (x = 0; x < 50; x++) {
152 static int adsi_careful_send(
struct ast_channel *chan,
unsigned char *buf,
int len,
int *remain)
163 if (remain && *remain) {
170 *remain = *remain - amt;
177 ast_log(LOG_WARNING,
"Failed to carefully write frame\n");
204 ast_log(LOG_WARNING,
"Channel not in ulaw?\n");
218 ast_log(LOG_WARNING,
"Failed to carefully write frame\n");
230 static int __adsi_transmit_messages(
struct ast_channel *chan,
unsigned char **msg,
int *msglen,
int *msgtype)
233 unsigned char buf[24000 * 5];
234 int pos = 0, res, x, start = 0, retries = 0, waittime, rem = 0, def;
238 if (ast_channel_adsicpe(chan) == AST_ADSI_UNAVAILABLE) {
240 ast_log(LOG_WARNING,
"ADSI is not supported for %s\n", ast_channel_name(chan));
245 while (retries < maxretries) {
246 if (!(ast_channel_adsicpe(chan) & ADSI_FLAG_DATAMODE)) {
251 if (adsi_careful_send(chan, buf, 680, NULL)) {
252 ast_log(LOG_WARNING,
"Unable to send CAS\n");
260 ast_verb(4,
"No ADSI CPE detected (%d)\n", res);
261 if (!ast_channel_adsicpe(chan)) {
262 ast_channel_adsicpe_set(chan, AST_ADSI_UNAVAILABLE);
275 if (!ast_channel_adsicpe(chan)) {
276 ast_channel_adsicpe_set(chan, AST_ADSI_AVAILABLE);
281 ast_debug(1,
"Off-hook capable CPE only, not ADSI\n");
283 ast_log(LOG_WARNING,
"Unknown ADSI response '%c'\n", f->
subclass.
integer);
285 if (!ast_channel_adsicpe(chan)) {
286 ast_channel_adsicpe_set(chan, AST_ADSI_UNAVAILABLE);
296 ast_verb(4,
"ADSI Compatible CPE Detected\n");
306 while ((x < 6) && msg[x]) {
307 if ((res = adsi_generate(buf + pos, msgtype[x], msg[x], msglen[x], x+1 - start, (x == 5) || !msg[x+1],
ast_format_ulaw)) < 0) {
308 ast_log(LOG_WARNING,
"Failed to generate ADSI message %d on channel %s\n", x + 1, ast_channel_name(chan));
311 ast_debug(1,
"Message %d, of %d input bytes, %d output bytes\n", x + 1, msglen[x], res);
318 res = adsi_careful_send(chan, buf, pos, &rem);
326 ast_debug(1,
"Sent total spill of %d bytes\n", pos);
328 memset(ack, 0,
sizeof(ack));
334 ast_debug(1,
"Acked up to message %d\n", atoi(ack + 1)); start += atoi(ack + 1);
339 ast_debug(1,
"Retransmitting (%d), from %d\n", retries, start + 1);
343 ast_log(LOG_WARNING,
"Unexpected response to ack: %s (retry %d)\n", ack, retries);
346 if (retries >= maxretries) {
347 ast_log(LOG_WARNING,
"Maximum ADSI Retries (%d) exceeded\n", maxretries);
354 static int adsi_begin_download(
struct ast_channel *chan,
char *service,
unsigned char *fdn,
unsigned char *sec,
int version)
357 unsigned char buf[256];
362 bytes += adsi_download_connect(buf + bytes, service, fdn, sec, version);
363 if (adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DOWNLOAD, 0)) {
372 ast_debug(1,
"Download was denied by CPE\n");
376 static int adsi_end_download(
struct ast_channel *chan)
379 unsigned char buf[256];
383 bytes += adsi_download_disconnect(buf + bytes);
384 if (adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DOWNLOAD, 0)) {
390 static int adsi_transmit_message_full(
struct ast_channel *chan,
unsigned char *msg,
int msglen,
int msgtype,
int dowait)
392 unsigned char *msgs[5] = { NULL, NULL, NULL, NULL, NULL };
393 int msglens[5], msgtypes[5], newdatamode = (ast_channel_adsicpe(chan) & ADSI_FLAG_DATAMODE), res, x, waitforswitch = 0;
397 for (x = 0; x < msglen; x += (msg[x+1]+2)) {
398 if (msg[x] == ADSI_SWITCH_TO_DATA) {
399 ast_debug(1,
"Switch to data is sent!\n");
401 newdatamode = ADSI_FLAG_DATAMODE;
404 if (msg[x] == ADSI_SWITCH_TO_VOICE) {
405 ast_debug(1,
"Switch to voice is sent!\n");
413 msgtypes[0] = msgtype;
416 ast_log(LOG_WARNING,
"Can't send ADSI message of %d bytes, too large\n", msglen);
422 writeformat =
ao2_bump(ast_channel_writeformat(chan));
423 readformat =
ao2_bump(ast_channel_readformat(chan));
426 ast_log(LOG_WARNING,
"Unable to set write format to ULAW\n");
431 ast_log(LOG_WARNING,
"Unable to set read format to ULAW\n");
434 ast_log(LOG_WARNING,
"Unable to restore write format to %s\n",
ast_format_get_name(writeformat));
439 res = __adsi_transmit_messages(chan, msgs, msglens, msgtypes);
442 ast_debug(1,
"Wait for switch is '%d'\n", waitforswitch);
450 ast_channel_adsicpe_set(chan, (ast_channel_adsicpe(chan) & ~ADSI_FLAG_DATAMODE) | newdatamode);
466 static int adsi_transmit_message(
struct ast_channel *chan,
unsigned char *msg,
int msglen,
int msgtype)
468 return adsi_transmit_message_full(chan, msg, msglen, msgtype, 1);
471 static inline int ccopy(
unsigned char *dst,
const unsigned char *
src,
int max)
475 while ((x < max) && src[x] && (src[x] != 0xff)) {
482 static int adsi_load_soft_key(
unsigned char *buf,
int key,
const char *llabel,
const char *slabel,
char *ret,
int data)
487 if ((key < 2) || (key > 33)) {
491 buf[bytes++] = ADSI_LOAD_SOFTKEY;
498 bytes += ccopy(buf + bytes, (
const unsigned char *)llabel, 18);
504 bytes += ccopy(buf + bytes, (
const unsigned char *)slabel, 7);
512 buf[bytes++] = ADSI_SWITCH_TO_DATA2;
515 bytes += ccopy(buf + bytes, (
const unsigned char *)ret, 20);
523 static int adsi_connect_session(
unsigned char *buf,
unsigned char *fdn,
int ver)
528 buf[bytes++] = ADSI_CONNECT_SESSION;
534 for (x = 0; x < 4; x++) {
535 buf[bytes++] = fdn[x];
538 buf[bytes++] = ver & 0xff;
547 static int adsi_download_connect(
unsigned char *buf,
char *service,
unsigned char *fdn,
unsigned char *sec,
int ver)
552 buf[bytes++] = ADSI_DOWNLOAD_CONNECT;
558 bytes+= ccopy(buf + bytes, (
unsigned char *)service, 18);
563 for (x = 0; x < 4; x++) {
564 buf[bytes++] = fdn[x];
567 for (x = 0; x < 4; x++) {
568 buf[bytes++] = sec[x];
571 buf[bytes++] = ver & 0xff;
579 static int adsi_disconnect_session(
unsigned char *buf)
584 buf[bytes++] = ADSI_DISC_SESSION;
594 static int adsi_query_cpeid(
unsigned char *buf)
597 buf[bytes++] = ADSI_QUERY_CPEID;
604 static int adsi_query_cpeinfo(
unsigned char *buf)
607 buf[bytes++] = ADSI_QUERY_CONFIG;
614 static int adsi_read_encoded_dtmf(
struct ast_channel *chan,
unsigned char *buf,
int maxlen)
616 int bytes = 0, res, gotstar = 0, pos = 0;
617 unsigned char current = 0;
619 memset(buf, 0, maxlen);
621 while (bytes <= maxlen) {
631 if ((res <
'0') || (res >
'9')) {
640 buf[bytes++] = (res << 4) | current;
651 static int adsi_get_cpeid(
struct ast_channel *chan,
unsigned char *cpeid,
int voice)
653 unsigned char buf[256] =
"";
656 bytes += adsi_data_mode(buf);
657 adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
660 bytes += adsi_query_cpeid(buf);
661 adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
664 res = adsi_read_encoded_dtmf(chan, cpeid, 4);
666 ast_log(LOG_WARNING,
"Got %d bytes back of encoded DTMF, expecting 4\n", res);
674 bytes += adsi_voice_mode(buf, 0);
675 adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
682 static int adsi_get_cpeinfo(
struct ast_channel *chan,
int *width,
int *height,
int *buttons,
int voice)
684 unsigned char buf[256] =
"";
687 bytes += adsi_data_mode(buf);
688 adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
691 bytes += adsi_query_cpeinfo(buf);
692 adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
695 if ((res =
ast_readstring(chan, (
char *) buf, 2, 1000, 500,
"")) < 0) {
698 if (strlen((
char *) buf) != 2) {
699 ast_log(LOG_WARNING,
"Got %d bytes of width, expecting 2\n", res);
705 *width = atoi((
char *) buf);
708 memset(buf, 0,
sizeof(buf));
710 if ((res =
ast_readstring(chan, (
char *) buf, 2, 1000, 500,
"")) < 0) {
713 if (strlen((
char *) buf) != 2) {
714 ast_log(LOG_WARNING,
"Got %d bytes of height, expecting 2\n", res);
720 *height = atoi((
char *) buf);
724 memset(buf, 0,
sizeof(buf));
726 if ((res =
ast_readstring(chan, (
char *) buf, 1, 1000, 500,
"")) < 0) {
729 if (strlen((
char *) buf) != 1) {
730 ast_log(LOG_WARNING,
"Got %d bytes of buttons, expecting 1\n", res);
736 *buttons = atoi((
char *) buf);
741 bytes += adsi_voice_mode(buf, 0);
742 adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
749 static int adsi_data_mode(
unsigned char *buf)
754 buf[bytes++] = ADSI_SWITCH_TO_DATA;
764 static int adsi_clear_soft_keys(
unsigned char *buf)
769 buf[bytes++] = ADSI_CLEAR_SOFTKEY;
779 static int adsi_clear_screen(
unsigned char *buf)
784 buf[bytes++] = ADSI_CLEAR_SCREEN;
794 static int adsi_voice_mode(
unsigned char *buf,
int when)
799 buf[bytes++] = ADSI_SWITCH_TO_VOICE;
804 buf[bytes++] = when & 0x7f;
811 static int adsi_available(
struct ast_channel *chan)
813 int cpe = ast_channel_adsicpe(chan) & 0xff;
814 if ((cpe == AST_ADSI_AVAILABLE) ||
815 (cpe == AST_ADSI_UNKNOWN)) {
821 static int adsi_download_disconnect(
unsigned char *buf)
826 buf[bytes++] = ADSI_DOWNLOAD_DISC;
836 static int adsi_display(
unsigned char *buf,
int page,
int line,
int just,
int wrap,
837 char *col1,
char *col2)
844 if (line > 4)
return -1;
846 if (line > 33)
return -1;
853 buf[bytes++] = ADSI_LOAD_VIRTUAL_DISP;
859 buf[bytes++] = ((page & 0x1) << 7) | ((wrap & 0x1) << 6) | (line & 0x3f);
862 buf[bytes++] = (just & 0x3) << 5;
868 bytes+= ccopy(buf + bytes, (
unsigned char *)col1, 20);
874 bytes += ccopy(buf + bytes, (
unsigned char *)col2, 20);
883 static int adsi_input_control(
unsigned char *buf,
int page,
int line,
int display,
int format,
int just)
888 if (line > 4)
return -1;
890 if (line > 33)
return -1;
897 buf[bytes++] = ADSI_INPUT_CONTROL;
899 buf[bytes++] = ((page & 1) << 7) | (line & 0x3f);
900 buf[bytes++] = ((display & 1) << 7) | ((just & 0x3) << 4) | (format & 0x7);
906 static int adsi_input_format(
unsigned char *buf,
int num,
int dir,
int wrap,
char *format1,
char *format2)
910 if (ast_strlen_zero((
char *) format1)) {
914 buf[bytes++] = ADSI_INPUT_FORMAT;
916 buf[bytes++] = ((dir & 1) << 7) | ((wrap & 1) << 6) | (num & 0x7);
917 bytes += ccopy(buf + bytes, (
unsigned char *) format1, 20);
919 if (!ast_strlen_zero(format2)) {
920 bytes += ccopy(buf + bytes, (
unsigned char *) format2, 20);
926 static int adsi_set_keys(
unsigned char *buf,
unsigned char *
keys)
931 buf[bytes++] = ADSI_INIT_SOFTKEY_LINE;
935 for (x = 0; x < 6; x++) {
936 buf[bytes++] = (keys[x] & 0x3f) ? keys[x] : (keys[x] | 0x1);
942 static int adsi_set_line(
unsigned char *buf,
int page,
int line)
949 if (line > 4)
return -1;
951 if (line > 33)
return -1;
958 buf[bytes++] = ADSI_LINE_CONTROL;
964 buf[bytes++] = ((page & 0x1) << 7) | (line & 0x3f);
970 static int total = 0;
971 static int speeds = 0;
973 static int adsi_channel_restore(
struct ast_channel *chan)
975 unsigned char dsp[256] =
"", keyd[6] =
"";
980 bytes += adsi_set_line(dsp + bytes, ADSI_INFO_PAGE, 1);
985 for (x = 0; x < speeds; x++) {
986 keyd[x] = ADSI_SPEED_DIAL + x;
988 bytes += adsi_set_keys(dsp + bytes, keyd);
990 adsi_transmit_message_full(chan, dsp, bytes, ADSI_MSG_DISPLAY, 0);
995 static int adsi_print(
struct ast_channel *chan,
char **lines,
int *alignments,
int voice)
997 unsigned char buf[4096];
998 int bytes = 0, res, x;
1000 for (x = 0; lines[x]; x++) {
1001 bytes +=
adsi_display(buf + bytes, ADSI_INFO_PAGE, x+1, alignments[x], 0, lines[x],
"");
1003 bytes += adsi_set_line(buf + bytes, ADSI_INFO_PAGE, 1);
1005 bytes += adsi_voice_mode(buf + bytes, 0);
1007 res = adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
1015 static int adsi_load_session(
struct ast_channel *chan,
unsigned char *app,
int ver,
int data)
1017 unsigned char dsp[256] =
"";
1022 bytes += adsi_connect_session(dsp + bytes, app, ver);
1025 bytes += adsi_data_mode(dsp + bytes);
1029 if (adsi_transmit_message_full(chan, dsp, bytes, ADSI_MSG_DISPLAY, 0)) {
1037 ast_debug(1,
"No response from CPE about version. Assuming not there.\n");
1040 if (!strcmp(resp,
"B")) {
1041 ast_debug(1,
"CPE has script '%s' version %d already loaded\n", app, ver);
1043 }
else if (!strcmp(resp,
"A")) {
1044 ast_debug(1,
"CPE hasn't script '%s' version %d already loaded\n", app, ver);
1046 ast_log(LOG_WARNING,
"Unexpected CPE response to script query: %s\n", resp);
1054 static int adsi_unload_session(
struct ast_channel *chan)
1056 unsigned char dsp[256] =
"";
1060 bytes += adsi_disconnect_session(dsp + bytes);
1061 bytes += adsi_voice_mode(dsp + bytes, 0);
1064 if (adsi_transmit_message_full(chan, dsp, bytes, ADSI_MSG_DISPLAY, 0)) {
1071 static int str2align(
const char *s)
1073 if (!strncasecmp(s,
"l", 1)) {
1074 return ADSI_JUST_LEFT;
1075 }
else if (!strncasecmp(s,
"r", 1)) {
1076 return ADSI_JUST_RIGHT;
1077 }
else if (!strncasecmp(s,
"i", 1)) {
1078 return ADSI_JUST_IND;
1080 return ADSI_JUST_CENT;
1084 static void init_state(
void)
1088 for (x = 0; x < ADSI_MAX_INTRO; x++) {
1089 aligns[x] = ADSI_JUST_CENT;
1096 for (x = 3; x < ADSI_MAX_INTRO; x++) {
1099 memset(speeddial, 0,
sizeof(speeddial));
1100 alignment = ADSI_JUST_CENT;
1103 static void adsi_load(
int reload)
1113 if (conf == CONFIG_STATUS_FILEMISSING || conf == CONFIG_STATUS_FILEUNCHANGED || conf == CONFIG_STATUS_FILEINVALID) {
1116 for (v = ast_variable_browse(conf,
"intro"); v; v = v->
next) {
1117 if (!strcasecmp(v->
name,
"alignment")) {
1118 alignment = str2align(v->
value);
1119 }
else if (!strcasecmp(v->
name,
"greeting")) {
1120 if (x < ADSI_MAX_INTRO) {
1121 aligns[x] = alignment;
1125 }
else if (!strcasecmp(v->
name,
"maxretries")) {
1126 if (atoi(v->
value) > 0) {
1127 maxretries = atoi(v->
value);
1136 for (v = ast_variable_browse(conf,
"speeddial"); v; v = v->
next) {
1137 char buf[3 * SPEEDDIAL_MAX_LEN];
1138 char *stringp = buf;
1140 name = strsep(&stringp,
",");
1141 sname = strsep(&stringp,
",");
1145 if (x < ADSI_MAX_SPEED_DIAL) {
1160 static int reload(
void)
1167 .version = AST_ADSI_VERSION,
1168 .begin_download = adsi_begin_download,
1169 .end_download = adsi_end_download,
1170 .channel_restore = adsi_channel_restore,
1171 .print = adsi_print,
1172 .load_session = adsi_load_session,
1173 .unload_session = adsi_unload_session,
1174 .transmit_message = adsi_transmit_message,
1175 .transmit_message_full = adsi_transmit_message_full,
1176 .read_encoded_dtmf = adsi_read_encoded_dtmf,
1177 .connect_session = adsi_connect_session,
1178 .query_cpeid = adsi_query_cpeid,
1179 .query_cpeinfo = adsi_query_cpeinfo,
1180 .get_cpeid = adsi_get_cpeid,
1181 .get_cpeinfo = adsi_get_cpeinfo,
1182 .download_connect = adsi_download_connect,
1183 .disconnect_session = adsi_disconnect_session,
1184 .download_disconnect = adsi_download_disconnect,
1185 .data_mode = adsi_data_mode,
1186 .clear_soft_keys = adsi_clear_soft_keys,
1187 .clear_screen = adsi_clear_screen,
1188 .voice_mode = adsi_voice_mode,
1189 .available = adsi_available,
1191 .set_line = adsi_set_line,
1192 .load_soft_key = adsi_load_soft_key,
1193 .set_keys = adsi_set_keys,
1194 .input_control = adsi_input_control,
1195 .input_format = adsi_input_format,
1198 static int load_module(
void)
1201 ast_adsi_install_funcs(&res_adsi_funcs);
1205 static int unload_module(
void)
1208 ast_adsi_install_funcs(NULL);
1213 .support_level = AST_MODULE_SUPPORT_DEPRECATED,
1214 .load = load_module,
1215 .unload = unload_module,
A-Law to Signed linear conversion.
struct ast_variable * next
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
Time-related functions and macros.
Structure for variables, used for configurations and for channel variables.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
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)
struct ast_frame_subclass subclass
All configuration options for http media cache.
int ast_channel_defer_dtmf(struct ast_channel *chan)
Defers DTMF so that you only read things like hangups and audio.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Configuration File Parser.
u-Law to Signed linear conversion
#define ast_config_load(filename, flags)
Load a config file.
General Asterisk PBX channel definitions.
void ast_channel_undefer_dtmf(struct ast_channel *chan)
Unset defer DTMF flag on channel.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define ast_debug(level,...)
Log a DEBUG message.
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
union ast_frame::@224 data
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
Structure used to handle boolean flags.
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Data structure associated with a single frame of data.
enum ast_frame_type frametype
int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders)
Reads multiple digits.
struct ast_format * format
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_gen_cas(unsigned char *outbuf, int sas, int len, struct ast_format *codec)
Generate a CAS (CPE Alert Signal) tone for 'n' samples.