make configuration variable const so they are not accidentally
[asterisk/asterisk.git] / utils / conf2ael.c
1 /*  
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2007, Digium, Inc.
5  *
6  * Steve Murphy <murf@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 /*
20  *
21  * Reverse compile extensions.conf code into prototype AEL code
22  *
23  */
24
25 /*** MODULEINFO
26         <depend>res_ael_share</depend>
27  ***/
28
29 #include "asterisk.h"
30 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
31
32 #include <stdio.h>
33 #include <sys/types.h>
34 #include <stdlib.h>
35 #include <stdarg.h>
36 #include <string.h>
37 #include <locale.h>
38 #include <ctype.h>
39 #if !defined(SOLARIS) && !defined(__CYGWIN__)
40 #include <err.h>
41 #endif
42 #include <errno.h>
43 #include <regex.h>
44 #include <limits.h>
45
46 #include "asterisk.h"
47 #include "asterisk/pbx.h"
48 #include "asterisk/ast_expr.h"
49 #include "asterisk/channel.h"
50 #include "asterisk/chanvars.h"
51 #include "asterisk/module.h"
52 #include "asterisk/app.h"
53 #include "asterisk/config.h"
54 #include "asterisk/options.h"
55 #include "asterisk/callerid.h"
56 #include "asterisk/ael_structs.h"
57 #include "asterisk/devicestate.h"
58 #include "asterisk/stringfields.h"
59 #include "asterisk/pval.h"
60 #include "asterisk/extconf.h"
61
62 void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *start, int *end);
63 int all_bits_set(unsigned int *word, int bitsperword, int totalbits);
64 extern char *days[];
65 extern char *months[];
66 const char ast_config_AST_CONFIG_DIR[PATH_MAX];
67
68 char *config = "extensions.conf";
69
70 /* 
71 static char *registrar = "conf2ael";
72 static char userscontext[AST_MAX_EXTENSION] = "default";
73 static int static_config = 0;
74 static int write_protect_config = 1;
75 static int autofallthrough_config = 0;
76 static int clearglobalvars_config = 0;
77 char ast_config_AST_SYSTEM_NAME[20] = ""; */
78
79 /*! Go no deeper than this through includes (not counting loops) */
80 #define AST_PBX_MAX_STACK       128
81 /* static AST_RWLIST_HEAD_STATIC(acf_root, ast_custom_function); */
82 //extern char ast_config_AST_CONFIG_DIR[PATH_MAX];
83
84 void ast_register_file_version(const char *file, const char *version)
85 {
86 }
87
88 void ast_unregister_file_version(const char *file)
89 {
90 }
91 int ast_add_profile(const char *x, uint64_t scale) { return 0;}
92
93 /* Our own version of ast_log, since the expr parser uses it. -- stolen from utils/check_expr.c */
94 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
95
96 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
97 {
98         va_list vars;
99         va_start(vars,fmt);
100         
101         printf("LOG: lev:%d file:%s  line:%d func: %s  ",
102                    level, file, line, function);
103         vprintf(fmt, vars);
104         fflush(stdout);
105         va_end(vars);
106 }
107
108 /* stolen from pbx.c */
109 struct ast_context;
110 struct ast_app;
111 #ifdef LOW_MEMORY
112 #define EXT_DATA_SIZE 256
113 #else
114 #define EXT_DATA_SIZE 8192
115 #endif
116
117 #define SWITCH_DATA_LENGTH 256
118
119 #define VAR_BUF_SIZE 4096
120
121 #define VAR_NORMAL              1
122 #define VAR_SOFTTRAN    2
123 #define VAR_HARDTRAN    3
124
125 #define BACKGROUND_SKIP         (1 << 0)
126 #define BACKGROUND_NOANSWER     (1 << 1)
127 #define BACKGROUND_MATCHEXTEN   (1 << 2)
128 #define BACKGROUND_PLAYBACK     (1 << 3)
129
130 /*!
131    \brief ast_exten: An extension
132         The dialplan is saved as a linked list with each context
133         having it's own linked list of extensions - one item per
134         priority.
135 */
136 struct ast_exten {
137         char *exten;                    /*!< Extension name */
138         int matchcid;                   /*!< Match caller id ? */
139         const char *cidmatch;           /*!< Caller id to match for this extension */
140         int priority;                   /*!< Priority */
141         const char *label;              /*!< Label */
142         struct ast_context *parent;     /*!< The context this extension belongs to  */
143         const char *app;                /*!< Application to execute */
144         struct ast_app *cached_app;     /*!< Cached location of application */
145         void *data;                     /*!< Data to use (arguments) */
146         void (*datad)(void *);          /*!< Data destructor */
147         struct ast_exten *peer;         /*!< Next higher priority with our extension */
148         const char *registrar;          /*!< Registrar */
149         struct ast_exten *next;         /*!< Extension with a greater ID */
150         char stuff[0];
151 };
152
153
154 /*! \brief ast_include: include= support in extensions.conf */
155 struct ast_include {
156         const char *name;
157         const char *rname;                      /*!< Context to include */
158         const char *registrar;                  /*!< Registrar */
159         int hastime;                            /*!< If time construct exists */
160         struct ast_timing timing;               /*!< time construct */
161         struct ast_include *next;               /*!< Link them together */
162         char stuff[0];
163 };
164
165 /*! \brief ast_sw: Switch statement in extensions.conf */
166 struct ast_sw {
167         char *name;
168         const char *registrar;                  /*!< Registrar */
169         char *data;                             /*!< Data load */
170         int eval;
171         AST_LIST_ENTRY(ast_sw) list;
172         char *tmpdata;
173         char stuff[0];
174 };
175
176 /*! \brief ast_ignorepat: Ignore patterns in dial plan */
177 struct ast_ignorepat {
178         const char *registrar;
179         struct ast_ignorepat *next;
180         const char pattern[0];
181 };
182
183 /*! \brief ast_context: An extension context */
184 struct ast_context {
185         ast_rwlock_t lock;                      /*!< A lock to prevent multiple threads from clobbering the context */
186         struct ast_exten *root;                 /*!< The root of the list of extensions */
187         struct ast_context *next;               /*!< Link them together */
188         struct ast_include *includes;           /*!< Include other contexts */
189         struct ast_ignorepat *ignorepats;       /*!< Patterns for which to continue playing dialtone */
190         const char *registrar;                  /*!< Registrar */
191         AST_LIST_HEAD_NOLOCK(, ast_sw) alts;    /*!< Alternative switches */
192         ast_mutex_t macrolock;                  /*!< A lock to implement "exclusive" macros - held whilst a call is executing in the macro */
193         char name[0];                           /*!< Name of the context */
194 };
195
196
197 /*! \brief ast_app: A registered application */
198 struct ast_app {
199         int (*execute)(struct ast_channel *chan, void *data);
200         const char *synopsis;                   /*!< Synopsis text for 'show applications' */
201         const char *description;                /*!< Description (help text) for 'show application &lt;name&gt;' */
202         AST_RWLIST_ENTRY(ast_app) list;         /*!< Next app in list */
203         struct module *module;                  /*!< Module this app belongs to */
204         char name[0];                           /*!< Name of the application */
205 };
206
207 /*! \brief ast_state_cb: An extension state notify register item */
208 struct ast_state_cb {
209         int id;
210         void *data;
211         ast_state_cb_type callback;
212         struct ast_state_cb *next;
213 };
214
215 /*! \brief Structure for dial plan hints
216
217   \note Hints are pointers from an extension in the dialplan to one or
218   more devices (tech/name) 
219         - See \ref AstExtState
220 */
221 struct ast_hint {
222         struct ast_exten *exten;        /*!< Extension */
223         int laststate;                  /*!< Last known state */
224         struct ast_state_cb *callbacks; /*!< Callback list for this extension */
225         AST_RWLIST_ENTRY(ast_hint) list;/*!< Pointer to next hint in list */
226 };
227
228 struct store_hint {
229         char *context;
230         char *exten;
231         struct ast_state_cb *callbacks;
232         int laststate;
233         AST_LIST_ENTRY(store_hint) list;
234         char data[1];
235 };
236
237 AST_LIST_HEAD(store_hints, store_hint);
238
239 static const struct cfextension_states {
240         int extension_state;
241         const char * const text;
242 } extension_states[] = {
243         { AST_EXTENSION_NOT_INUSE,                     "Idle" },
244         { AST_EXTENSION_INUSE,                         "InUse" },
245         { AST_EXTENSION_BUSY,                          "Busy" },
246         { AST_EXTENSION_UNAVAILABLE,                   "Unavailable" },
247         { AST_EXTENSION_RINGING,                       "Ringing" },
248         { AST_EXTENSION_INUSE | AST_EXTENSION_RINGING, "InUse&Ringing" },
249         { AST_EXTENSION_ONHOLD,                        "Hold" },
250         { AST_EXTENSION_INUSE | AST_EXTENSION_ONHOLD,  "InUse&Hold" }
251 };
252 #define STATUS_NO_CONTEXT       1
253 #define STATUS_NO_EXTENSION     2
254 #define STATUS_NO_PRIORITY      3
255 #define STATUS_NO_LABEL         4
256 #define STATUS_SUCCESS          5
257
258 extern struct ast_context *local_contexts;
259 extern struct ast_context *contexts;
260
261
262 struct ast_custom_function *ast_custom_function_find(const char *name);
263
264
265 struct ast_custom_function *ast_custom_function_find(const char *name)
266 {
267         return 0; /* in "standalone" mode, functions are just not avail */
268 }
269
270
271 struct profile_entry {
272         const char *name;
273         uint64_t        scale;  /* if non-zero, values are scaled by this */
274         int64_t mark;
275         int64_t value;
276         int64_t events;
277 };
278
279 struct profile_data {
280         int entries;
281         int max_size;
282         struct profile_entry e[0];
283 };
284
285 static int bit_at(unsigned int *word, int bitsperword, int bitnum)
286 {
287         return word[bitnum/bitsperword] & (1 << (bitnum % bitsperword));
288 }
289
290 void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *start, int *end)
291 {
292         int i;
293         int thisbit, thatbit = bit_at(word, bitsperword, totalbits-1);
294         
295         for (i=0; i<totalbits; i++) {
296                 thisbit = bit_at(word, bitsperword, i);
297                 
298                 if (thisbit != thatbit ) {
299                         if (thisbit) {
300                                 *start = i;
301                         } else {
302                                 *end = i;
303                         }
304                 }
305                 thatbit = thisbit;
306         }
307 }
308
309 int all_bits_set(unsigned int *word, int bitsperword, int totalbits )
310 {
311         
312         int i, total=totalbits/bitsperword,bitmask = 0;
313         
314         for (i=0; i<bitsperword; i++)
315         {
316                 bitmask |= (1 << i);
317         }
318         
319         for (i=0; i<total; i++)
320         {
321                 if (word[i] != bitmask)
322                         return 0;
323         }
324         return 1;
325 }
326
327
328 int main(int argc, char **argv)
329 {
330         struct ast_context *tmp;
331         struct ast_exten *e, *eroot;
332         pval *tree, *tmptree, *sws;
333         struct ast_include *tmpi;
334         struct ast_sw *sw = 0;
335         struct ast_ignorepat *ipi;
336         pval *incl=0;
337         int localdir = 0, i;
338
339         tree = 0;
340         tmptree = 0;
341
342         /* process the command line args */
343         for (i=1; i<argc; i++)
344         {
345                 if (strcmp(argv[i],"-d")==0)
346                         localdir =1;
347         }
348         
349         /* 3 simple steps: */
350         /*   1. read in the extensions.conf config file 
351          *   2. traverse, and build an AEL tree
352          *   3. Output the AEL tree into a file
353          */
354         printf("WARNING: This is an EXTREMELY preliminary version of a program\n");
355         printf("         that will someday hopefully do a thoughful and intelligent\n");
356         printf("         job of transforming your extensions.conf file into an\n");
357         printf("         extensions.ael file.\n");
358         printf("         This version has absolutely no intelligence, and pretty\n");
359         printf("         much just does a direct conversion\n");
360         printf("         The result will most likely need careful attention to\n");
361         printf("         finish the job!!!!!\n");
362
363         if (!localdir)
364                 printf(" (You could use -d the use the extensions.conf in the current directory!)\n");
365
366         strcpy((char *)ast_config_AST_CONFIG_DIR,"/etc/asterisk");
367         
368         printf("Loading %s/%s...\n", ast_config_AST_CONFIG_DIR, config);
369
370         if (!localdir)
371                 localized_use_conf_dir();
372         localized_pbx_load_module();
373         
374         printf("... Done!\n");
375         
376         tmp = 0;
377         while ((tmp = localized_walk_contexts(tmp)) ) {
378                 printf("Context: %s\n", tmp->name);
379         }
380         printf("=========\n");
381         tmp = 0;
382         while ((tmp = localized_walk_contexts(tmp)) ) {
383                 /* printf("Context: %s\n", tmp->name); */
384                 tmptree = pvalCreateNode(PV_CONTEXT);
385                 if (!tree)
386                         tree = tmptree;
387                 else
388                         pvalTopLevAddObject(tree, tmptree);
389                 
390                 pvalContextSetName(tmptree, ast_strdup(tmp->name));
391                 
392                 if (tmp->includes) {
393                         incl = pvalCreateNode(PV_INCLUDES);
394                         pvalContextAddStatement(tmptree, incl);
395                         for (tmpi = tmp->includes; tmpi; ) { /* includes */
396                                 if (strchr(tmpi->name,'|')==0) {
397                                         if (tmpi->hastime)
398                                         {
399                                                 char timerange[15];
400                                                 char dowrange[10];
401                                                 char domrange[10];
402                                                 char monrange[10];
403                                                 int startbit=0, endbit=0;
404                                                 
405                                                 if (all_bits_set(tmpi->timing.minmask, 30, 720))
406                                                         strcpy(timerange, "*");
407                                                 else {
408                                                         int hr, min;
409                                                         char tbuf[20];
410                                                         get_start_stop(tmpi->timing.minmask, 30, 720, &startbit, &endbit);
411                                                         hr = startbit/30;
412                                                         min = (startbit % 30) * 2;
413                                                         sprintf(tbuf,"%02d:%02d", hr, min);
414                                                         strcpy(timerange, tbuf);
415                                                         hr = endbit/30;
416                                                         min = (endbit % 30) * 2;
417                                                         sprintf(tbuf,"%02d:%02d", hr, min);
418                                                         strcat(timerange,"-");
419                                                         strcat(timerange,tbuf);
420                                                 }
421                                                 
422                                                 if (all_bits_set(&tmpi->timing.dowmask, 7, 7))
423                                                         strcpy(dowrange, "*");
424                                                 else {
425                                                         get_start_stop(&tmpi->timing.dowmask, 7, 7, &startbit, &endbit);
426                                                         strcpy(dowrange, days[startbit]);
427                                                         strcat(dowrange,"-");
428                                                         strcat(dowrange, days[endbit]);
429                                                 }
430                                                 
431                                                 if (all_bits_set(&tmpi->timing.monthmask, 12, 12))
432                                                         strcpy(monrange, "*");
433                                                 else {
434                                                         get_start_stop(&tmpi->timing.monthmask, 12, 12, &startbit, &endbit);
435                                                         strcpy(monrange, months[startbit]);
436                                                         strcat(monrange,"-");
437                                                         strcat(monrange, months[endbit]);
438                                                 }
439                                                 
440                                                 if (all_bits_set(&tmpi->timing.daymask, 31, 31))
441                                                         strcpy(domrange, "*");
442                                                 else {
443                                                         char tbuf[20];
444                                                         get_start_stop(&tmpi->timing.daymask, 31, 31, &startbit, &endbit);
445                                                         sprintf(tbuf,"%d", startbit);
446                                                         strcpy(domrange, tbuf);
447                                                         strcat(domrange,"-");
448                                                         sprintf(tbuf,"%d", endbit);
449                                                         strcat(domrange, tbuf);
450                                                 }
451                                                 /* now all 4 fields are set; what do we do? */
452                                                 pvalIncludesAddIncludeWithTimeConstraints(incl, strdup(tmpi->name), strdup(timerange), strdup(domrange), strdup(dowrange), strdup(monrange));
453                                                 
454                                         } else {
455                                                 pvalIncludesAddInclude(incl, strdup(tmpi->name));
456                                         }
457                                 } else { /* it appears the timing constraint info is tacked onto the name, carve it up and divvy it out */
458                                         char *dow,*dom,*mon;
459                                         char *all = strdup(tmpi->name);
460                                         char *hr = strchr(all,'|');
461                                         if (hr) {
462                                                 *hr++ = 0;
463                                                 dow = strchr(hr,'|');
464                                                 if (dow) {
465                                                         *dow++ = 0;
466                                                         dom = strchr(dow,'|');
467                                                         if (dom) {
468                                                                 *dom++ = 0;
469                                                                 mon = strchr(dom,'|');
470                                                                 if (mon) {
471                                                                         *mon++ = 0;
472                                                                         /* now all 4 fields are set; what do we do? */
473                                                                         pvalIncludesAddIncludeWithTimeConstraints(incl, all, hr, dow, dom, mon);
474                                                                         /* the original data is always best to keep (no 2-min rounding) */
475                                                                 } else {
476                                                                         ast_log(LOG_ERROR,"No month spec attached to include!\n");
477                                                                 }
478                                                         } else {
479                                                                 ast_log(LOG_ERROR,"No day of month spec attached to include!\n");
480                                                         }
481                                                 } else {
482                                                         ast_log(LOG_ERROR,"No day of week spec attached to include!\n");
483                                                 }
484                                         }
485                                 }
486                                 tmpi = tmpi->next;
487                         }
488                 }
489                 for (ipi = tmp->ignorepats; ipi; ) { /* ignorepats */
490                         incl = pvalCreateNode(PV_IGNOREPAT);
491                         pvalIgnorePatSetPattern(incl,(char *)ipi->pattern);
492                         pvalContextAddStatement(tmptree, incl);
493                         ipi = ipi->next;
494                 }
495                 eroot=0;
496                 while ( (eroot = localized_walk_context_extensions(tmp, eroot)) ) {
497                         pval *exten = pvalCreateNode(PV_EXTENSION);
498                         pvalContextAddStatement(tmptree, exten);
499                         pvalExtenSetName(exten, ast_strdup(eroot->exten));
500                 
501                         if (eroot->peer) {
502                                 pval *block = pvalCreateNode(PV_STATEMENTBLOCK);
503                                 pvalExtenSetStatement(exten, block);
504                                 
505                                 e = 0;
506                                 while ( (e = localized_walk_extension_priorities(eroot, e)) ) {
507                                         
508                                         pval *statemnt = pvalCreateNode(PV_APPLICATION_CALL);
509                                         pval *args = pvalCreateNode(PV_WORD);
510                                         
511                                         /* printf("           %s(%s)\n", e->app, (char*)e->data); */
512
513                                         pvalAppCallSetAppName(statemnt, ast_strdup(e->app));
514                                         pvalWordSetString(args, ast_strdup(e->data));
515                                         pvalAppCallAddArg(statemnt, args);
516                                         
517                                         pvalStatementBlockAddStatement(block, statemnt);
518                                 }
519                         } else if (eroot->priority == -1) {
520
521                                 pval *statemnt = pvalCreateNode(PV_APPLICATION_CALL);
522                                 pval *args = pvalCreateNode(PV_WORD);
523
524                                 /* printf("Mike, we have a hint on exten %s with data %s\n", eroot->exten, eroot->app); */
525
526                                 pvalAppCallSetAppName(statemnt, "NoOp");
527                                 pvalWordSetString(args, ast_strdup(eroot->app));
528
529
530                                 pvalExtenSetStatement(exten, statemnt);
531                                 pvalExtenSetHints(exten, ast_strdup(eroot->app));
532                         } else {
533
534                                 pval *statemnt = pvalCreateNode(PV_APPLICATION_CALL);
535                                 pval *args = pvalCreateNode(PV_WORD);
536         
537                                 /* printf("           %s (%s)\n", eroot->app, (char *)eroot->data); */
538                                 
539                                 pvalAppCallSetAppName(statemnt, ast_strdup(eroot->app));
540                                 pvalWordSetString(args, ast_strdup(eroot->data));
541
542                                 
543                                 pvalAppCallAddArg(statemnt, args);
544                                 pvalExtenSetStatement(exten, statemnt);
545                         }
546
547                         /* printf("   extension: %s\n", eroot->exten); */
548                 }
549                 if (AST_LIST_FIRST(&tmp->alts)) {
550                         sws = pvalCreateNode(PV_SWITCHES);
551                         pvalContextAddStatement(tmptree,sws);
552                         
553                         sw = 0;
554                         while ((sw = localized_walk_context_switches(tmp,sw)) ) {
555                                 pvalSwitchesAddSwitch(sws, ast_strdup(sw->name));
556                         }
557                 }
558         }
559         printf("Generating aelout.ael file...\n");
560         
561         ael2_print("aelout.ael", tree);
562         
563         printf("...Done!\n");
564         return 0;
565 }
566
567
568 /* ==================================== for linking internal stuff to external stuff */
569
570 int pbx_builtin_setvar(struct ast_channel *chan, void *data)
571 {
572         return localized_pbx_builtin_setvar(chan, data);
573 }
574
575 void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count);
576 void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count)
577 {
578         if (cp1 && *cp1)
579                 strncpy(cp2,cp1,AST_MAX_EXTENSION); /* Right now, this routine is ONLY being called for 
580                                                                                            a possible var substitution on extension names,
581                                                                                            so....! */
582         else
583                 *cp2 = 0;
584 }
585
586 int ast_add_extension2(struct ast_context *con,
587                                            int replace, const char *extension, int priority, const char *label, const char *callerid,
588                                            const char *application, void *data, void (*datad)(void *),
589                                            const char *registrar)
590 {
591         return localized_add_extension2(con, replace, extension, priority, label, callerid, application, data, datad, registrar);
592 }
593
594 int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
595 {
596         
597         return localized_context_add_ignorepat2(con, value, registrar);
598 }
599
600 int ast_context_add_switch2(struct ast_context *con, const char *value,
601                                                                  const char *data, int eval, const char *registrar)
602 {
603         
604         return localized_context_add_switch2(con, value, data, eval, registrar);
605 }
606
607 int ast_context_add_include2(struct ast_context *con, const char *value,
608                                                                   const char *registrar)
609 {
610         
611         return localized_context_add_include2(con, value,registrar);
612 }
613
614 struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
615 {
616         printf("Creating context %s, registrar=%s\n", name, registrar);
617         
618         return localized_context_create(extcontexts, name, registrar);
619 }
620
621 struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, const char *name, const char *registrar)
622 {
623         printf("find/Creating context %s, registrar=%s\n", name, registrar);
624         
625         return localized_context_create(extcontexts, name, registrar);
626 }
627
628 void ast_cli_register_multiple(void);
629
630 void ast_cli_register_multiple(void)
631 {
632 }
633
634 void ast_module_register(const struct ast_module_info *x)
635 {
636 }
637
638 void ast_module_unregister(const struct ast_module_info *x)
639 {
640 }
641
642 void ast_cli_unregister_multiple(void);
643
644 void ast_cli_unregister_multiple(void)
645 {
646 }
647
648 struct ast_context *ast_walk_contexts(struct ast_context *con);
649 struct ast_context *ast_walk_contexts(struct ast_context *con)
650 {
651         return localized_walk_contexts(con);
652 }
653
654 void ast_context_destroy(struct ast_context *con, const char *registrar);
655
656 void ast_context_destroy(struct ast_context *con, const char *registrar)
657 {
658         return localized_context_destroy(con, registrar);
659 }
660
661 int ast_context_verify_includes(struct ast_context *con);
662
663 int ast_context_verify_includes(struct ast_context *con)
664 {
665         return  localized_context_verify_includes(con);
666 }
667
668 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
669
670 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar)
671 {
672         localized_merge_contexts_and_delete(extcontexts, registrar);
673 }
674
675 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
676                                                                          struct ast_context *bypass,
677                                                                          struct pbx_find_info *q,
678                                                                          const char *context, 
679                                                                          const char *exten, 
680                                                                          int priority,
681                                                                          const char *label, 
682                                                                          const char *callerid, 
683                                                                          enum ext_match_t action);
684
685 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
686                                                                          struct ast_context *bypass,
687                                                                          struct pbx_find_info *q,
688                                                                          const char *context, 
689                                                                          const char *exten, 
690                                                                          int priority,
691                                                                          const char *label, 
692                                                                          const char *callerid, 
693                                                                          enum ext_match_t action)
694 {
695         return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
696 }
697