Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

vmodem.h

Go to the documentation of this file.
00001 /* 00002 * Asterisk -- A telephony toolkit for Linux. 00003 * 00004 * Voice Modem Definitions 00005 * 00006 * Copyright (C) 1999, Mark Spencer 00007 * 00008 * Mark Spencer <markster@linux-support.net> 00009 * 00010 * This program is free software, distributed under the terms of 00011 * the GNU General Public License 00012 */ 00013 00014 #ifndef _ASTERISK_VMODEM_H 00015 #define _ASTERISK_VMODEM_H 00016 00017 #include <asterisk/frame.h> 00018 #include <asterisk/channel.h> 00019 #include <asterisk/channel_pvt.h> 00020 00021 #define CHAR_DLE 0x10 00022 #define CHAR_ETX 0x03 00023 #define CHAR_DC4 0x14 00024 00025 #define MODEM_DEV_TELCO 0 00026 #define MODEM_DEV_TELCO_SPK 4 00027 #define MODEM_DEV_SPKRPHONE 6 00028 #define MODEM_DEV_HANDSET 9 00029 00030 /* Thirty millisecond sections */ 00031 #define MODEM_MAX_LEN 30 00032 #define MODEM_MAX_BUF MODEM_MAX_LEN * 16 00033 00034 #define AST_MAX_INIT_STR 256 00035 00036 struct ast_modem_pvt; 00037 00038 struct ast_modem_driver { 00039 char *name; 00040 char **idents; 00041 int formats; 00042 int fullduplex; 00043 void (*incusecnt)(void); 00044 void (*decusecnt)(void); 00045 char * (*identify)(struct ast_modem_pvt *); 00046 int (*init)(struct ast_modem_pvt *); 00047 int (*setdev)(struct ast_modem_pvt *, int dev); 00048 struct ast_frame * (*read)(struct ast_modem_pvt *); 00049 int (*write)(struct ast_modem_pvt *, struct ast_frame *fr); 00050 int (*dial)(struct ast_modem_pvt *, char *); 00051 int (*answer)(struct ast_modem_pvt *); 00052 int (*hangup)(struct ast_modem_pvt *); 00053 int (*startrec)(struct ast_modem_pvt *); 00054 int (*stoprec)(struct ast_modem_pvt *); 00055 int (*startpb)(struct ast_modem_pvt *); 00056 int (*stoppb)(struct ast_modem_pvt *); 00057 int (*setsilence)(struct ast_modem_pvt *, int onoff); 00058 int (*dialdigit)(struct ast_modem_pvt *, char digit); 00059 struct ast_modem_driver *next; 00060 }; 00061 00062 #define MODEM_MODE_IMMEDIATE 0 00063 #define MODEM_MODE_WAIT_RING 1 00064 #define MODEM_MODE_WAIT_ANSWER 2 00065 00066 //! Private data that needs to be filled by modem driver 00067 struct ast_modem_pvt { 00068 /*! Raw file descriptor for this device */ 00069 int fd; 00070 /*! FILE * representation of device */ 00071 FILE *f; 00072 /*! Channel we belong to, possibly NULL */ 00073 struct ast_channel *owner; 00074 /* Device name */ 00075 char dev[256]; 00076 /*! Frame */ 00077 struct ast_frame fr; 00078 00079 char offset[AST_FRIENDLY_OFFSET]; 00080 /*! Outgoing buffer */ 00081 char obuf[MODEM_MAX_BUF]; 00082 00083 int tail; 00084 /*! Pulse or tone dialling */ 00085 char dialtype; 00086 /*! Time to wait for dial timeout */ 00087 char dialtimeout; 00088 00089 int obuflen; 00090 /*! Immediate, or wait for an answer */ 00091 int mode; 00092 /*! State of modem in miniature */ 00093 int ministate; 00094 /*! Digits to strip on outgoing numbers */ 00095 int stripmsd; 00096 /*! Is the last thing we saw an escape */ 00097 int escape; 00098 /*! flag to say if has caller*id yet*/ 00099 int gotclid; 00100 /*! ringer timeout */ 00101 int ringt; 00102 /*! actual time of last ring */ 00103 time_t lastring; 00104 /*! dtmf receive state/data */ 00105 char dtmfrx; 00106 00107 char context[AST_MAX_EXTENSION]; 00108 /*! Multiple Subscriber Number */ 00109 char msn[AST_MAX_EXTENSION]; 00110 /*! Multiple Subscriber Number we listen to (; seperated list) */ 00111 char incomingmsn[AST_MAX_EXTENSION]; 00112 /*! Group(s) we belong to if available */ 00113 unsigned int group; 00114 /*! Caller ID if available */ 00115 char cid[AST_MAX_EXTENSION]; 00116 /*! Dialed Number if available */ 00117 char dnid[AST_MAX_EXTENSION]; 00118 /*! Modem initialization String */ 00119 char initstr[AST_MAX_INIT_STR]; 00120 /*! default language */ 00121 char language[MAX_LANGUAGE]; 00122 /*! Static response buffer */ 00123 char response[256]; 00124 /*! Modem Capability */ 00125 struct ast_modem_driver *mc; 00126 /*! Next channel in list */ 00127 struct ast_modem_pvt *next; 00128 }; 00129 00130 00131 //! Register a modem driver 00132 /*! Register a driver */ 00133 extern int ast_register_modem_driver(struct ast_modem_driver *mc); 00134 00135 //! Unregisters a modem driver 00136 /*! Unregister a driver */ 00137 extern int ast_unregister_modem_driver(struct ast_modem_driver *mc); 00138 00139 //! Sends command 00140 /*! Send the command cmd (length len, or 0 if pure ascii) on modem */ 00141 extern int ast_modem_send(struct ast_modem_pvt *p, char *cmd, int len); 00142 00143 //! Waits for result 00144 /*! Wait for result to occur. Return non-zero if times out or error, last 00145 response is stored in p->response */ 00146 extern int ast_modem_expect(struct ast_modem_pvt *p, char *result, int timeout); 00147 00148 //! Waits for result 00149 /*! Wait for result to occur. response is stored in p->response */ 00150 extern int ast_modem_read_response(struct ast_modem_pvt *p, int timeout); 00151 00152 //! Used to start up the PBX on a RING 00153 /*! Used by modem drivers to start up the PBX on a RING */ 00154 extern struct ast_channel *ast_modem_new(struct ast_modem_pvt *i, int state); 00155 00156 //! Trim string of trailing stuff 00157 /*! Trim off trailing mess */ 00158 extern void ast_modem_trim(char *s); 00159 #endif

Generated on Sat Jun 12 16:40:59 2004 for Asterisk by doxygen 1.3.7