Adding various arguments to 'execute' condition and 'execute' action.
[lcr.git] / lcrsocket.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** Linux Call Router                                                         **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** Administration tool header file                                           **
9 **                                                                           **
10 \*****************************************************************************/
11
12 #define SOCKET_NAME "%s/LCR.socket"
13
14 /* structures that define message between admin-tool and pbx */
15
16 enum { /* messages */
17         ADMIN_REQUEST_CMD_INTERFACE,
18         ADMIN_RESPONSE_CMD_INTERFACE,
19         ADMIN_REQUEST_CMD_ROUTE,
20         ADMIN_RESPONSE_CMD_ROUTE,
21         ADMIN_REQUEST_CMD_DIAL,
22         ADMIN_RESPONSE_CMD_DIAL,
23         ADMIN_REQUEST_CMD_RELEASE,
24         ADMIN_RESPONSE_CMD_RELEASE,
25         ADMIN_REQUEST_CMD_BLOCK,
26         ADMIN_RESPONSE_CMD_BLOCK,
27         ADMIN_REQUEST_STATE,
28         ADMIN_RESPONSE_STATE,
29         ADMIN_RESPONSE_S_REMOTE,
30         ADMIN_RESPONSE_S_INTERFACE,
31         ADMIN_RESPONSE_S_PORT,
32         ADMIN_RESPONSE_S_EPOINT,
33         ADMIN_RESPONSE_S_JOIN,
34         ADMIN_CALL_SETUP,
35         ADMIN_CALL_SETUP_ACK,
36         ADMIN_CALL_PROCEEDING,
37         ADMIN_CALL_ALERTING,
38         ADMIN_CALL_CONNECT,
39         ADMIN_CALL_DISCONNECT,
40         ADMIN_CALL_RELEASE,
41         ADMIN_CALL_NOTIFY,
42         ADMIN_CALL_PROGRESS,
43         ADMIN_TRACE_REQUEST,
44         ADMIN_TRACE_RESPONSE,
45         ADMIN_MESSAGE,
46 };
47
48 struct admin_response_cmd {
49         int             error;          /* error code 0 = ok*/
50         char            message[256];   /* info / response text */
51         int             block;
52         int             portnum;
53 };
54
55 struct admin_response_state {
56         char            version_string[64];
57         struct tm       tm;
58         char            logfile[128];
59         int             interfaces;
60         int             remotes;
61         int             joins;
62         int             epoints;
63         int             ports;
64 };
65
66 struct admin_response_interface {
67         char            interface_name[32];
68         int             portnum;
69         char            portname[64];
70         int             block;
71         int             ntmode;
72         int             ptp;
73         int             l1hold;
74         int             l2hold;
75         int             pri;
76         int             extension;
77         int             use; /* number of ports that use this interface */
78         int             l1link; /* down(0) or up(1) */
79         int             l2link; /* down(0) or up(1) */
80         unsigned char   l2mask[16]; /* one bit for each tei */
81         int             los, ais, rdi, slip_tx, slip_rx;
82         int             channels;
83         char            busy[256]; /* if port is idle(0) busy(1) */
84         unsigned int    port[256]; /* current port */
85         int             mode[256];
86         char            out_channel[256];
87         char            in_channel[256];
88 };
89
90 struct admin_response_remote {
91         char            name[32]; /* name of remote application */
92 };
93
94 struct admin_response_join {
95         unsigned int    serial; /* join serial number */
96         char            remote[32]; /* remote application name */
97         unsigned int    partyline;
98 };
99
100 struct admin_response_epoint {
101         unsigned int    serial;
102         unsigned int    join; /* link to join */
103 //      int             join_notify; /* if relation notified on hold */
104 //      int             join_hold; /* if relation on hold */
105         int             rx_state;
106         int             tx_state;
107         int             state;
108         char            terminal[16];
109         char            callerid[64];
110         char            dialing[64];
111         char            action[32];
112         int             park; /* if parked */
113         int             park_len;
114         unsigned char   park_callid[8];
115         int             crypt; /* crypt state */
116 };
117
118 struct admin_response_port {
119         unsigned int    serial; /* port serial number */
120         char            name[64]; /* name of port */
121         unsigned int    epoint; /* link to epoint */
122         int             state;
123         int             isdn; /* if port is isdn */
124         int             isdn_chan; /* bchannel number */
125         int             isdn_hold; /* on hold */
126         int             isdn_ces; /* ces to use (>=0)*/
127 };
128
129 struct admin_call {
130         char            interface[64]; /* name of port */
131         char            callerid[64]; /* use caller id */
132         char            dialing[64]; /* number to dial */
133         int             present; /* presentation */
134         int             cause; /* cause to send */
135         int             location;
136         int             notify_progress;
137         int             bc_capa;
138         int             bc_mode;
139         int             bc_info1;
140         int             hlc;
141         int             exthlc;
142 };
143
144 struct admin_trace_req {
145         int             detail;
146         char            category;
147         int             port;
148         char            interface[64];
149         char            caller[34];
150         char            dialing[64];
151 };
152
153 struct admin_trace_rsp {
154         char            text[1024];
155 };
156
157 struct admin_msg {
158         int             type; /* type of message */
159         unsigned int    ref; /* reference to individual endpoints */
160         union parameter param; /* parameter union */
161 };
162
163 struct admin_message {
164         int message; /* type of admin message */
165         union u {
166                 struct admin_response_cmd       x;
167                 struct admin_response_state     s;
168                 struct admin_response_interface i;
169                 struct admin_response_port      p;
170                 struct admin_response_epoint    e;
171                 struct admin_response_join      j;
172                 struct admin_response_remote    r;
173                 struct admin_call               call;
174                 struct admin_msg                msg;
175                 struct admin_trace_req          trace_req;
176                 struct admin_trace_rsp          trace_rsp;
177         } u;
178 };
179
180 /* call states */
181 enum {
182         ADMIN_STATE_IDLE,
183         ADMIN_STATE_IN_SETUP,
184         ADMIN_STATE_OUT_SETUP,
185         ADMIN_STATE_IN_OVERLAP,
186         ADMIN_STATE_OUT_OVERLAP,
187         ADMIN_STATE_IN_PROCEEDING,
188         ADMIN_STATE_OUT_PROCEEDING,
189         ADMIN_STATE_IN_ALERTING,
190         ADMIN_STATE_OUT_ALERTING,
191         ADMIN_STATE_CONNECT,
192         ADMIN_STATE_IN_DISCONNECT,
193         ADMIN_STATE_OUT_DISCONNECT,
194         ADMIN_STATE_RELEASE,
195 };