Lowered volume level of tones and announcements
[lcr.git] / main.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** Linux Call Router                                                         **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** Header file for defining fixed values for the current version             **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <stdint.h>
15 #include <stdarg.h>
16 #include <unistd.h>
17 #include <string.h>
18 #include <signal.h>
19 #include <time.h>
20 #include <fcntl.h>
21 #include <errno.h>
22 #include <pthread.h>
23 #include <dirent.h>
24 #include <math.h>
25 #include <sys/time.h>
26 #include <sys/types.h>
27 #include <sys/wait.h>
28 #include <sys/stat.h>
29 #include <sys/ioctl.h>
30 #include <sys/file.h>
31 #include <sys/mman.h>
32 #include <sys/resource.h>
33 #include <sys/socket.h>
34 #include <sys/un.h>
35
36 #define NAME            "LCR"
37
38 #define VERSION_STRING  VERSION
39
40 extern int memuse;
41 extern int mmemuse;
42 extern int cmemuse;
43 extern int ememuse;
44 extern int pmemuse;
45 extern int amemuse;
46 extern int rmemuse;
47 extern int classuse;
48 extern int fduse;
49 extern int fhuse;
50
51 //extern pthread_mutex_t mutex_lcr; // lcr process mutex
52
53 extern FILE *debug_fp;
54
55 #define PDEBUG(mask, fmt, arg...) _printdebug(__FILE__, __FUNCTION__, __LINE__, mask, fmt, ## arg)
56 #define PERROR(fmt, arg...) _printerror(__FILE__, __FUNCTION__, __LINE__, fmt, ## arg)
57 #define PDEBUG_RUNTIME(mask, fmt, arg...) _printdebug(NULL, NULL, 0, mask, fmt, ## arg)
58 #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, NULL, 0, fmt, ## arg)
59 void _printdebug(const char *file, const char *function, int line, unsigned int mask, const char *fmt, ...);
60 void _printerror(const char *file, const char *function, int line, const char *fmt, ...);
61 #define DEBUG_FUNC
62 void debug(const char *file, const char *function, int line, const char *prefix, char *buffer);
63
64 #define DEBUG_CONFIG    0x0001
65 #define DEBUG_MSG       0x0002
66 #define DEBUG_STACK     0x0004
67 #define DEBUG_BCHANNEL  0x0008
68 #define DEBUG_PORT      0x0100
69 #define DEBUG_ISDN      0x0110
70 #define DEBUG_GSM       0x0120
71 #define DEBUG_SS5       0x0140
72 #define DEBUG_VBOX      0x0180
73 #define DEBUG_SIP       0x10100
74 #define DEBUG_EPOINT    0x0200
75 #define DEBUG_JOIN      0x0400
76 #define DEBUG_VERSATEL  0x0800
77 #define DEBUG_CRYPT     0x1000
78 #define DEBUG_ROUTE     0x2000
79 #define DEBUG_IDLETIME  0x4000
80
81 // check any faulty malloc
82 #define MALLOC_CHECK_   1
83
84 /*
85  * one of the bits must be enabled in order to write log files
86  */
87 #define DEBUG_LOG       0xfffff
88
89 /*
90  * load transmit buffer to avoid gaps at the beginning due to jitter
91  */
92 #define ISDN_LOAD       1024 // samples
93
94 /* give sendmail program. if not inside $PATH, give absolute path here (e.g. "/usr/sbin/sendmail")
95  */
96 #define SENDMAIL        "sendmail"
97
98 /* leave it above 1024, because lower values can be unsafe, higher valuse cause
99  * data larger than 512 bytes of hex strings.
100  */
101 #define RSA_BITS        1536
102
103 /* 'goto' or 'menu' actions may cause infinite loops. they will be prevented by this limit.
104  * Also other recursions, like redialing the 'redial' action must be prevented.
105  * increase it ONLY IF you have a deeper tree of rule sets, than the value given here.
106  */
107 #define RULE_NESTING    10
108
109 /* to debug core bridging, rather than mISDN dsp bridging, enable.
110  * this is for debugging only, bridging conferences will not work
111  */
112 //#define DEBUG_COREBRIDGE
113
114 /* special debugging for buffer overflow bugs
115  * note: whenever a buffer gets strange values, the budetect function must
116  * be modified to detect the change of these values. whenever it is detected,
117  * an error message is given at budetect function.
118  */
119 //#define BUDETECT_DEF
120
121 /* internal limit of payload type in a message */
122
123 #ifdef BUDETECT_DEF
124  #define BUDETECT       budetect(__FILE__, __LINE__, __FUNCTION__);
125  void budetect(const char *file, int line, const char *function);
126 #else
127  #define BUDETECT       ;
128 #endif
129
130 #ifdef WITH_MISDN
131  #ifdef __cplusplus
132   extern "C" {
133  #endif
134  #include <mISDN/mbuffer.h>
135  #ifdef __cplusplus
136   }
137  #endif
138 #endif
139 #include "macro.h"
140 #include "select.h"
141 #include "options.h"
142 #include "interface.h"
143 #include "extension.h"
144 #include "message.h"
145 #include "endpoint.h"
146 #include "endpointapp.h"
147 #include "apppbx.h"
148 #include "appbridge.h"
149 #include "callerid.h"
150 #include "route.h"
151 #ifdef WITH_VOOTP
152  #ifdef __cplusplus
153   extern "C" {
154  #endif
155 #include <vootp.h>
156  #ifdef __cplusplus
157   }
158  #endif
159 #endif
160 #include "port.h"
161 #include "remote.h"
162 #ifdef WITH_MISDN
163 #include "mISDN.h"
164 #include "dss1.h"
165 #include "fxs.h"
166 #endif
167 #if defined WITH_GSM_BS || defined WITH_GSM_MS
168 #include "gsm.h"
169 #endif
170 #ifdef WITH_GSM_BS
171 #include "gsm_bs.h"
172 #endif
173 #ifdef WITH_GSM_MS
174 #include "gsm_ms.h"
175 #endif
176 #ifdef WITH_SS5
177 #include "ss5_encode.h"
178 #include "ss5_decode.h"
179 #include "ss5.h"
180 #endif
181 #ifdef WITH_SIP
182 #include "sip.h"
183 #endif
184 #include "vbox.h"
185 #include "join.h"
186 #include "joinpbx.h"
187 #include "cause.h"
188 #include "alawulaw.h"
189 #include "tones.h"
190 #include "crypt.h"
191 #include "socket_server.h"
192 #include "trace.h"
193
194 extern int quit;
195
196 #define DIRECTION_NONE  0
197 #define DIRECTION_OUT   1
198 #define DIRECTION_IN    2
199
200 #if 0
201 struct lcr_fdset {
202         struct mISDNport *mISDNport;
203         int b_index;
204 };
205 #endif
206