Sat Aug 6 00:39:33 2011

Asterisk developer's documentation


adsi.h File Reference

ADSI Support (built upon Caller*ID). More...

#include "asterisk/callerid.h"

Go to the source code of this file.

Defines

#define ADSI_BACKSPACE   0x89
#define ADSI_BLANK   0x86
#define ADSI_CLEAR_CALL_B   0x95
#define ADSI_CLEAR_CALL_BUF   145
#define ADSI_CLEAR_CHARS   0x88
#define ADSI_CLEAR_SCREEN   148
#define ADSI_CLEAR_SOFTKEY   136
#define ADSI_CLEAR_TYPE_AHEAD   143
#define ADSI_COMM_PAGE   0x1
#define ADSI_CONNECT_SESSION   142
#define ADSI_DELAY   0x90
#define ADSI_DIAL_PULSE_ONE   0x91
#define ADSI_DIAL_TONE_DETECT   0x84
#define ADSI_DIR_FROM_LEFT   (0)
#define ADSI_DIR_FROM_RIGHT   (1)
#define ADSI_DISC_SESSION   133
#define ADSI_DISP_CALL_BUF   0x94
#define ADSI_DISPLAY_CALL_BUF   144
#define ADSI_DOWNLOAD_CONNECT   131
#define ADSI_DOWNLOAD_DISC   132
#define ADSI_ENCODED_DTMF   0x80
#define ADSI_EXTENDED_DTMF   0x8F
#define ADSI_FLASH   0x83
#define ADSI_GOTO_LINE   0x8B
#define ADSI_GOTO_LINE_REL   0x8C
#define ADSI_INFO_PAGE   0x0
#define ADSI_INFORMATION   132
#define ADSI_INIT_SOFTKEY_LINE   129
#define ADSI_INPUT_CONTROL   137
#define ADSI_INPUT_FORMAT   138
#define ADSI_JUST_CENT   0x0
#define ADSI_JUST_IND   0x3
#define ADSI_JUST_LEFT   0x2
#define ADSI_JUST_RIGHT   0x1
#define ADSI_KEY_APPS   16
#define ADSI_KEY_HILITE   0x40
#define ADSI_KEY_SKT   0x80
#define ADSI_LINE_CONTROL   131
#define ADSI_LINE_NUMBER   0x85
#define ADSI_LOAD_DEFAULT   141
#define ADSI_LOAD_PREDEF_DISP   129
#define ADSI_LOAD_SCRIPT   130
#define ADSI_LOAD_SOFTKEY   128
#define ADSI_LOAD_SOFTKEY_TABLE   128
#define ADSI_LOAD_VIRTUAL_DISP   130
#define ADSI_MOVE_DATA   140
#define ADSI_MSG_DISPLAY   132
#define ADSI_MSG_DOWNLOAD   133
#define ADSI_OFF_HOOK   0x82
#define ADSI_ON_HOOK   0x81
#define ADSI_PAGE_DOWN   0x8E
#define ADSI_PAGE_UP   0x8D
#define ADSI_QUERY_CONFIG   149
#define ADSI_QUERY_CPEID   150
#define ADSI_SEND_CHARS   0x87
#define ADSI_SWITCH_TO_ALT   146
#define ADSI_SWITCH_TO_APP   151
#define ADSI_SWITCH_TO_DATA   134
#define ADSI_SWITCH_TO_DATA2   0x92
#define ADSI_SWITCH_TO_GRAPHICS   147
#define ADSI_SWITCH_TO_PERIPH   139
#define ADSI_SWITCH_TO_VOICE   135
#define ADSI_SWITCH_TO_VOICE2   0x93
#define ADSI_TAB_COLUMN   0x8A

Functions

int ast_adsi_available (struct ast_channel *chan)
int ast_adsi_begin_download (struct ast_channel *chan, char *service, unsigned char *fdn, unsigned char *sec, int version)
int ast_adsi_channel_init (struct ast_channel *chan)
int ast_adsi_channel_restore (struct ast_channel *chan)
int ast_adsi_clear_screen (unsigned char *buf)
int ast_adsi_clear_soft_keys (unsigned char *buf)
int ast_adsi_connect_session (unsigned char *buf, unsigned char *fdn, int ver)
int ast_adsi_data_mode (unsigned char *buf)
int ast_adsi_disconnect_session (unsigned char *buf)
int ast_adsi_display (unsigned char *buf, int page, int line, int just, int wrap, char *col1, char *col2)
int ast_adsi_download_connect (unsigned char *buf, char *service, unsigned char *fdn, unsigned char *sec, int ver)
int ast_adsi_download_disconnect (unsigned char *buf)
int ast_adsi_end_download (struct ast_channel *chan)
int ast_adsi_get_cpeid (struct ast_channel *chan, unsigned char *cpeid, int voice)
int ast_adsi_get_cpeinfo (struct ast_channel *chan, int *width, int *height, int *buttons, int voice)
int ast_adsi_input_control (unsigned char *buf, int page, int line, int display, int format, int just)
int ast_adsi_input_format (unsigned char *buf, int num, int dir, int wrap, char *format1, char *format2)
int ast_adsi_load_session (struct ast_channel *chan, unsigned char *app, int ver, int data)
int ast_adsi_load_soft_key (unsigned char *buf, int key, const char *llabel, const char *slabel, const char *ret, int data)
int ast_adsi_print (struct ast_channel *chan, char **lines, int *align, int voice)
int ast_adsi_query_cpeid (unsigned char *buf)
int ast_adsi_query_cpeinfo (unsigned char *buf)
int ast_adsi_read_encoded_dtmf (struct ast_channel *chan, unsigned char *buf, int maxlen)
int ast_adsi_set_keys (unsigned char *buf, unsigned char *keys)
int ast_adsi_set_line (unsigned char *buf, int page, int line)
int ast_adsi_transmit_message (struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype)
int ast_adsi_transmit_message_full (struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype, int dowait)
int ast_adsi_transmit_messages (struct ast_channel *chan, unsigned char **msg, int *msglen, int *msgtype)
int ast_adsi_unload_session (struct ast_channel *chan)
int ast_adsi_voice_mode (unsigned char *buf, int when)


Detailed Description

ADSI Support (built upon Caller*ID).

Definition in file adsi.h.


Define Documentation

#define ADSI_BACKSPACE   0x89

Definition at line 75 of file adsi.h.

#define ADSI_BLANK   0x86

Definition at line 72 of file adsi.h.

#define ADSI_CLEAR_CALL_B   0x95

Definition at line 87 of file adsi.h.

#define ADSI_CLEAR_CALL_BUF   145

Definition at line 50 of file adsi.h.

#define ADSI_CLEAR_CHARS   0x88

Definition at line 74 of file adsi.h.

#define ADSI_CLEAR_SCREEN   148

Definition at line 53 of file adsi.h.

Referenced by ast_adsi_clear_screen().

#define ADSI_CLEAR_SOFTKEY   136

Definition at line 41 of file adsi.h.

Referenced by ast_adsi_clear_soft_keys().

#define ADSI_CLEAR_TYPE_AHEAD   143

Definition at line 48 of file adsi.h.

#define ADSI_COMM_PAGE   0x1

Definition at line 104 of file adsi.h.

Referenced by adsi_folders(), adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_logo(), adsi_password(), adsi_status(), adsi_status2(), vm_newuser(), vm_options(), and vm_tempgreeting().

#define ADSI_CONNECT_SESSION   142

Definition at line 47 of file adsi.h.

Referenced by ast_adsi_connect_session().

#define ADSI_DELAY   0x90

Definition at line 82 of file adsi.h.

#define ADSI_DIAL_PULSE_ONE   0x91

Definition at line 83 of file adsi.h.

#define ADSI_DIAL_TONE_DETECT   0x84

Definition at line 70 of file adsi.h.

#define ADSI_DIR_FROM_LEFT   (0)

Definition at line 117 of file adsi.h.

Referenced by adsi_login(), and adsi_password().

#define ADSI_DIR_FROM_RIGHT   (1)

Definition at line 118 of file adsi.h.

#define ADSI_DISC_SESSION   133

Definition at line 38 of file adsi.h.

Referenced by ast_adsi_disconnect_session().

#define ADSI_DISP_CALL_BUF   0x94

Definition at line 86 of file adsi.h.

#define ADSI_DISPLAY_CALL_BUF   144

Definition at line 49 of file adsi.h.

#define ADSI_DOWNLOAD_CONNECT   131

Definition at line 62 of file adsi.h.

Referenced by ast_adsi_download_connect().

#define ADSI_DOWNLOAD_DISC   132

Definition at line 63 of file adsi.h.

Referenced by ast_adsi_download_disconnect().

#define ADSI_ENCODED_DTMF   0x80

Definition at line 66 of file adsi.h.

#define ADSI_EXTENDED_DTMF   0x8F

Definition at line 81 of file adsi.h.

#define ADSI_FLASH   0x83

Definition at line 69 of file adsi.h.

#define ADSI_GOTO_LINE   0x8B

Definition at line 77 of file adsi.h.

#define ADSI_GOTO_LINE_REL   0x8C

Definition at line 78 of file adsi.h.

#define ADSI_INFO_PAGE   0x0

Definition at line 103 of file adsi.h.

Referenced by ast_adsi_channel_restore(), and ast_adsi_print().

#define ADSI_INFORMATION   132

Definition at line 37 of file adsi.h.

#define ADSI_INIT_SOFTKEY_LINE   129

Definition at line 34 of file adsi.h.

Referenced by ast_adsi_set_keys().

#define ADSI_INPUT_CONTROL   137

Definition at line 42 of file adsi.h.

Referenced by ast_adsi_input_control().

#define ADSI_INPUT_FORMAT   138

Definition at line 43 of file adsi.h.

Referenced by ast_adsi_input_format().

#define ADSI_JUST_CENT   0x0

Definition at line 111 of file adsi.h.

Referenced by adsi_announce_park(), adsi_folders(), adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_logo(), cpeid_setstatus(), init_state(), str2align(), vm_newuser(), vm_options(), and vm_tempgreeting().

#define ADSI_JUST_IND   0x3

Definition at line 112 of file adsi.h.

Referenced by str2align().

#define ADSI_JUST_LEFT   0x2

Definition at line 109 of file adsi.h.

Referenced by adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_password(), adsi_status(), adsi_status2(), cpeid_setstatus(), and str2align().

#define ADSI_JUST_RIGHT   0x1

Definition at line 110 of file adsi.h.

Referenced by str2align().

#define ADSI_KEY_APPS   16

Definition at line 106 of file adsi.h.

Referenced by adsi_delete(), adsi_folders(), adsi_load_vmail(), adsi_login(), adsi_message(), adsi_password(), adsi_status(), and adsi_status2().

#define ADSI_KEY_HILITE   0x40

Definition at line 115 of file adsi.h.

#define ADSI_KEY_SKT   0x80

Definition at line 114 of file adsi.h.

Referenced by adsi_delete(), adsi_folders(), adsi_message(), adsi_status(), and adsi_status2().

#define ADSI_LINE_CONTROL   131

Definition at line 36 of file adsi.h.

Referenced by ast_adsi_set_line().

#define ADSI_LINE_NUMBER   0x85

Definition at line 71 of file adsi.h.

#define ADSI_LOAD_DEFAULT   141

Definition at line 46 of file adsi.h.

#define ADSI_LOAD_PREDEF_DISP   129

Definition at line 60 of file adsi.h.

#define ADSI_LOAD_SCRIPT   130

Definition at line 61 of file adsi.h.

#define ADSI_LOAD_SOFTKEY   128

Definition at line 33 of file adsi.h.

Referenced by ast_adsi_load_soft_key().

#define ADSI_LOAD_SOFTKEY_TABLE   128

Definition at line 59 of file adsi.h.

#define ADSI_LOAD_VIRTUAL_DISP   130

Definition at line 35 of file adsi.h.

Referenced by ast_adsi_display().

#define ADSI_MOVE_DATA   140

Definition at line 45 of file adsi.h.

#define ADSI_MSG_DISPLAY   132

Definition at line 29 of file adsi.h.

Referenced by adsi_folders(), adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_password(), adsi_status(), adsi_status2(), ast_adsi_channel_restore(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_load_session(), ast_adsi_print(), ast_adsi_unload_session(), vm_newuser(), vm_options(), and vm_tempgreeting().

#define ADSI_MSG_DOWNLOAD   133

Definition at line 30 of file adsi.h.

Referenced by adsi_load_vmail(), adsi_prog(), ast_adsi_begin_download(), and ast_adsi_end_download().

#define ADSI_OFF_HOOK   0x82

Definition at line 68 of file adsi.h.

#define ADSI_ON_HOOK   0x81

Definition at line 67 of file adsi.h.

#define ADSI_PAGE_DOWN   0x8E

Definition at line 80 of file adsi.h.

#define ADSI_PAGE_UP   0x8D

Definition at line 79 of file adsi.h.

#define ADSI_QUERY_CONFIG   149

Definition at line 54 of file adsi.h.

Referenced by ast_adsi_query_cpeinfo().

#define ADSI_QUERY_CPEID   150

Definition at line 55 of file adsi.h.

Referenced by ast_adsi_query_cpeid().

#define ADSI_SEND_CHARS   0x87

Definition at line 73 of file adsi.h.

#define ADSI_SWITCH_TO_ALT   146

Definition at line 51 of file adsi.h.

#define ADSI_SWITCH_TO_APP   151

Definition at line 56 of file adsi.h.

#define ADSI_SWITCH_TO_DATA   134

Definition at line 39 of file adsi.h.

Referenced by ast_adsi_data_mode(), and ast_adsi_transmit_message_full().

#define ADSI_SWITCH_TO_DATA2   0x92

Definition at line 84 of file adsi.h.

Referenced by ast_adsi_load_soft_key().

#define ADSI_SWITCH_TO_GRAPHICS   147

Definition at line 52 of file adsi.h.

#define ADSI_SWITCH_TO_PERIPH   139

Definition at line 44 of file adsi.h.

#define ADSI_SWITCH_TO_VOICE   135

Definition at line 40 of file adsi.h.

Referenced by ast_adsi_transmit_message_full(), and ast_adsi_voice_mode().

#define ADSI_SWITCH_TO_VOICE2   0x93

Definition at line 85 of file adsi.h.

#define ADSI_TAB_COLUMN   0x8A

Definition at line 76 of file adsi.h.


Function Documentation

int ast_adsi_available ( struct ast_channel chan  ) 

Parameters:
chan Channel to check

Definition at line 771 of file res_adsi.c.

References ast_channel::adsicpe, AST_ADSI_AVAILABLE, and AST_ADSI_UNKNOWN.

Referenced by adsi_begin(), adsi_delete(), adsi_exec(), adsi_folders(), adsi_goodbye(), adsi_login(), adsi_message(), adsi_password(), adsi_status(), adsi_status2(), park_call_full(), vm_newuser(), vm_options(), and vm_tempgreeting().

00772 {
00773    int cpe = chan->adsicpe & 0xff;
00774    if ((cpe == AST_ADSI_AVAILABLE) ||
00775        (cpe == AST_ADSI_UNKNOWN))
00776       return 1;
00777    return 0;
00778 }

int ast_adsi_begin_download ( struct ast_channel chan,
char *  service,
unsigned char *  fdn,
unsigned char *  sec,
int  version 
)

Definition at line 328 of file res_adsi.c.

References ADSI_MSG_DOWNLOAD, ast_adsi_download_connect(), ast_adsi_transmit_message_full(), ast_log(), ast_readstring(), and LOG_DEBUG.

Referenced by adsi_load_vmail(), and adsi_prog().

00329 {
00330    int bytes;
00331    unsigned char buf[256];
00332    char ack[2];
00333    bytes = 0;
00334    /* Setup the resident soft key stuff, a piece at a time */
00335    /* Upload what scripts we can for voicemail ahead of time */
00336    bytes += ast_adsi_download_connect(buf + bytes, service, fdn, sec, version);
00337    if (ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DOWNLOAD, 0))
00338       return -1;
00339    if (ast_readstring(chan, ack, 1, 10000, 10000, ""))
00340       return -1;
00341    if (ack[0] == 'B')
00342       return 0;
00343    ast_log(LOG_DEBUG, "Download was denied by CPE\n");
00344    return -1;
00345 }

int ast_adsi_channel_init ( struct ast_channel chan  ) 

Parameters:
chan Channel to initialize for ADSI (if supported)
Returns 0 on success (or adsi unavailable) and -1 on hangup

int ast_adsi_channel_restore ( struct ast_channel chan  ) 

Parameters:
chan Channel to restore
Returns 0 on success (or adsi unavailable) and -1 on hangup

Definition at line 929 of file res_adsi.c.

References ADSI_INFO_PAGE, ADSI_MSG_DISPLAY, ADSI_SPEED_DIAL, ast_adsi_set_keys(), ast_adsi_set_line(), and ast_adsi_transmit_message_full().

00930 {
00931    unsigned char dsp[256];
00932    int bytes;
00933    int x;
00934    unsigned char keyd[6];
00935 
00936    memset(dsp, 0, sizeof(dsp));
00937 
00938    /* Start with initial display setup */
00939    bytes = 0;
00940    bytes += ast_adsi_set_line(dsp + bytes, ADSI_INFO_PAGE, 1);
00941 
00942    /* Prepare key setup messages */
00943 
00944    if (speeds) {
00945       memset(keyd, 0, sizeof(keyd));
00946       for (x=0;x<speeds;x++) {
00947          keyd[x] = ADSI_SPEED_DIAL + x;
00948       }
00949       bytes += ast_adsi_set_keys(dsp + bytes, keyd);
00950    }
00951    ast_adsi_transmit_message_full(chan, dsp, bytes, ADSI_MSG_DISPLAY, 0);
00952    return 0;
00953 
00954 }

int ast_adsi_clear_screen ( unsigned char *  buf  ) 

Definition at line 739 of file res_adsi.c.

References ADSI_CLEAR_SCREEN.

00740 {
00741    int bytes=0;
00742 
00743    /* Message type */
00744    buf[bytes++] = ADSI_CLEAR_SCREEN;
00745 
00746    /* Reserve space for length */
00747    bytes++;
00748 
00749    buf[1] = bytes - 2;
00750    return bytes;
00751 
00752 }

int ast_adsi_clear_soft_keys ( unsigned char *  buf  ) 

Definition at line 724 of file res_adsi.c.

References ADSI_CLEAR_SOFTKEY.

00725 {
00726    int bytes=0;
00727 
00728    /* Message type */
00729    buf[bytes++] = ADSI_CLEAR_SOFTKEY;
00730 
00731    /* Reserve space for length */
00732    bytes++;
00733 
00734    buf[1] = bytes - 2;
00735    return bytes;
00736 
00737 }

int ast_adsi_connect_session ( unsigned char *  buf,
unsigned char *  fdn,
int  ver 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
fdn Optional 4 byte Feature Download Number (for loading soft keys)
ver Optional version number (0-255, or -1 to omit)
Returns number of bytes added to buffer or -1 on error.

Definition at line 489 of file res_adsi.c.

References ADSI_CONNECT_SESSION.

Referenced by ast_adsi_load_session().

00490 {
00491    int bytes=0;
00492    int x;
00493 
00494    /* Message type */
00495    buf[bytes++] = ADSI_CONNECT_SESSION;
00496 
00497    /* Reserve space for length */
00498    bytes++;
00499 
00500    if (fdn) {
00501       for (x=0;x<4;x++)
00502          buf[bytes++] = fdn[x];
00503       if (ver > -1)
00504          buf[bytes++] = ver & 0xff;
00505    }
00506 
00507    buf[1] = bytes - 2;
00508    return bytes;
00509 
00510 }

int ast_adsi_data_mode ( unsigned char *  buf  ) 

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
Returns number of bytes added to buffer or -1 on error.

Definition at line 709 of file res_adsi.c.

References ADSI_SWITCH_TO_DATA.

Referenced by adsi_load_vmail(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), and ast_adsi_load_session().

00710 {
00711    int bytes=0;
00712 
00713    /* Message type */
00714    buf[bytes++] = ADSI_SWITCH_TO_DATA;
00715 
00716    /* Reserve space for length */
00717    bytes++;
00718 
00719    buf[1] = bytes - 2;
00720    return bytes;
00721 
00722 }

int ast_adsi_disconnect_session ( unsigned char *  buf  ) 

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
Returns number of bytes added to buffer or -1 on error.

Definition at line 542 of file res_adsi.c.

References ADSI_DISC_SESSION.

Referenced by ast_adsi_unload_session().

00543 {
00544    int bytes=0;
00545 
00546    /* Message type */
00547    buf[bytes++] = ADSI_DISC_SESSION;
00548 
00549    /* Reserve space for length */
00550    bytes++;
00551 
00552    buf[1] = bytes - 2;
00553    return bytes;
00554 
00555 }

int ast_adsi_display ( unsigned char *  buf,
int  page,
int  line,
int  just,
int  wrap,
char *  col1,
char *  col2 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
page Page to load (ADSI_COMM_PAGE or ADSI_INFO_PAGE)
line Line number to load (1-4 for Comm page, 1-33 for info page)
just Line justification (ADSI_JUST_LEFT, ADSI_JUST_RIGHT, ADSI_JUST_CENT, ADSI_JUST_IND)
wrap Wrap (1 = yes, 0 = no)
col1 Text to place in first column
col2 Text to place in second column
Returns number of bytes added to buffer or -1 on error.

Definition at line 795 of file res_adsi.c.

References ADSI_LOAD_VIRTUAL_DISP, and ccopy().

Referenced by adsi_folders(), adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_logo(), adsi_status(), adsi_status2(), ast_adsi_print(), vm_newuser(), vm_options(), and vm_tempgreeting().

00797 {
00798    int bytes=0;
00799 
00800    /* Sanity check line number */
00801 
00802    if (page) {
00803       if (line > 4) return -1;
00804    } else {
00805       if (line > 33) return -1;
00806    }
00807 
00808    if (line < 1)
00809       return -1;
00810    /* Parameter type */
00811    buf[bytes++] = ADSI_LOAD_VIRTUAL_DISP;
00812    
00813    /* Reserve space for size */
00814    bytes++;
00815 
00816    /* Page and wrap indicator */
00817    buf[bytes++] = ((page & 0x1) << 7) | ((wrap & 0x1) << 6) | (line & 0x3f);
00818 
00819    /* Justification */
00820    buf[bytes++] = (just & 0x3) << 5;
00821 
00822    /* Omit highlight mode definition */
00823    buf[bytes++] = 0xff;
00824 
00825    /* Primary column */
00826    bytes+= ccopy(buf + bytes, (unsigned char *)col1, 20);
00827 
00828    /* Delimiter */
00829    buf[bytes++] = 0xff;
00830    
00831    /* Secondary column */
00832    bytes += ccopy(buf + bytes, (unsigned char *)col2, 20);
00833 
00834    /* Update length */
00835    buf[1] = bytes - 2;
00836    
00837    return bytes;
00838 
00839 }

int ast_adsi_download_connect ( unsigned char *  buf,
char *  service,
unsigned char *  fdn,
unsigned char *  sec,
int  ver 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
service a 1-18 byte name of the feature
fdn 4 byte Feature Download Number (for loading soft keys)
sec 4 byte vendor security code
ver version number (0-255, or -1 to omit)
Returns number of bytes added to buffer or -1 on error.

Definition at line 512 of file res_adsi.c.

References ADSI_DOWNLOAD_CONNECT, and ccopy().

Referenced by ast_adsi_begin_download().

00513 {
00514    int bytes=0;
00515    int x;
00516 
00517    /* Message type */
00518    buf[bytes++] = ADSI_DOWNLOAD_CONNECT;
00519 
00520    /* Reserve space for length */
00521    bytes++;
00522 
00523    /* Primary column */
00524    bytes+= ccopy(buf + bytes, (unsigned char *)service, 18);
00525 
00526    /* Delimiter */
00527    buf[bytes++] = 0xff;
00528    
00529    for (x=0;x<4;x++) {
00530       buf[bytes++] = fdn[x];
00531    }
00532    for (x=0;x<4;x++)
00533       buf[bytes++] = sec[x];
00534    buf[bytes++] = ver & 0xff;
00535 
00536    buf[1] = bytes - 2;
00537 
00538    return bytes;
00539 
00540 }

int ast_adsi_download_disconnect ( unsigned char *  buf  ) 

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
Returns number of bytes added to buffer or -1 on error.

Definition at line 780 of file res_adsi.c.

References ADSI_DOWNLOAD_DISC.

Referenced by adsi_load_vmail(), and ast_adsi_end_download().

00781 {
00782    int bytes=0;
00783 
00784    /* Message type */
00785    buf[bytes++] = ADSI_DOWNLOAD_DISC;
00786 
00787    /* Reserve space for length */
00788    bytes++;
00789 
00790    buf[1] = bytes - 2;
00791    return bytes;
00792 
00793 }

int ast_adsi_end_download ( struct ast_channel chan  ) 

Definition at line 347 of file res_adsi.c.

References ADSI_MSG_DOWNLOAD, ast_adsi_download_disconnect(), and ast_adsi_transmit_message_full().

Referenced by adsi_load_vmail().

00348 {
00349    int bytes;
00350    unsigned char buf[256];
00351         bytes = 0;
00352         /* Setup the resident soft key stuff, a piece at a time */
00353         /* Upload what scripts we can for voicemail ahead of time */
00354         bytes += ast_adsi_download_disconnect(buf + bytes);
00355    if (ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DOWNLOAD, 0))
00356       return -1;
00357    return 0;
00358 }

int ast_adsi_get_cpeid ( struct ast_channel chan,
unsigned char *  cpeid,
int  voice 
)

Returns 1 on success, storing 4 bytes of CPE ID at buf or -1 on hangup, or 0 if there was no hangup but it failed to find the device ID. Returns to voice mode if "voice" is non-zero.

Definition at line 612 of file res_adsi.c.

References ADSI_MSG_DISPLAY, ast_adsi_data_mode(), ast_adsi_query_cpeid(), ast_adsi_read_encoded_dtmf(), ast_adsi_transmit_message_full(), ast_adsi_voice_mode(), ast_log(), ast_waitfordigit(), and LOG_WARNING.

Referenced by cpeid_exec().

00613 {
00614    unsigned char buf[256];
00615    int bytes = 0;
00616    int res;
00617    bytes += ast_adsi_data_mode(buf);
00618    ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
00619 
00620    bytes = 0;
00621    bytes += ast_adsi_query_cpeid(buf);
00622    ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
00623 
00624    /* Get response */
00625    memset(buf, 0, sizeof(buf));
00626    res = ast_adsi_read_encoded_dtmf(chan, cpeid, 4);
00627    if (res != 4) {
00628       ast_log(LOG_WARNING, "Got %d bytes back of encoded DTMF, expecting 4\n", res);
00629       res = 0;
00630    } else {
00631       res = 1;
00632    }
00633 
00634    if (voice) {
00635       bytes = 0;
00636       bytes += ast_adsi_voice_mode(buf, 0);
00637       ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
00638       /* Ignore the resulting DTMF B announcing it's in voice mode */
00639       ast_waitfordigit(chan, 1000);
00640    }
00641    return res;
00642 }

int ast_adsi_get_cpeinfo ( struct ast_channel chan,
int *  width,
int *  height,
int *  buttons,
int  voice 
)

Definition at line 644 of file res_adsi.c.

References ADSI_MSG_DISPLAY, ast_adsi_data_mode(), ast_adsi_query_cpeinfo(), ast_adsi_transmit_message_full(), ast_adsi_voice_mode(), ast_log(), ast_readstring(), ast_waitfordigit(), and LOG_WARNING.

Referenced by cpeid_exec().

00645 {
00646    unsigned char buf[256];
00647    int bytes = 0;
00648    int res;
00649    bytes += ast_adsi_data_mode(buf);
00650    ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
00651 
00652    bytes = 0;
00653    bytes += ast_adsi_query_cpeinfo(buf);
00654    ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
00655 
00656    /* Get width */
00657    memset(buf, 0, sizeof(buf));
00658    res = ast_readstring(chan, (char *)buf, 2, 1000, 500, "");
00659    if (res < 0)
00660       return res;
00661    if (strlen((char *)buf) != 2) {
00662       ast_log(LOG_WARNING, "Got %d bytes of width, expecting 2\n", res);
00663       res = 0;
00664    } else {
00665       res = 1;
00666    }
00667    if (width)
00668       *width = atoi((char *)buf);
00669    /* Get height */
00670    memset(buf, 0, sizeof(buf));
00671    if (res) {
00672       res = ast_readstring(chan, (char *)buf, 2, 1000, 500, "");
00673       if (res < 0)
00674          return res;
00675       if (strlen((char *)buf) != 2) {
00676          ast_log(LOG_WARNING, "Got %d bytes of height, expecting 2\n", res);
00677          res = 0;
00678       } else {
00679          res = 1;
00680       }  
00681       if (height)
00682          *height= atoi((char *)buf);
00683    }
00684    /* Get buttons */
00685    memset(buf, 0, sizeof(buf));
00686    if (res) {
00687       res = ast_readstring(chan, (char *)buf, 1, 1000, 500, "");
00688       if (res < 0)
00689          return res;
00690       if (strlen((char *)buf) != 1) {
00691          ast_log(LOG_WARNING, "Got %d bytes of buttons, expecting 1\n", res);
00692          res = 0;
00693       } else {
00694          res = 1;
00695       }  
00696       if (buttons)
00697          *buttons = atoi((char *)buf);
00698    }
00699    if (voice) {
00700       bytes = 0;
00701       bytes += ast_adsi_voice_mode(buf, 0);
00702       ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
00703       /* Ignore the resulting DTMF B announcing it's in voice mode */
00704       ast_waitfordigit(chan, 1000);
00705    }
00706    return res;
00707 }

int ast_adsi_input_control ( unsigned char *  buf,
int  page,
int  line,
int  display,
int  format,
int  just 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
page Which page to input on (ADSI_COMM_PAGE or ADSI_INFO_PAGE)
line Line number to input on
display Set to zero to obscure input, or 1 to leave visible
format Format number to use (0-7)
just Justification (left, right center, indent)
Returns number of bytes added to buffer or -1 on error.

Definition at line 841 of file res_adsi.c.

References ADSI_INPUT_CONTROL.

Referenced by adsi_login(), and adsi_password().

00842 {
00843    int bytes=0;
00844 
00845    if (page) {
00846       if (line > 4) return -1;
00847    } else {
00848       if (line > 33) return -1;
00849    }
00850 
00851    if (line < 1)
00852       return -1;
00853 
00854    buf[bytes++] = ADSI_INPUT_CONTROL;
00855    bytes++;
00856    buf[bytes++] = ((page & 1) << 7) | (line & 0x3f);
00857    buf[bytes++] = ((display & 1) << 7) | ((just & 0x3) << 4) | (format & 0x7);
00858    
00859    buf[1] = bytes - 2;
00860    return bytes;
00861 
00862 }

int ast_adsi_input_format ( unsigned char *  buf,
int  num,
int  dir,
int  wrap,
char *  format1,
char *  format2 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
num Which format we are setting
dir Which direction (ADSI_DIR_FROM_LEFT or ADSI_DIR_FROM_RIGHT)
wrap Set to 1 to permit line wrap, or 0 if not
format1 Format for column 1
format2 Format for column 2
Returns number of bytes added to buffer or -1 on error.

Definition at line 864 of file res_adsi.c.

References ADSI_INPUT_FORMAT, and ccopy().

Referenced by adsi_login(), and adsi_password().

00865 {
00866    int bytes = 0;
00867 
00868    if (!strlen((char *)format1))
00869       return -1;
00870 
00871    buf[bytes++] = ADSI_INPUT_FORMAT;
00872    bytes++;
00873    buf[bytes++] = ((dir & 1) << 7) | ((wrap & 1) << 6) | (num & 0x7);
00874    bytes += ccopy(buf + bytes, (unsigned char *)format1, 20);
00875    buf[bytes++] = 0xff;
00876    if (format2 && strlen((char *)format2)) {
00877       bytes += ccopy(buf + bytes, (unsigned char *)format2, 20);
00878    }
00879    buf[1] = bytes - 2;
00880    return bytes;
00881 }

int ast_adsi_load_session ( struct ast_channel chan,
unsigned char *  app,
int  ver,
int  data 
)

Parameters:
chan Channel to test for loaded app
app Four character app name (must be unique to your application)
ver optional version number
data Non-zero if you want to be put in data mode
Returns 0 if scripts is not loaded or not an ADSI CPE. Returns -1 on hangup. Returns 1 if script already loaded.

Definition at line 976 of file res_adsi.c.

References ADSI_MSG_DISPLAY, ast_adsi_connect_session(), ast_adsi_data_mode(), ast_adsi_transmit_message_full(), ast_log(), ast_readstring(), LOG_DEBUG, and LOG_WARNING.

Referenced by adsi_announce_park(), adsi_begin(), adsi_load_vmail(), adsi_prog(), and cpeid_exec().

00977 {
00978    unsigned char dsp[256];
00979    int bytes;
00980    int res;
00981    char resp[2];
00982 
00983    memset(dsp, 0, sizeof(dsp));
00984 
00985    /* Connect to session */
00986    bytes = 0;
00987    bytes += ast_adsi_connect_session(dsp + bytes, app, ver);
00988 
00989    if (data)
00990       bytes += ast_adsi_data_mode(dsp + bytes);
00991 
00992    /* Prepare key setup messages */
00993    if (ast_adsi_transmit_message_full(chan, dsp, bytes, ADSI_MSG_DISPLAY, 0))
00994       return -1;
00995    if (app) {
00996       res = ast_readstring(chan, resp, 1, 1200, 1200, "");
00997       if (res < 0)
00998          return -1;
00999       if (res) {
01000          ast_log(LOG_DEBUG, "No response from CPE about version.  Assuming not there.\n");
01001          return 0;
01002       }
01003       if (!strcmp(resp, "B")) {
01004          ast_log(LOG_DEBUG, "CPE has script '%s' version %d already loaded\n", app, ver);
01005          return 1;
01006       } else if (!strcmp(resp, "A")) {
01007          ast_log(LOG_DEBUG, "CPE hasn't script '%s' version %d already loaded\n", app, ver);
01008       } else {
01009          ast_log(LOG_WARNING, "Unexpected CPE response to script query: %s\n", resp);
01010       }
01011    } else
01012       return 1;
01013    return 0;
01014 
01015 }

int ast_adsi_load_soft_key ( unsigned char *  buf,
int  key,
const char *  llabel,
const char *  slabel,
const char *  ret,
int  data 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
key Key code from 2 to 33, for which key we are loading
llabel Long label for key (1-18 bytes)
slabel Short label for key (1-7 bytes)
ret Optional return sequence (NULL for none)
data whether to put CPE in data mode before sending digits
Returns number of bytes added to buffer or -1 on error.

Definition at line 450 of file res_adsi.c.

References ADSI_LOAD_SOFTKEY, ADSI_SWITCH_TO_DATA2, and ccopy().

Referenced by adsi_load_vmail(), and adsi_login().

00451 {
00452    int bytes=0;
00453 
00454    /* Abort if invalid key specified */
00455    if ((key < 2) || (key > 33))
00456       return -1;
00457    buf[bytes++] = ADSI_LOAD_SOFTKEY;
00458    /* Reserve for length */
00459    bytes++;
00460    /* Which key */
00461    buf[bytes++] = key;
00462 
00463    /* Carefully copy long label */
00464    bytes += ccopy(buf + bytes, (const unsigned char *)llabel, 18);
00465 
00466    /* Place delimiter */
00467    buf[bytes++] = 0xff;
00468 
00469    /* Short label */
00470    bytes += ccopy(buf + bytes, (const unsigned char *)slabel, 7);
00471 
00472 
00473    /* If specified, copy return string */
00474    if (ret) {
00475       /* Place delimiter */
00476       buf[bytes++] = 0xff;
00477       if (data)
00478          buf[bytes++] = ADSI_SWITCH_TO_DATA2;
00479       /* Carefully copy return string */
00480       bytes += ccopy(buf + bytes, (const unsigned char *)ret, 20);
00481 
00482    }
00483    /* Replace parameter length */
00484    buf[1] = bytes - 2;
00485    return bytes;
00486    
00487 }

int ast_adsi_print ( struct ast_channel chan,
char **  lines,
int *  align,
int  voice 
)

Parameters:
chan Channel to display on
lines NULL-terminated list of things to print (no more than 4 recommended)
align list of alignments to use (ADSI_JUST_LEFT, ADSI_JUST_RIGHT, ADSI_JUST_CEN, etc..)
voice whether to jump into voice mode when finished
Return 0 on success (or adsi unavailable) and -1 on hangup

Definition at line 956 of file res_adsi.c.

References ADSI_INFO_PAGE, ADSI_MSG_DISPLAY, ast_adsi_display(), ast_adsi_set_line(), ast_adsi_transmit_message_full(), ast_adsi_voice_mode(), and ast_waitfordigit().

Referenced by adsi_announce_park(), and cpeid_setstatus().

00957 {
00958    unsigned char buf[4096];
00959    int bytes=0;
00960    int res;
00961    int x;
00962    for(x=0;lines[x];x++) 
00963       bytes += ast_adsi_display(buf + bytes, ADSI_INFO_PAGE, x+1, aligns[x], 0, lines[x], "");
00964    bytes += ast_adsi_set_line(buf + bytes, ADSI_INFO_PAGE, 1);
00965    if (voice) {
00966       bytes += ast_adsi_voice_mode(buf + bytes, 0);
00967    }
00968    res = ast_adsi_transmit_message_full(chan, buf, bytes, ADSI_MSG_DISPLAY, 0);
00969    if (voice) {
00970       /* Ignore the resulting DTMF B announcing it's in voice mode */
00971       ast_waitfordigit(chan, 1000);
00972    }
00973    return res;
00974 }

int ast_adsi_query_cpeid ( unsigned char *  buf  ) 

Returns number of bytes added to message

Definition at line 557 of file res_adsi.c.

References ADSI_QUERY_CPEID.

Referenced by ast_adsi_get_cpeid().

00558 {
00559    int bytes = 0;
00560    buf[bytes++] = ADSI_QUERY_CPEID;
00561    /* Reserve space for length */
00562    bytes++;
00563    buf[1] = bytes - 2;
00564    return bytes;
00565 }

int ast_adsi_query_cpeinfo ( unsigned char *  buf  ) 

Definition at line 567 of file res_adsi.c.

References ADSI_QUERY_CONFIG.

Referenced by ast_adsi_get_cpeinfo().

00568 {
00569    int bytes = 0;
00570    buf[bytes++] = ADSI_QUERY_CONFIG;
00571    /* Reserve space for length */
00572    bytes++;
00573    buf[1] = bytes - 2;
00574    return bytes;
00575 }

int ast_adsi_read_encoded_dtmf ( struct ast_channel chan,
unsigned char *  buf,
int  maxlen 
)

Returns number of bytes received

Definition at line 577 of file res_adsi.c.

References ast_waitfordigit().

Referenced by ast_adsi_get_cpeid().

00578 {
00579    int bytes = 0;
00580    int res;
00581    unsigned char current = 0;
00582    int gotstar = 0;
00583    int pos = 0;
00584    memset(buf, 0, sizeof(buf));
00585    while(bytes <= maxlen) {
00586       /* Wait up to a second for a digit */
00587       res = ast_waitfordigit(chan, 1000);
00588       if (!res)
00589          break;
00590       if (res == '*') {
00591          gotstar = 1;   
00592          continue;
00593       }
00594       /* Ignore anything other than a digit */
00595       if ((res < '0') || (res > '9'))
00596          continue;
00597       res -= '0';
00598       if (gotstar)
00599          res += 9;
00600       if (pos)  {
00601          pos = 0;
00602          buf[bytes++] = (res << 4) | current;
00603       } else {
00604          pos = 1;
00605          current = res;
00606       }
00607       gotstar = 0;
00608    }
00609    return bytes;
00610 }

int ast_adsi_set_keys ( unsigned char *  buf,
unsigned char *  keys 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
keys Array of 8 unsigned chars with the key numbers, may be OR'd with ADSI_KEY_HILITE But remember, the last two keys aren't real keys, they're for scrolling
Returns number of bytes added to buffer or -1 on error.

Definition at line 883 of file res_adsi.c.

References ADSI_INIT_SOFTKEY_LINE.

Referenced by adsi_folders(), adsi_login(), adsi_password(), adsi_status(), adsi_status2(), and ast_adsi_channel_restore().

00884 {
00885    int bytes=0;
00886    int x;
00887    /* Message type */
00888    buf[bytes++] = ADSI_INIT_SOFTKEY_LINE;
00889    /* Space for size */
00890    bytes++;
00891    /* Key definitions */
00892    for (x=0;x<6;x++)
00893       buf[bytes++] = (keys[x] & 0x3f) ? keys[x] : (keys[x] | 0x1);
00894    buf[1] = bytes - 2;
00895    return bytes;
00896 }

int ast_adsi_set_line ( unsigned char *  buf,
int  page,
int  line 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
page Which page (ADSI_COMM_PAGE or ADSI_INFO_PAGE)
line Line number (1-33 for info page, 1-4 for comm page)
Returns number of bytes added to buffer or -1 on error.

Definition at line 898 of file res_adsi.c.

References ADSI_LINE_CONTROL.

Referenced by adsi_folders(), adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_password(), adsi_status(), adsi_status2(), ast_adsi_channel_restore(), ast_adsi_print(), vm_newuser(), vm_options(), and vm_tempgreeting().

00899 {
00900    int bytes=0;
00901 
00902    /* Sanity check line number */
00903 
00904    if (page) {
00905       if (line > 4) return -1;
00906    } else {
00907       if (line > 33) return -1;
00908    }
00909 
00910    if (line < 1)
00911       return -1;
00912    /* Parameter type */
00913    buf[bytes++] = ADSI_LINE_CONTROL;
00914    
00915    /* Reserve space for size */
00916    bytes++;
00917 
00918    /* Page and line */
00919    buf[bytes++] = ((page & 0x1) << 7) | (line & 0x3f);
00920 
00921    buf[1] = bytes - 2;
00922    return bytes;
00923 
00924 };

int ast_adsi_transmit_message ( struct ast_channel chan,
unsigned char *  msg,
int  msglen,
int  msgtype 
)

Definition at line 434 of file res_adsi.c.

References ast_adsi_transmit_message_full().

Referenced by adsi_folders(), adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_password(), adsi_prog(), adsi_status(), adsi_status2(), vm_newuser(), vm_options(), and vm_tempgreeting().

00435 {
00436    return ast_adsi_transmit_message_full(chan, msg, msglen, msgtype, 1);
00437 }

int ast_adsi_transmit_message_full ( struct ast_channel chan,
unsigned char *  msg,
int  msglen,
int  msgtype,
int  dowait 
)

Definition at line 360 of file res_adsi.c.

References __adsi_transmit_messages(), ADSI_FLAG_DATAMODE, ADSI_SWITCH_TO_DATA, ADSI_SWITCH_TO_VOICE, ast_channel::adsicpe, AST_FORMAT_ULAW, ast_log(), ast_safe_sleep(), ast_set_read_format(), ast_set_write_format(), ast_stopstream(), ast_waitfordigit(), LOG_DEBUG, LOG_WARNING, ast_channel::readformat, and ast_channel::writeformat.

Referenced by ast_adsi_begin_download(), ast_adsi_channel_restore(), ast_adsi_end_download(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_load_session(), ast_adsi_print(), ast_adsi_transmit_message(), and ast_adsi_unload_session().

00361 {
00362    unsigned char *msgs[5] = { NULL, NULL, NULL, NULL, NULL };
00363    int msglens[5];
00364    int msgtypes[5];
00365    int newdatamode;
00366    int res;
00367    int x;
00368    int writeformat, readformat;
00369    int waitforswitch = 0;
00370 
00371    writeformat = chan->writeformat;
00372    readformat = chan->readformat;
00373 
00374    newdatamode = chan->adsicpe & ADSI_FLAG_DATAMODE;
00375 
00376    for (x=0;x<msglen;x+=(msg[x+1]+2)) {
00377       if (msg[x] == ADSI_SWITCH_TO_DATA) {
00378          ast_log(LOG_DEBUG, "Switch to data is sent!\n");
00379          waitforswitch++;
00380          newdatamode = ADSI_FLAG_DATAMODE;
00381       }
00382       
00383       if (msg[x] == ADSI_SWITCH_TO_VOICE) {
00384          ast_log(LOG_DEBUG, "Switch to voice is sent!\n");
00385          waitforswitch++;
00386          newdatamode = 0;
00387       }
00388    }
00389    msgs[0] = msg;
00390 
00391    msglens[0] = msglen;
00392    msgtypes[0] = msgtype;
00393 
00394    if (msglen > 253) {
00395       ast_log(LOG_WARNING, "Can't send ADSI message of %d bytes, too large\n", msglen);
00396       return -1;
00397    }
00398 
00399    ast_stopstream(chan);
00400 
00401    if (ast_set_write_format(chan, AST_FORMAT_ULAW)) {
00402       ast_log(LOG_WARNING, "Unable to set write format to ULAW\n");
00403       return -1;
00404    }
00405 
00406    if (ast_set_read_format(chan, AST_FORMAT_ULAW)) {
00407       ast_log(LOG_WARNING, "Unable to set read format to ULAW\n");
00408       if (writeformat) {
00409          if (ast_set_write_format(chan, writeformat)) 
00410             ast_log(LOG_WARNING, "Unable to restore write format to %d\n", writeformat);
00411       }
00412       return -1;
00413    }
00414    res = __adsi_transmit_messages(chan, msgs, msglens, msgtypes);
00415 
00416    if (dowait) {
00417       ast_log(LOG_DEBUG, "Wait for switch is '%d'\n", waitforswitch);
00418       while(waitforswitch-- && ((res = ast_waitfordigit(chan, 1000)) > 0)) { res = 0; ast_log(LOG_DEBUG, "Waiting for 'B'...\n"); }
00419    }
00420    
00421    if (!res)
00422       chan->adsicpe = (chan->adsicpe & ~ADSI_FLAG_DATAMODE) | newdatamode;
00423 
00424    if (writeformat)
00425       ast_set_write_format(chan, writeformat);
00426    if (readformat)
00427       ast_set_read_format(chan, readformat);
00428 
00429    if (!res)
00430       res = ast_safe_sleep(chan, 100 );
00431    return res;
00432 }

int ast_adsi_transmit_messages ( struct ast_channel chan,
unsigned char **  msg,
int *  msglen,
int *  msgtype 
)

int ast_adsi_unload_session ( struct ast_channel chan  ) 

Definition at line 1017 of file res_adsi.c.

References ADSI_MSG_DISPLAY, ast_adsi_disconnect_session(), ast_adsi_transmit_message_full(), and ast_adsi_voice_mode().

Referenced by cpeid_exec(), park_call_full(), and vm_execmain().

01018 {
01019    unsigned char dsp[256];
01020    int bytes;
01021 
01022    memset(dsp, 0, sizeof(dsp));
01023 
01024    /* Connect to session */
01025    bytes = 0;
01026    bytes += ast_adsi_disconnect_session(dsp + bytes);
01027    bytes += ast_adsi_voice_mode(dsp + bytes, 0);
01028 
01029    /* Prepare key setup messages */
01030    if (ast_adsi_transmit_message_full(chan, dsp, bytes, ADSI_MSG_DISPLAY, 0))
01031       return -1;
01032    return 0;
01033 }

int ast_adsi_voice_mode ( unsigned char *  buf,
int  when 
)

Parameters:
buf Character buffer to create parameter in (must have at least 256 free)
when (a time in seconds) to make the switch
Returns number of bytes added to buffer or -1 on error.

Definition at line 754 of file res_adsi.c.

References ADSI_SWITCH_TO_VOICE.

Referenced by adsi_folders(), adsi_goodbye(), adsi_load_vmail(), adsi_login(), adsi_password(), adsi_status(), adsi_status2(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_print(), ast_adsi_unload_session(), vm_newuser(), vm_options(), and vm_tempgreeting().

00755 {
00756    int bytes=0;
00757 
00758    /* Message type */
00759    buf[bytes++] = ADSI_SWITCH_TO_VOICE;
00760 
00761    /* Reserve space for length */
00762    bytes++;
00763 
00764    buf[bytes++] = when & 0x7f;
00765 
00766    buf[1] = bytes - 2;
00767    return bytes;
00768 
00769 }


Generated on Sat Aug 6 00:39:33 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7