Adding negotiation of speech codecs between GSM and SIP when using rtp-bridge
[lcr.git] / interface.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** LCR                                                                       **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** interface header file                                                     **
9 **                                                                           **
10 \*****************************************************************************/ 
11 enum {  /* interface type */
12         IF_TYPE_DIRECT,
13         IF_TYPE_EXTENSION,
14 };
15
16         /* channel selection -1 is reserved for "no ie" */
17 #define CHANNEL_NO              -2
18 #define CHANNEL_ANY             -3
19 #define CHANNEL_FREE            -100
20
21         /* port selection */
22 enum {  HUNT_LINEAR = 0,
23         HUNT_ROUNDROBIN,
24 };
25
26         /* filters */
27 enum {  FILTER_GAIN,
28         FILTER_CANCEL,
29         FILTER_BLOWFISH,
30 };
31
32 enum {  IS_DEFAULT = 0,
33         IS_YES,
34         IS_NO,
35 };
36
37 struct select_channel {
38         struct select_channel   *next;
39         int                     channel;
40 };
41
42 struct interface_port {
43         struct interface_port   *next;
44         struct interface        *interface; /* link to interface */
45         struct mISDNport        *mISDNport; /* link to port */
46         int                     portnum; /* port number */
47         char                    portname[64]; /* alternately: port name */
48         int                     ptp; /* force load stack in PTP mode */
49         int                     ptmp; /* force load stack in PTP mode */
50         int                     nt; /* load stack in NT-mode */
51         int                     tespecial; /* special TE-mode behavior */
52         int                     l1hold; /* hold layer 1 (1=on, 0=off) */
53         int                     l2hold; /* hold layer 2 (1=force, -1=disable, 0=default) */
54         unsigned int            ss5; /* set, if SS5 signalling enabled, also holds feature bits */
55         int                     remote; /* interface is a remote app interface */
56         char                    remote_app[32]; /* name of remote application */
57         int                     channel_force; /* forces channel by protocol */
58         int                     nodtmf; /* disables DTMF */
59         struct select_channel   *out_channel; /* list of channels to select */
60         struct select_channel   *in_channel; /* the same for incoming channels */
61         int                     block; /* set if interface is blocked */
62         int                     tout_setup;
63         int                     tout_dialing;
64         int                     tout_proceeding;
65         int                     tout_alerting;
66         int                     tout_disconnect;
67 //      int                     tout_hold;
68 //      int                     tout_park;
69         int                     dialmax; /* maximum number of digits to dial */
70         char                    tones_dir[128];
71         int                     nonotify; /* blocks outgoing notify messages  */
72 };
73
74 struct interface_msn {
75         struct interface_msn    *next;
76         char                    msn[64]; /* msn */
77 };
78
79 struct interface_screen {
80         struct interface_screen *next;
81         char                    match[64]; /* what caller id to match */
82         int                     match_type; /* number type */
83         int                     match_present; /* presentation type */
84         char                    result[64]; /* what caller id to change to */
85         int                     result_type; /* number type */
86         int                     result_present; /* presentation type */
87 };
88
89 struct interface {
90         struct interface        *next;
91         char                    name[64]; /* name of interface */
92         int                     app; /* application to use for interface (0 = PBX) */
93         char                    bridge_if[64]; /* name of destination interface for bridge application */
94         int                     external; /* interface used for external calls */
95         int                     extension; /* calls are handled as extension */
96         int                     is_tones; /* generate tones */
97         int                     is_earlyb; /* bridge tones during call setup */
98         int                     shutdown; /* interface will not automatically be loaded */
99         int                     hunt; /* select algorithm */
100         int                     hunt_next; /* ifport index to start hunt */
101         struct interface_port   *ifport; /* link to interface port list */
102         struct interface_msn    *ifmsn; /* link to interface msn list */
103         struct interface_screen *ifscreen_in; /* link to screening list */
104         struct interface_screen *ifscreen_out; /* link to screening list */
105         int                     tx_gain, rx_gain; /* filter gain */
106         char                    pipeline[256]; /* filter pipeline */
107         unsigned char           bf_key[56]; /* filter blowfish */
108         int                     bf_len; /* filter length of blowfish */
109 #ifdef WITH_GSM_BS
110         int                     gsm_bs; /* interface is an GSM BS interface */
111 #if 0
112         int                     gsm_bs_payloads;
113         unsigned char           gsm_bs_payload_types[8];
114 #endif
115 #endif
116 #ifdef WITH_GSM_MS
117         int                     gsm_ms; /* interface is an GSM MS interface */
118         char                    gsm_ms_name[32]; /* name of ms */
119 #endif
120 #ifdef WITH_SIP
121         int                     sip; /* interface is a SIP interface */
122         char                    sip_local_ip[16];
123         char                    sip_remote_ip[16];
124         void                    *sip_inst; /* sip instance */
125 #endif
126         int                     rtp_bridge; /* bridge RTP directly (for calls comming from interface) */
127 };
128
129 struct interface_param {
130         const char              *name;
131 /*      return value            (pointer of function)(args ...) */
132         int                     (*func)(struct interface *, char *, int, char *, char*);
133         const char              *usage;
134         const char              *help;
135 };
136
137
138 extern struct interface *interface_first;
139 extern struct interface *interface_newlist;
140
141 extern char interface_error[256];
142 struct interface *read_interfaces(void);
143 void free_interfaces(struct interface *interface_start);
144 void relink_interfaces(void);
145 void load_mISDN_port(struct interface_port *ifport);
146 void doc_interface(void);
147 void do_screen(int out, char *id, int idsize, int *type, int *present, const char *interface_name);
148 struct interface *getinterfacebyname(const char *name);
149