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 */
31 struct connect_info connectinfo;
32 /* store connectinfo form lcr */
35 struct chan_call *bridge_call;
36 /* remote instance or NULL */
38 /* pipe for receive data */
39 unsigned char read_buff[1024];
40 /* read buffer for frame */
41 struct ast_frame read_fr;
44 /* LCR interface name for setup */
46 /* cached dial string for setup */
47 char cid_num[64]; /* cached cid for setup */
48 char cid_name[64]; /* cached cid for setup */
49 char cid_rdnis[64]; /* cached cid for setup */
51 /* display for setup */
53 /* shall dtmf be enabled */
55 /* dtmf disabled by option */
56 int rebuffer; /* send only 160 bytes frames
59 /* echo cancel pipeline by option */
62 unsigned char bf_key[56];
63 int bf_len; /* blowfish crypt key */
64 int transparent, hdlc;
65 /* flags for bchannel mode */
66 char queue_string[64];
67 /* queue for asterisk */
72 CHAN_LCR_STATE_IN_PREPARE = 0,
73 CHAN_LCR_STATE_IN_SETUP,
74 CHAN_LCR_STATE_IN_DIALING,
75 CHAN_LCR_STATE_IN_PROCEEDING,
76 CHAN_LCR_STATE_IN_ALERTING,
77 CHAN_LCR_STATE_OUT_PREPARE,
78 CHAN_LCR_STATE_OUT_SETUP,
79 CHAN_LCR_STATE_OUT_DIALING,
80 CHAN_LCR_STATE_OUT_PROCEEDING,
81 CHAN_LCR_STATE_OUT_ALERTING,
82 CHAN_LCR_STATE_CONNECT,
83 CHAN_LCR_STATE_IN_DISCONNECT,
84 CHAN_LCR_STATE_OUT_DISCONNECT,
85 CHAN_LCR_STATE_RELEASE,
88 #define CHAN_LCR_STATE static const struct chan_lcr_state { \
91 } chan_lcr_state[] = { \
93 "New call from ISDN is waiting for setup." }, \
95 "Call from ISDN is currently set up." }, \
97 "Call from ISDN is currently waiting for digits to be dialed." }, \
99 "Call from ISDN is complete and proceeds to ring." }, \
101 "Call from ISDN is ringing." }, \
103 "New call to ISDN is wating for setup." }, \
105 "Call to ISDN is currently set up." }, \
107 "Call to ISDN is currently waiting for digits to be dialed." }, \
108 { "OUT_PROCEEDING", \
109 "Call to ISDN is complete and proceeds to ring." }, \
111 "Call to ISDN is ringing." }, \
113 "Call has been answered." }, \
115 "Call has been hung up on ISDN side." }, \
116 { "OUT_DISCONNECT", \
117 "Call has been hung up on Asterisk side." }, \
119 "Call is waiting for complete release." }, \
123 #define CERROR(call, ast, arg...) chan_lcr_log(__LOG_ERROR, __FILE__, __LINE__, __FUNCTION__, call, ast, ##arg)
124 #define CDEBUG(call, ast, arg...) chan_lcr_log(__LOG_NOTICE, __FILE__, __LINE__, __FUNCTION__, call, ast, ##arg)
125 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, ...);
126 extern unsigned char flip_bits[256];
127 void lcr_in_dtmf(struct chan_call *call, int val);