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