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