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 long 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 /* store cause from lcr */
25 unsigned char dialque[64];
26 /* queue dialing prior setup ack */
27 struct connect_info connectinfo;
28 /* store connectinfo form lcr */
31 struct chan_call *bridge_call;
32 /* remote instance or NULL */
34 /* pipe for receive data */
38 CHAN_LCR_STATE_IN_PREPARE = 0,
39 CHAN_LCR_STATE_IN_SETUP,
40 CHAN_LCR_STATE_IN_DIALING,
41 CHAN_LCR_STATE_IN_PROCEEDING,
42 CHAN_LCR_STATE_IN_ALERTING,
43 CHAN_LCR_STATE_OUT_PREPARE,
44 CHAN_LCR_STATE_OUT_SETUP,
45 CHAN_LCR_STATE_OUT_DIALING,
46 CHAN_LCR_STATE_OUT_PROCEEDING,
47 CHAN_LCR_STATE_OUT_ALERTING,
48 CHAN_LCR_STATE_CONNECT,
49 CHAN_LCR_STATE_IN_DISCONNECT,
50 CHAN_LCR_STATE_OUT_DISCONNECT,
51 CHAN_LCR_STATE_RELEASE,
54 #define CHAN_LCR_STATE static const struct chan_lcr_state { \
57 } chan_lcr_state[] = { \
59 "New call from ISDN is waiting for setup." }, \
61 "Call from ISDN is currently set up." }, \
63 "Call from ISDN is currently waiting for digits to be dialed." }, \
65 "Call from ISDN is complete and proceeds to ring." }, \
67 "Call from ISDN is ringing." }, \
69 "New call to ISDN is wating for setup." }, \
71 "Call to ISDN is currently set up." }, \
73 "Call to ISDN is currently waiting for digits to be dialed." }, \
75 "Call to ISDN is complete and proceeds to ring." }, \
77 "Call to ISDN is ringing." }, \
79 "Call has been answered." }, \
81 "Call has been hung up on ISDN side." }, \
83 "Call has been hung up on Asterisk side." }, \
85 "Call is waiting for complete release." }, \
89 #define CERROR(call, ast, arg...) chan_lcr_log(LOG_ERROR, call, ast, ##arg)
90 #define CDEBUG(call, ast, arg...) chan_lcr_log(LOG_DEBUG, call, ast, ##arg)
91 void chan_lcr_log(int type, struct chan_call *call, struct ast_channel *ast, const char *fmt, ...);