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