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