conf2ael.c 21 KB

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