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