Add GSM HR reference codec that is automatically downloaded from 3gpp.org
[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         unsigned int    threepty;
99 };
100
101 struct admin_response_epoint {
102         unsigned int    serial;
103         unsigned int    join; /* link to join */
104 //      int             join_notify; /* if relation notified on hold */
105 //      int             join_hold; /* if relation on hold */
106         int             rx_state;
107         int             tx_state;
108         int             state;
109         char            terminal[16];
110         char            callerid[64];
111         char            dialing[64];
112         char            action[32];
113         int             park; /* if parked */
114         int             park_len;
115         unsigned char   park_callid[8];
116         int             crypt; /* crypt state */
117 };
118
119 struct admin_response_port {
120         unsigned int    serial; /* port serial number */
121         char            name[64]; /* name of port */
122         unsigned int    epoint; /* link to epoint */
123         int             state;
124         int             isdn; /* if port is isdn */
125         int             isdn_chan; /* bchannel number */
126         int             isdn_hold; /* on hold */
127         int             isdn_ces; /* ces to use (>=0)*/
128 };
129
130 struct admin_call {
131         char            interface[64]; /* name of port */
132         char            callerid[64]; /* use caller id */
133         char            dialing[64]; /* number to dial */
134         int             present; /* presentation */
135         int             cause; /* cause to send */
136         int             location;
137         int             notify_progress;
138         int             bc_capa;
139         int             bc_mode;
140         int             bc_info1;
141         int             hlc;
142         int             exthlc;
143 };
144
145 struct admin_trace_req {
146         int             detail;
147         char            category;
148         int             port;
149         char            interface[64];
150         char            caller[34];
151         char            dialing[64];
152 };
153
154 struct admin_trace_rsp {
155         char            text[1024];
156 };
157
158 struct admin_msg {
159         int             type; /* type of message */
160         unsigned int    ref; /* reference to individual endpoints */
161         union parameter param; /* parameter union */
162 };
163
164 struct admin_message {
165         int message; /* type of admin message */
166         union u {
167                 struct admin_response_cmd       x;
168                 struct admin_response_state     s;
169                 struct admin_response_interface i;
170                 struct admin_response_port      p;
171                 struct admin_response_epoint    e;
172                 struct admin_response_join      j;
173                 struct admin_response_remote    r;
174                 struct admin_call               call;
175                 struct admin_msg                msg;
176                 struct admin_trace_req          trace_req;
177                 struct admin_trace_rsp          trace_rsp;
178         } u;
179 };
180
181 /* call states */
182 enum {
183         ADMIN_STATE_IDLE,
184         ADMIN_STATE_IN_SETUP,
185         ADMIN_STATE_OUT_SETUP,
186         ADMIN_STATE_IN_OVERLAP,
187         ADMIN_STATE_OUT_OVERLAP,
188         ADMIN_STATE_IN_PROCEEDING,
189         ADMIN_STATE_OUT_PROCEEDING,
190         ADMIN_STATE_IN_ALERTING,
191         ADMIN_STATE_OUT_ALERTING,
192         ADMIN_STATE_CONNECT,
193         ADMIN_STATE_IN_DISCONNECT,
194         ADMIN_STATE_OUT_DISCONNECT,
195         ADMIN_STATE_RELEASE,
196 };