Test patch #1 for chan_lcr, to debug the Asterisk freeze problem.
[lcr.git] / extension.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** PBX4Linux                                                                 **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** extension header file                                                     **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 /* maximum number of redial/powerdial and reply numbers to remember
13  */
14 #define MAX_REMEMBER    99
15
16 /* display of callerid on internal numbers */
17
18 enum {
19         DISPLAY_CID_ASIS,                       /* with type as defined */
20         DISPLAY_CID_NUMBER,                     /* "5551212" */
21         DISPLAY_CID_ABBREVIATION,               /* "05" */
22         DISPLAY_CID_NAME,                       /* "Axel" */
23         DISPLAY_CID_NAME_NUMBER,                /* "Axel 5551212" */
24         DISPLAY_CID_NUMBER_NAME,                /* "5551212 Axel" */
25         DISPLAY_CID_ABBREV_NUMBER,              /* "05 5551212" */
26         DISPLAY_CID_ABBREV_NAME,                /* "05 Axel" */
27         DISPLAY_CID_ABBREV_NUMBER_NAME,         /* "05 5551212 Axel" */
28         DISPLAY_CID_ABBREV_NAME_NUMBER          /* "05 Axel 5551212" */
29 };
30 enum {
31         DISPLAY_CID_INTERNAL_OFF,               /* "20" */
32         DISPLAY_CID_INTERNAL_ON         /* "Intern 20" */
33 };
34
35 /* display of clear causes using display messages */
36
37 enum {
38         DISPLAY_CAUSE_NONE,
39         DISPLAY_CAUSE_ENGLISH,          /* "34 - no channel" */
40         DISPLAY_CAUSE_GERMAN,           /* "34 - kein Kanal" */
41         DISPLAY_LOCATION_ENGLISH,       /* "34 - Network (Remote)" */
42         DISPLAY_LOCATION_GERMAN,        /* "34 - Vermittlung (Gegenstelle)" */
43         DISPLAY_CAUSE_NUMBER            /* "Cause 34" */
44 };
45
46 /* clip */
47
48 enum {
49         CLIP_ASIS,                      /* use colp as presented by caller */
50         CLIP_HIDE                       /* use extension's caller id */
51 };
52
53 /* colp */
54
55 enum {
56         COLP_ASIS,                      /* use colp as presented by called */
57         COLP_HIDE,                      /* use extension's caller id */
58         COLP_FORCE                      /* use colp even if called dosn't provide or allow */
59 };
60
61 /* codec to use */
62
63 enum {
64         CODEC_OFF,                      /* record wave off */
65         CODEC_MONO,                     /* record wave mono */
66         CODEC_STEREO,                   /* record wave stereo */
67         CODEC_8BIT,                     /* record wave mono 8bit */
68         CODEC_LAW                       /* record LAW */
69 };
70
71 /* VBOX mode */
72
73 enum {
74         VBOX_MODE_NORMAL,               /* normal mode: send announcement, then record */
75         VBOX_MODE_PARALLEL,             /* parallel mode: send announcement and record during announcement */
76         VBOX_MODE_ANNOUNCEMENT          /* announcement mode: send announcement and disconnect */
77 };
78
79 /* VBOX display */
80
81 enum {
82         VBOX_DISPLAY_BRIEF,             /* parallel mode: send announcement and record during announcement */
83         VBOX_DISPLAY_DETAILED,          /* announcement mode: send announcement and disconnect */
84         VBOX_DISPLAY_OFF                /* normal mode: send announcement, then record */
85 };
86
87 /* VBOX language */
88
89 enum {
90         VBOX_LANGUAGE_ENGLISH,          /* display and announcements are in english */
91         VBOX_LANGUAGE_GERMAN            /* display and announcements are in german */
92 };
93
94 /* dsptones */
95
96 enum {
97         DSP_NONE,
98         DSP_AMERICAN,
99         DSP_GERMAN,
100         DSP_OLDGERMAN
101 };
102
103
104 /* extensions
105  *
106  * extensions are settings saved at <extensions_dir>/<extension>/settings
107  * they carry all information and permissions about an extension
108  * they will be loaded when needed and saved when changed
109  */
110
111 struct extension {
112         char number[32];        /* number of extension */
113         char name[32];
114         char prefix[32];
115         char next[32];          /* next number to dial when pickup (temp prefix) */
116         char alarm[32];
117         char cfb[256];
118         char cfu[256];
119         char cfnr[256];
120         int cfnr_delay;
121         int change_forward;
122         char cfp[256];
123         char interfaces[128];
124         char callerid[32];
125         int callerid_type;
126         int callerid_present;
127         char id_next_call[32];
128         int id_next_call_type;
129         int id_next_call_present;
130         int change_callerid;
131         int clip;               /* how to present caller id on forwarded calls */
132         int colp;               /* how to present called line id on forwarded calls */
133         char clip_prefix[32];   /* prefix for screening incoming clip */
134         int keypad;             /* support keypad for call control */
135         int anon_ignore;        /* ignore anonymouse calls */
136         int rights;
137         int delete_ext;         /* delete function for external dialing */
138         int noknocking;         /* deny knocking of incoming call */
139         char last_out[MAX_REMEMBER][64];        /* numbers to redail */
140         char last_in[MAX_REMEMBER][64]; /* numbers to reply */
141         int tx_gain;
142         int rx_gain;
143         int display_cause;      /* clear cause using display message */
144         int display_ext;        /* display external caller ids */
145         int display_int;        /* display internal caller ids */
146         int display_fake;       /* display fake caller ids */
147         int display_anon;       /* display anonymouse caller ids */
148         int display_menu;       /* display menu */
149         int display_dialing;    /* display interpreted digits while dialing */
150         int display_name;       /* display caller's name if available (CNIP) */
151         char tones_dir[64];     /* directory of all tones/patterns */
152         int record;             /* SEE RECORD_* */
153         char password[64];      /* callback / login password */
154
155         int vbox_mode;          /* see VBOX_MODE_* */
156         int vbox_codec;         /* see CODEC_* */
157         int vbox_time;          /* time to recorde, 0=infinite */
158         int vbox_display;       /* see VBOX_DISPLAY_* */
159         int vbox_language;      /* see VBOX_LANGUAGE_* */
160         char vbox_email[128];   /* send mail if given */
161         int vbox_email_file;    /* set, if also the audio fille will be attached */
162         int vbox_free;          /* if vbox shall connect after announcment */
163         
164         int own_setup;
165         int own_proceeding;
166         int own_alerting;
167         int own_cause;
168
169         int facility;           /* must be set to forward facility to terminal */
170         int datacall;           /* data calls are handled as voice calls */
171         int no_seconds;         /* don't include seconds in the connect message */
172 };
173
174 int read_extension(struct extension *ext, char *number);
175 int write_extension(struct extension *ext, char *number);
176 int write_log(char *number, char *callerid, char *calledid, time_t start, time_t stop, int aoce, int cause, int location);
177 int parse_phonebook(char *number, char **abbrev_pointer, char **phone_pointer, char **name_pointer);
178 int parse_secrets(char *number, char *remote_id, char **auth_pointer, char **crypt_pointer, char **key_pointer);
179 char *parse_directory(char *number, int type);
180 struct caller_info;
181 int parse_callbackauth(char *number, struct caller_info *callerinfo);
182 void append_callbackauth(char *number, struct caller_info *callerinfo);
183
184