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