1 /*****************************************************************************\
3 ** Linux Call Router **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** Asterisk socket client header **
10 \*****************************************************************************/
12 /* structure for all calls */
15 struct chan_call *next; /* link to next call instance */
16 int state; /* current call state CHAN_LCR_STATE */
17 unsigned int ref; /* callref for this channel */
18 void *ast; /* current asterisk channel */
20 /* indicates if pbx que is available */
21 struct bchannel *bchannel;
22 /* reference to bchannel, if set */
24 /* audio is available */
26 /* store cause from lcr */
27 unsigned char dialque[64];
28 /* queue dialing prior setup ack */
29 char oad[64];/* caller id in number format */
30 struct connect_info connectinfo;
31 /* store connectinfo form lcr */
34 struct chan_call *bridge_call;
35 /* remote instance or NULL */
37 /* pipe for receive data */
38 unsigned char read_buff[1024];
39 /* read buffer for frame */
40 struct ast_frame read_fr;
43 /* LCR interface name for setup */
45 /* cached dial string for setup */
47 /* display for setup */
49 /* shall dtmf be enabled */
51 /* dtmf disabled by option */
53 /* echo cancel pipeline by option */
56 unsigned char bf_key[56];
57 int bf_len; /* blowfish crypt key */
58 int transparent, hdlc;
59 /* flags for bchannel mode */
64 CHAN_LCR_STATE_IN_PREPARE = 0,
65 CHAN_LCR_STATE_IN_SETUP,
66 CHAN_LCR_STATE_IN_DIALING,
67 CHAN_LCR_STATE_IN_PROCEEDING,
68 CHAN_LCR_STATE_IN_ALERTING,
69 CHAN_LCR_STATE_OUT_PREPARE,
70 CHAN_LCR_STATE_OUT_SETUP,
71 CHAN_LCR_STATE_OUT_DIALING,
72 CHAN_LCR_STATE_OUT_PROCEEDING,
73 CHAN_LCR_STATE_OUT_ALERTING,
74 CHAN_LCR_STATE_CONNECT,
75 CHAN_LCR_STATE_IN_DISCONNECT,
76 CHAN_LCR_STATE_OUT_DISCONNECT,
77 CHAN_LCR_STATE_RELEASE,
80 #define CHAN_LCR_STATE static const struct chan_lcr_state { \
83 } chan_lcr_state[] = { \
85 "New call from ISDN is waiting for setup." }, \
87 "Call from ISDN is currently set up." }, \
89 "Call from ISDN is currently waiting for digits to be dialed." }, \
91 "Call from ISDN is complete and proceeds to ring." }, \
93 "Call from ISDN is ringing." }, \
95 "New call to ISDN is wating for setup." }, \
97 "Call to ISDN is currently set up." }, \
99 "Call to ISDN is currently waiting for digits to be dialed." }, \
100 { "OUT_PROCEEDING", \
101 "Call to ISDN is complete and proceeds to ring." }, \
103 "Call to ISDN is ringing." }, \
105 "Call has been answered." }, \
107 "Call has been hung up on ISDN side." }, \
108 { "OUT_DISCONNECT", \
109 "Call has been hung up on Asterisk side." }, \
111 "Call is waiting for complete release." }, \
115 #define CERROR(call, ast, arg...) chan_lcr_log(__LOG_ERROR, __FILE__, __LINE__, __FUNCTION__, call, ast, ##arg)
116 #define CDEBUG(call, ast, arg...) chan_lcr_log(__LOG_NOTICE, __FILE__, __LINE__, __FUNCTION__, call, ast, ##arg)
117 void chan_lcr_log(int type, const char *file, int line, const char *function, struct chan_call *call, struct ast_channel *ast, const char *fmt, ...);
118 extern unsigned char flip_bits[256];
119 void lcr_in_dtmf(struct chan_call *call, int val);