d2251a41ee16bf585e4fa8239074d3b352678ab5
[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 void ast_register_file_version(const char *file, const char *version)
83 {
84 }
85
86 void ast_unregister_file_version(const char *file);
87 void ast_unregister_file_version(const char *file)
88 {
89 }
90 #if !defined(LOW_MEMORY)
91 int ast_add_profile(const char *x, uint64_t scale) { return 0;}
92 #endif
93 /* Our own version of ast_log, since the expr parser uses it. -- stolen from utils/check_expr.c */
94 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
95
96 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
97 {
98         va_list vars;
99         va_start(vars,fmt);
100         
101         printf("LOG: lev:%d file:%s  line:%d func: %s  ",
102                    level, file, line, function);
103         vprintf(fmt, vars);
104         fflush(stdout);
105         va_end(vars);
106 }
107
108 /* stolen from pbx.c */
109 struct ast_context;
110 struct ast_app;
111 #ifdef LOW_MEMORY
112 #define EXT_DATA_SIZE 256
113 #else
114 #define EXT_DATA_SIZE 8192
115 #endif
116
117 #define SWITCH_DATA_LENGTH 256
118
119 #define VAR_BUF_SIZE 4096
120
121 #define VAR_NORMAL              1
122 #define VAR_SOFTTRAN    2
123 #define VAR_HARDTRAN    3
124
125 #define BACKGROUND_SKIP         (1 << 0)
126 #define BACKGROUND_NOANSWER     (1 << 1)
127 #define BACKGROUND_MATCHEXTEN   (1 << 2)
128 #define BACKGROUND_PLAYBACK     (1 << 3)
129
130 /*!
131    \brief ast_exten: An extension
132         The dialplan is saved as a linked list with each context
133         having it's own linked list of extensions - one item per
134         priority.
135 */
136 struct ast_exten {
137         char *exten;                    /*!< Extension name */
138         int matchcid;                   /*!< Match caller id ? */
139         const char *cidmatch;           /*!< Caller id to match for this extension */
140         int priority;                   /*!< Priority */
141         const char *label;              /*!< Label */
142         struct ast_context *parent;     /*!< The context this extension belongs to  */
143         const char *app;                /*!< Application to execute */
144         struct ast_app *cached_app;     /*!< Cached location of application */
145         void *data;                     /*!< Data to use (arguments) */
146         void (*datad)(void *);          /*!< Data destructor */
147         struct ast_exten *peer;         /*!< Next higher priority with our extension */
148         const char *registrar;          /*!< Registrar */
149         struct ast_exten *next;         /*!< Extension with a greater ID */
150         char stuff[0];
151 };
152
153
154 /*! \brief ast_include: include= support in extensions.conf */
155 struct ast_include {
156         const char *name;
157         const char *rname;                      /*!< Context to include */
158         const char *registrar;                  /*!< Registrar */
159         int hastime;                            /*!< If time construct exists */
160         struct ast_timing timing;               /*!< time construct */
161         struct ast_include *next;               /*!< Link them together */
162         char stuff[0];
163 };
164
165 /*! \brief ast_sw: Switch statement in extensions.conf */
166 struct ast_sw {
167         char *name;
168         const char *registrar;                  /*!< Registrar */
169         char *data;                             /*!< Data load */
170         int eval;
171         AST_LIST_ENTRY(ast_sw) list;
172         char *tmpdata;
173         char stuff[0];
174 };
175
176 /*! \brief ast_ignorepat: Ignore patterns in dial plan */
177 struct ast_ignorepat {
178         const char *registrar;
179         struct ast_ignorepat *next;
180         const char pattern[0];
181 };
182
183 /*! \brief ast_context: An extension context */
184 struct ast_context {
185         ast_rwlock_t lock;                      /*!< A lock to prevent multiple threads from clobbering the context */
186         struct ast_exten *root;                 /*!< The root of the list of extensions */
187         struct ast_context *next;               /*!< Link them together */
188         struct ast_include *includes;           /*!< Include other contexts */
189         struct ast_ignorepat *ignorepats;       /*!< Patterns for which to continue playing dialtone */
190         const char *registrar;                  /*!< Registrar */
191         AST_LIST_HEAD_NOLOCK(, ast_sw) alts;    /*!< Alternative switches */
192         ast_mutex_t macrolock;                  /*!< A lock to implement "exclusive" macros - held whilst a call is executing in the macro */
193         char name[0];                           /*!< Name of the context */
194 };
195
196
197 /*! \brief ast_app: A registered application */
198 struct ast_app {
199         int (*execute)(struct ast_channel *chan, void *data);
200         const char *synopsis;                   /*!< Synopsis text for 'show applications' */
201         const char *description;                /*!< Description (help text) for 'show application &lt;name&gt;' */
202         AST_RWLIST_ENTRY(ast_app) list;         /*!< Next app in list */
203         struct module *module;                  /*!< Module this app belongs to */
204         char name[0];                           /*!< Name of the application */
205 };
206
207 /*! \brief ast_state_cb: An extension state notify register item */
208 struct ast_state_cb {
209         int id;
210         void *data;
211         ast_state_cb_type callback;
212         struct ast_state_cb *next;
213 };
214
215 /*! \brief Structure for dial plan hints
216
217   \note Hints are pointers from an extension in the dialplan to one or
218   more devices (tech/name) 
219         - See \ref AstExtState
220 */
221 struct ast_hint {
222         struct ast_exten *exten;        /*!< Extension */
223         int laststate;                  /*!< Last known state */
224         struct ast_state_cb *callbacks; /*!< Callback list for this extension */
225         AST_RWLIST_ENTRY(ast_hint) list;/*!< Pointer to next hint in list */
226 };
227
228 struct store_hint {
229         char *context;
230         char *exten;
231         struct ast_state_cb *callbacks;
232         int laststate;
233         AST_LIST_ENTRY(store_hint) list;
234         char data[1];
235 };
236
237 AST_LIST_HEAD(store_hints, store_hint);
238
239 static const struct cfextension_states {
240         int extension_state;
241         const char * const text;
242 } extension_states[] = {
243         { AST_EXTENSION_NOT_INUSE,                     "Idle" },
244         { AST_EXTENSION_INUSE,                         "InUse" },
245         { AST_EXTENSION_BUSY,                          "Busy" },
246         { AST_EXTENSION_UNAVAILABLE,                   "Unavailable" },
247         { AST_EXTENSION_RINGING,                       "Ringing" },
248         { AST_EXTENSION_INUSE | AST_EXTENSION_RINGING, "InUse&Ringing" },
249         { AST_EXTENSION_ONHOLD,                        "Hold" },
250         { AST_EXTENSION_INUSE | AST_EXTENSION_ONHOLD,  "InUse&Hold" }
251 };
252 #define STATUS_NO_CONTEXT       1
253 #define STATUS_NO_EXTENSION     2
254 #define STATUS_NO_PRIORITY      3
255 #define STATUS_NO_LABEL         4
256 #define STATUS_SUCCESS          5
257
258 extern struct ast_context *local_contexts;
259 extern struct ast_context *contexts;
260
261
262 struct ast_custom_function *ast_custom_function_find(const char *name);
263
264
265 struct ast_custom_function *ast_custom_function_find(const char *name)
266 {
267         return 0; /* in "standalone" mode, functions are just not avail */
268 }
269
270
271 struct profile_entry {
272         const char *name;
273         uint64_t        scale;  /* if non-zero, values are scaled by this */
274         int64_t mark;
275         int64_t value;
276         int64_t events;
277 };
278
279 struct profile_data {
280         int entries;
281         int max_size;
282         struct profile_entry e[0];
283 };
284
285 static int bit_at(unsigned int *word, int bitsperword, int bitnum)
286 {
287         return word[bitnum/bitsperword] & (1 << (bitnum % bitsperword));
288 }
289
290 void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *start, int *end)
291 {
292         int i;
293         int thisbit, thatbit = bit_at(word, bitsperword, totalbits-1);
294         
295         for (i=0; i<totalbits; i++) {
296                 thisbit = bit_at(word, bitsperword, i);
297                 
298                 if (thisbit != thatbit ) {
299                         if (thisbit) {
300                                 *start = i;
301                         } else {
302                                 *end = i;
303                         }
304                 }
305                 thatbit = thisbit;
306         }
307 }
308
309 int all_bits_set(unsigned int *word, int bitsperword, int totalbits )
310 {
311         
312         int i, total=totalbits/bitsperword,bitmask = 0;
313         
314         for (i=0; i<bitsperword; i++)
315         {
316                 bitmask |= (1 << i);
317         }
318         
319         for (i=0; i<total; i++)
320         {
321                 if (word[i] != bitmask)
322                         return 0;
323         }
324         return 1;
325 }
326
327
328 int main(int argc, char **argv)
329 {
330         struct ast_context *tmp;
331         struct ast_exten *e, *eroot;
332         pval *tree, *tmptree, *sws;
333         struct ast_include *tmpi;
334         struct ast_sw *sw = 0;
335         struct ast_ignorepat *ipi;
336         pval *incl=0;
337         int localdir = 0, i;
338
339         tree = 0;
340         tmptree = 0;
341
342         /* process the command line args */
343         for (i=1; i<argc; i++)
344         {
345                 if (strcmp(argv[i],"-d")==0)
346                         localdir =1;
347         }
348         
349         /* 3 simple steps: */
350         /*   1. read in the extensions.conf config file 
351          *   2. traverse, and build an AEL tree
352          *   3. Output the AEL tree into a file
353          */
354         printf("WARNING: This is an EXTREMELY preliminary version of a program\n");
355         printf("         that will someday hopefully do a thoughful and intelligent\n");
356         printf("         job of transforming your extensions.conf file into an\n");
357         printf("         extensions.ael file.\n");
358         printf("         This version has absolutely no intelligence, and pretty\n");
359         printf("         much just does a direct conversion\n");
360         printf("         The result will most likely need careful attention to\n");
361         printf("         finish the job!!!!!\n");
362
363         if (!localdir)
364                 printf(" (You could use -d the use the extensions.conf in the current directory!)\n");
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_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
613 {
614         printf("find/Creating context %s, registrar=%s\n", name, registrar);
615         
616         return localized_context_find_or_create(extcontexts, exttable, name, registrar);
617 }
618
619 void ast_cli_register_multiple(void);
620
621 void ast_cli_register_multiple(void)
622 {
623 }
624
625 void ast_module_register(const struct ast_module_info *x)
626 {
627 }
628
629 void ast_module_unregister(const struct ast_module_info *x)
630 {
631 }
632
633 void ast_cli_unregister_multiple(void);
634
635 void ast_cli_unregister_multiple(void)
636 {
637 }
638
639 struct ast_context *ast_walk_contexts(struct ast_context *con);
640 struct ast_context *ast_walk_contexts(struct ast_context *con)
641 {
642         return localized_walk_contexts(con);
643 }
644
645 void ast_context_destroy(struct ast_context *con, const char *registrar);
646
647 void ast_context_destroy(struct ast_context *con, const char *registrar)
648 {
649         return localized_context_destroy(con, registrar);
650 }
651
652 int ast_context_verify_includes(struct ast_context *con);
653
654 int ast_context_verify_includes(struct ast_context *con)
655 {
656         return  localized_context_verify_includes(con);
657 }
658
659 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar);
660
661 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
662 {
663         localized_merge_contexts_and_delete(extcontexts, exttable, registrar);
664 }
665
666 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
667                                                                          struct ast_context *bypass,
668                                                                          struct pbx_find_info *q,
669                                                                          const char *context, 
670                                                                          const char *exten, 
671                                                                          int priority,
672                                                                          const char *label, 
673                                                                          const char *callerid, 
674                                                                          enum ext_match_t action);
675
676 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
677                                                                          struct ast_context *bypass,
678                                                                          struct pbx_find_info *q,
679                                                                          const char *context, 
680                                                                          const char *exten, 
681                                                                          int priority,
682                                                                          const char *label, 
683                                                                          const char *callerid, 
684                                                                          enum ext_match_t action)
685 {
686         return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
687 }
688
689 int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);
690
691 int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
692 {
693         return 0;
694 }
695
696 unsigned int ast_hashtab_hash_contexts(const void *obj);
697
698 unsigned int ast_hashtab_hash_contexts(const void *obj)
699 {
700         return 0;
701 }
702
703 #ifdef DEBUG_THREADS
704 #if !defined(LOW_MEMORY)
705 void ast_mark_lock_acquired(void *lock_addr)
706 {
707 }
708 #ifdef HAVE_BKTR
709 void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt)
710 {
711 }
712
713 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
714         int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt)
715 {
716 }
717
718 int ast_bt_get_addresses(struct ast_bt *bt)
719 {
720         return 0;
721 }
722
723 #else
724 void ast_remove_lock_info(void *lock_addr)
725 {
726 }
727
728 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
729         int line_num, const char *func, const char *lock_name, void *lock_addr)
730 {
731 }
732 #endif /* HAVE_BKTR */
733 #endif /* !defined(LOW_MEMORY) */
734 #endif /* DEBUG_THREADS */