only for backup, still in coding state - no compile!!!
[lcr.git] / main.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** PBX4Linux                                                                 **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** Header file for defining fixed values for the current version             **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 #define NAME            "PBX4Linux"
13
14 #define DEFAULT_ENDPOINT_APP EndpointAppPBX
15
16 #define VERSION_STRING  "3.6 (Januar 2006)"
17
18 extern int memuse;
19 extern int mmemuse;
20 extern int cmemuse;
21 extern int ememuse;
22 extern int pmemuse;
23 extern int amemuse;
24 extern int rmemuse;
25 extern int classuse;
26 extern int fduse;
27 extern int fhuse;
28
29 #define PDEBUG(mask, fmt, arg...) _printdebug(__FUNCTION__, __LINE__, mask, fmt, ## arg)
30 #define PERROR(fmt, arg...) _printerror(__FUNCTION__, __LINE__, fmt, ## arg)
31 #define PDEBUG_RUNTIME(mask, fmt, arg...) _printdebug(NULL, 0, mask, fmt, ## arg)
32 #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg)
33 void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...);
34 void printlog(const char *fmt, ...);
35 void _printerror(const char *function, int line, const char *fmt, ...);
36
37 #define DEBUG_CONFIG    0x0001
38 #define DEBUG_MSG       0x0002
39 #define DEBUG_STACK     0x0004
40 #define DEBUG_BCHANNEL  0x0008
41 #define DEBUG_PORT      0x0100
42 #define DEBUG_ISDN      0x0110
43 #define DEBUG_OPAL      0x0120 
44 #define DEBUG_H323      0x0130 
45 //#define DEBUG_KNOCK   0x0140
46 #define DEBUG_VBOX      0x0180
47 #define DEBUG_EPOINT    0x0200
48 #define DEBUG_CALL      0x0400
49 #define DEBUG_VERSATEL  0x0800
50 #define DEBUG_CRYPT     0x1000
51 #define DEBUG_ROUTE     0x2000
52 #define DEBUG_IDLETIME  0x4000
53 #define DEBUG_LOG       0x7fff
54
55 // check any faulty malloc
56 #define MALLOC_CHECK_   1
57
58 /*
59  * one of the bits must be enabled in order to write log files
60  */
61 #define DEBUG_LOG       0x7fff
62
63 /* audio buffer for mixer and recording.
64  * all partys within a call (most time two endpoints) write audio data to the buffer. this is used because
65  * the buffer experience jitter. if the buffer is too small, jitter will cause drops and gaps.
66  * if the buffer is too large, the delay is large. 768 is a good value to start with.
67  */
68 #ifdef VOIP
69 #warning to be removed soon
70 #endif
71 #define PORT_BUFFER     768
72
73 /* keep this 0 for minimum delay */
74 #ifdef VOIP
75 #warning to be removed soon
76 #endif
77 #define ISDN_PRELOAD    0
78
79 /* the jitterlimit specifies the number of samples received too fast, before
80  * it recognizes a stalling process.
81  * but should NOT be less 256.
82  */
83 #ifdef VOIP
84 #warning to be removed soon
85 #endif
86 #define ISDN_JITTERLIMIT 512    /* maximum samples received before dropping */
87
88 /* give sendmail program. if not inside $PATH, give absolute path here (e.g. "/usr/sbin/sendmail")
89  */
90 #define SENDMAIL        "sendmail"
91
92 /* maximum number of redial/powerdial and reply numbers to remember
93  */
94 #define MAX_REMEMBER    50
95
96 /* leave it above 1024, because lower values can be unsafe, higher valuse cause
97  * data larger than 512 bytes of hex strings.
98  */
99 #define RSA_BITS        1536
100
101 /* 'goto' or 'menu' actions may cause infinite loops. they will be prevented by this limit.
102  * Also other recursions, like redialing the 'redial' action must be prevented.
103  * increase it ONLY IF you have a deeper tree of rule sets, than the value given here.
104  */
105 #define RULE_NESTING    10
106
107 /* special debugging for buffer overflow bugs
108  * note: whenever a buffer gets strange values, the budetect function must
109  * be modified to detect the change of these values. whenever it is detected,
110  * an error message is given at budetect function.
111  */
112 //#define BUDETECT_DEF
113
114 #ifdef BUDETECT_DEF
115  #define BUDETECT       budetect(__FILE__, __LINE__, __FUNCTION__);
116  void budetect(const char *file, int line, char *function);
117 #else
118  #define BUDETECT       ;
119 #endif
120
121 #ifdef H323
122 #define VOIP
123 #ifdef OPAL
124 #error    It is not allowed to use H323 and OPAL. Please disable H323, because it is included in OPAL.
125 #endif
126 #endif
127 #ifdef OPAL
128 #define VOIP
129 #endif
130
131 #ifdef H323INCLUDE
132 #define NO_VIDEO_CAPTURE
133 //#include <vector>
134 //#include <string>
135 #include <ptlib.h>
136 #include <h225.h>
137 #include <h323.h>
138 #include <h323pdu.h>
139 #include <h323caps.h>
140 #include <q931.h>
141 #endif
142
143 #include <stdio.h>
144 #include <stdlib.h>
145 #include <unistd.h>
146 #include <string.h>
147 #include <time.h>
148 #include <sys/time.h>
149 //#include <asm/bitops.h>
150 #ifdef __cplusplus
151 extern "C" {
152 #endif
153 #include <isdn_net.h>
154 #include <net_l3.h>
155 #ifdef __cplusplus
156 }
157 #endif
158 #include "save.h"
159 #include "options.h"
160 #include "interface.h"
161 #include "h323conf.h"
162 #include "extension.h"
163 #include "message.h"
164 #include "endpoint.h"
165 #include "endpointapp.h"
166 #include "apppbx.h"
167 #include "route.h"
168 #include "port.h"
169 #include "mISDN.h"
170 #include "dss1.h"
171 #ifdef H323
172 #include "h323.h"
173 #endif
174 #ifdef OPAL
175 #include "opal.h"
176 #endif
177 #include "vbox.h"
178 #include "call.h"
179 #include "callpbx.h"
180 #include "callchan.h"
181 #include "cause.h"
182 #include "alawulaw.h"
183 #include "tones.h"
184 #include "crypt.h"
185 #include "admin_server.h"
186
187 extern double now_d;
188 extern time_t now;
189 extern struct tm *now_tm;
190 extern struct timeval now_tv;
191 extern struct timezone now_tz;
192
193
194 #ifdef H323INCLUDE
195 #include "h323_ep.h"
196 #include "h323_con.h"
197 #include "h323_chan.h"
198
199 extern PMutex mutex_h323; // mutual exclude for synchroniszing threads 
200 extern H323_ep *h323_ep;
201 #endif
202