45 static const char config[] =
"extensions.conf";
83 e->
command =
"dialplan remove include";
85 "Usage: dialplan remove include <context> from <context>\n"
86 " Remove an included context from another context.\n";
92 if (a->
argc != 6 || strcmp(a->
argv[4],
"from"))
96 ast_cli(a->
fd,
"We are not including '%s' into '%s' now\n",
101 ast_cli(a->
fd,
"Failed to remove '%s' include from '%s' context\n",
138 for (;n && *p; p++) {
139 if (isblank(*p) && !in_blank) {
142 }
else if ( in_blank) {
152 return (len == 0 || !strncmp(s, word, len));
158 static int split_ec(
const char *src,
char **
ext,
char **
const ctx,
char **
const cid)
172 if (strchr(c,
'@')) {
177 if (cid && (i = strchr(e,
'/'))) {
210 int already_served = 0;
223 if (!already_served && ++which > a->
n)
231 }
else if (a->
pos == 4) {
241 context = dupline =
strdup(s);
263 }
else if (a->
pos == 5) {
267 char *
context, *dupline, *from;
269 context = dupline =
strdup(s);
278 from =
strsep(&dupline,
" ");
279 if (!from || strcmp(from,
"from")) {
313 int removing_priority = 0;
319 e->
command =
"dialplan remove extension";
321 "Usage: dialplan remove extension exten[/cid]@context [priority]\n"
322 " Remove an extension from a given context. If a priority\n"
323 " is given, only that specific priority from the given extension\n"
324 " will be removed.\n";
337 const char *c = a->
argv[4];
343 if (!strcmp(
"hint", c))
346 while (*c && isdigit(*c))
352 removing_priority = atoi(a->
argv[4]);
355 if (removing_priority == 0) {
356 ast_cli(a->
fd,
"If you want to remove whole extension, please " \
357 "omit priority argument\n");
368 if ((!strlen(exten)) || (!(strlen(context)))) {
369 ast_cli(a->
fd,
"Missing extension or context name in third argument '%s'\n",
377 cid ? cid : (removing_priority ?
"" : NULL), cid ? 1 : 0, registrar)) {
378 if (!removing_priority)
379 ast_cli(a->
fd,
"Whole extension %s@%s removed\n",
382 ast_cli(a->
fd,
"Extension %s@%s with priority %d removed\n",
383 exten, context, removing_priority);
388 ast_cli(a->
fd,
"Failed to remove extension %s/%s@%s\n", exten, cid, context);
390 ast_cli(a->
fd,
"Failed to remove extension %s@%s\n", exten, context);
415 lc = strlen(context);
416 lcid = cid ? strlen(cid) : -1;
430 if ( !strchr(a->
word,
'/') ||
435 if (++which > a->
n) {
459 }
else if (a->
pos == 4) {
464 int i =
split_ec(s, &exten, &context, &cid);
468 if ( (p = strchr(exten,
' ')) )
470 if ( (p = strchr(context,
' ')) )
473 lc = strlen(context);
474 len = strlen(a->
word);
475 if (le == 0 || lc == 0)
526 e->
command =
"dialplan add include";
528 "Usage: dialplan add include <context> into <context>\n"
529 " Include a context in another context.\n";
539 if (strcmp(a->
argv[4],
"into"))
545 ast_cli(a->
fd,
"Out of memory for context addition\n");
549 ast_cli(a->
fd,
"Failed to lock context(s) list, please try again later\n");
553 ast_cli(a->
fd,
"Context '%s' already included in '%s' context\n",
559 ast_cli(a->
fd,
"There is no existence of context '%s'\n",
564 ast_cli(a->
fd,
"Failed to include '%s' in '%s' context\n",
572 ast_cli(a->
fd,
"Context '%s' included in '%s' context\n",
595 }
else if (a->
pos == 4) {
604 context = dupline =
strdup(s);
625 }
else if (a->
pos == 5) {
626 char *
context, *dupline, *into;
628 context = dupline =
strdup(s);
634 into =
strsep(&dupline,
" ");
636 if (!strlen(context) || strcmp(into,
"into")) {
684 const char *base, *slash;
690 "Usage: dialplan save [/path/to/extension/file]\n"
691 " Save dialplan created by pbx_config module.\n"
693 "Example: dialplan save (/etc/asterisk/extensions.conf)\n"
694 " dialplan save /home/markster (/home/markster/extensions.conf)\n";
700 if (! (static_config && !write_protect_config)) {
702 "I can't save dialplan now, see '%s' example file.\n",
712 "Failed to lock dialplan saving (another proccess saving?)\n");
720 if (!strstr(a->
argv[2],
".conf")) {
722 slash = (*(a->
argv[2] + strlen(a->
argv[2]) -1) ==
'/') ?
"/" :
"";
731 snprintf(filename,
sizeof(filename),
"%s%s%s", base, slash, config);
735 ast_cli(a->
fd,
"Failed to load extensions.conf\n");
742 ast_cli(a->
fd,
"Failed to lock contexts list\n");
749 if (!(output = fopen(filename,
"wt"))) {
750 ast_cli(a->
fd,
"Failed to create file '%s'\n",
759 if (overrideswitch_config) {
760 snprintf(overrideswitch,
sizeof(overrideswitch),
"overrideswitch=%s\n", overrideswitch_config);
762 fprintf(output,
"[general]\nstatic=%s\nwriteprotect=%s\nautofallthrough=%s\nclearglobalvars=%s\n%sextenpatternmatchnew=%s\n\n",
763 static_config ?
"yes" :
"no",
764 write_protect_config ?
"yes" :
"no",
765 autofallthrough_config ?
"yes" :
"no",
766 clearglobalvars_config ?
"yes" :
"no",
767 overrideswitch_config ? overrideswitch :
"",
768 extenpatternmatchnew_config ?
"yes" :
"no");
771 fprintf(output,
"[globals]\n");
773 fprintf(output,
"%s => %s\n", v->
name, v->
value);
776 fprintf(output,
"\n");
781 #define PUT_CTX_HDR do { \
782 if (!context_header_written) { \
783 fprintf(output, "[%s]\n", ast_get_context_name(c)); \
784 context_header_written = 1; \
790 int context_header_written = 0;
805 context_header_written = 1;
818 if (last_written_e != NULL &&
821 fprintf(output,
"\n");
827 fprintf(output,
"exten => %s,hint,%s\n",
831 const char *sep, *cid;
833 char label[128] =
"";
841 if (el && (snprintf(label,
sizeof(label),
"(%s)", el) != (strlen(el) + 2)))
844 fprintf(output,
"exten => %s%s%s,%d%s,%s(%s)\n",
854 fprintf(output,
"\n");
864 fprintf(output,
"\n");
871 fprintf(output,
"switch => %s/%s\n",
876 fprintf(output,
"\n");
883 fprintf(output,
"ignorepat => %s\n",
895 ast_cli(a->
fd,
"Saved dialplan is incomplete\n");
899 ast_cli(a->
fd,
"Dialplan successfully saved into '%s'\n",
917 e->
command =
"dialplan add extension";
919 "Usage: dialplan add extension <exten>,<priority>,<app> into <context> [replace]\n"
921 " app can be either:\n"
923 " app-name(app-data)\n"
924 " app-name,<app-data>\n"
926 " This command will add the new extension into <context>. If\n"
927 " an extension with the same priority already exists and the\n"
928 " 'replace' option is given we will replace the extension.\n"
930 "Example: dialplan add extension 6123,1,Dial,IAX/216.207.245.56/6123 into local\n"
931 " Now, you can dial 6123 and talk to Markster :)\n";
940 if (strcmp(a->
argv[4],
"into"))
943 if (strcmp(a->
argv[6],
"replace"))
947 exten =
strsep(&whole_exten,
",");
948 if (strchr(exten,
'/')) {
954 prior =
strsep(&whole_exten,
",");
956 if (!strcmp(prior,
"hint")) {
959 if (sscanf(prior,
"%30d", &iprior) != 1) {
960 ast_cli(a->
fd,
"'%s' is not a valid priority\n", prior);
967 if ((start = strchr(app,
'(')) && (end = strrchr(app,
')'))) {
968 *start = *end =
'\0';
969 app_data = start + 1;
971 app_data = strchr(app,
',');
980 if (!exten || !prior || !app) {
994 ast_cli(a->
fd,
"Failed to lock context(s) list, please try again later\n");
998 ast_cli(a->
fd,
"No existence of '%s' context\n", a->
argv[5]);
1002 ast_cli(a->
fd,
"Extension %s@%s with priority %s already exists\n",
1003 exten, a->
argv[5], prior);
1007 ast_cli(a->
fd,
"Failed to add '%s,%s,%s(%s)' extension into '%s' context\n",
1008 exten, prior, app, app_data, a->
argv[5]);
1015 ast_cli(a->
fd,
"Extension %s@%s (%s) replace by '%s,%s,%s(%s)'\n",
1016 exten, a->
argv[5], prior, exten, prior, app, app_data);
1018 ast_cli(a->
fd,
"Extension '%s,%s,%s(%s)' added into '%s' context\n",
1019 exten, prior, app, app_data, a->
argv[5]);
1031 return (a->
n == 0) ?
strdup(
"into") : NULL;
1032 }
else if (a->
pos == 5) {
1049 }
else if (a->
pos == 6) {
1050 return a->
n == 0 ?
strdup(
"replace") : NULL;
1062 e->
command =
"dialplan add ignorepat";
1064 "Usage: dialplan add ignorepat <pattern> into <context>\n"
1065 " This command adds a new ignore pattern into context <context>\n"
1067 "Example: dialplan add ignorepat _3XX into local\n";
1076 if (strcmp(a->
argv[4],
"into"))
1086 ast_cli(a->
fd,
"There is no existence of '%s' context\n", a->
argv[5]);
1090 ast_cli(a->
fd,
"Ignore pattern '%s' already included in '%s' context\n",
1095 ast_cli(a->
fd,
"Failed to lock context(s) list, please, try again later\n");
1099 ast_cli(a->
fd,
"Failed to add ingore pattern '%s' into '%s' context\n",
1106 ast_cli(a->
fd,
"Ignore pattern '%s' added into '%s' context\n",
1115 return a->
n == 0 ?
strdup(
"into") : NULL;
1116 else if (a->
pos == 5) {
1119 char *dupline, *ignorepat = NULL;
1133 ignorepat =
strsep(&dupline,
" ");
1147 if (!found && ++which > a->
n)
1163 e->
command =
"dialplan remove ignorepat";
1165 "Usage: dialplan remove ignorepat <pattern> from <context>\n"
1166 " This command removes an ignore pattern from context <context>\n"
1168 "Example: dialplan remove ignorepat _3XX from local\n";
1177 if (strcmp(a->
argv[4],
"from"))
1183 ast_cli(a->
fd,
"Failed to lock context(s) list, please try again later\n");
1187 ast_cli(a->
fd,
"There is no existence of '%s' context\n", a->
argv[5]);
1191 ast_cli(a->
fd,
"There is no existence of '%s' ignore pattern in '%s' context\n",
1196 ast_cli(a->
fd,
"Failed to remove ignore pattern '%s' from '%s' context\n",
1203 ast_cli(a->
fd,
"Ignore pattern '%s' removed from '%s' context\n",
1244 }
else if (a->
pos == 4) {
1245 return a->
n == 0 ?
strdup(
"from") : NULL;
1246 }
else if (a->
pos == 5) {
1247 char *dupline, *duplinet, *ignorepat;
1259 ignorepat =
strsep(&duplinet,
" ");
1295 e->
command =
"dialplan reload";
1297 "Usage: dialplan reload\n"
1298 " Reload extensions.conf without reloading any other\n"
1299 " modules. This command does not delete global variables\n"
1300 " unless clearglobalvars is set to yes in extensions.conf\n";
1309 if (clearglobalvars_config)
1339 if (static_config && !write_protect_config)
1341 if (overrideswitch_config) {
1359 if (!destructible || !*destructible) {
1362 res = *destructible;
1363 for (; **destructible; (*destructible)++) {
1364 if (**destructible ==
'[' && !strchr(delim,
'[')) {
1366 }
else if (**destructible ==
']' && !strchr(delim,
']')) {
1370 }
else if (**destructible ==
'\\' && !strchr(delim,
'\\')) {
1372 }
else if (strchr(delim, **destructible) && !square) {
1373 **destructible =
'\0';
1378 if (**destructible ==
'\0') {
1379 *destructible = NULL;
1390 char realvalue[256];
1392 char realvalue[8192];
1399 const char *newpm, *ovsw;
1401 char lastextension[256];
1410 autofallthrough_config =
ast_true(aft);
1412 extenpatternmatchnew_config =
ast_true(newpm);
1415 if (overrideswitch_config) {
1421 overrideswitch_config = NULL;
1435 if (!strcasecmp(cxt,
"general") || !strcasecmp(cxt,
"globals")) {
1443 lastextension[0] =
'\0';
1448 char realext[256] =
"";
1449 char *stringp, *
ext;
1453 vfile = !*v->
file ? config_file : v->
file;
1455 if (!strncasecmp(v->
name,
"same", 4)) {
1458 "No previous pattern in the first entry of context '%s' to match '%s' at line %d of %s!\n",
1464 goto process_extension;
1466 }
else if (!strcasecmp(v->
name,
"exten")) {
1469 char *pri, *appl, *data, *cidmatch;
1480 if ((cidmatch = strchr(realext,
'/'))) {
1485 if ((label = strchr(pri,
'('))) {
1487 if ((end = strchr(label,
')'))) {
1491 "Label missing trailing ')' at line %d of %s\n",
1497 if ((plus = strchr(pri,
'+'))) {
1500 if (!strcmp(pri,
"hint")) {
1502 }
else if (!strcmp(pri,
"next") || !strcmp(pri,
"n")) {
1507 "Can't use 'next' priority on the first entry at line %d of %s!\n",
1512 }
else if (!strcmp(pri,
"same") || !strcmp(pri,
"s")) {
1517 "Can't use 'same' priority on the first entry at line %d of %s!\n",
1522 }
else if (sscanf(pri,
"%30d", &ipri) != 1 &&
1525 "Invalid priority/label '%s' at line %d of %s\n",
1530 }
else if (ipri < 1) {
1536 appl =
S_OR(stringp,
"");
1538 if (!strchr(appl,
'(')) {
1549 appl =
strsep(&stringp,
"(");
1552 if (strstr(appl,
"${") || strstr(appl,
"$[")){
1554 strcpy(appl, orig_appl);
1559 data =
S_OR(stringp,
"");
1560 if ((end = strrchr(data,
')'))) {
1564 "No closing parenthesis found? '%s(%s' at line %d of %s\n",
1565 appl, data, v->
lineno, vfile);
1579 "The use of '%s' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X%c' instead at line %d of %s\n",
1580 realext, realext[1], v->
lineno, vfile);
1584 "Unable to register extension at line %d of %s\n",
1589 }
else if (!strcasecmp(v->
name,
"include")) {
1603 "Context '%s' already included in '%s' context on include at line %d of %s\n",
1610 "There is no existence of context '%s' included at line %d of %s\n",
1616 "Failed to include '%s' in '%s' context at line %d of %s\n",
1621 }
else if (!strcasecmp(v->
name,
"ignorepat")) {
1625 "Unable to include ignorepat '%s' in context '%s' at line %d of %s\n",
1628 }
else if (!strcasecmp(v->
name,
"switch") || !strcasecmp(v->
name,
"lswitch") || !strcasecmp(v->
name,
"eswitch")) {
1629 char *stringp = realvalue;
1632 if (!strcasecmp(v->
name,
"switch")) {
1637 appl =
strsep(&stringp,
"/");
1638 data =
S_OR(stringp,
"");
1641 "Unable to include switch '%s' in context '%s' at line %d of %s\n",
1646 "==!!== Unknown directive: %s at line %d of %s -- IGNORING!!!\n",
1657 int len = strlen(iface);
1658 if (strlen(add) + len < maxlen - 2) {
1659 if (strlen(iface)) {
1661 strcpy(iface + len + 1, add);
1671 const char *dahdichan;
1672 const char *hasexten, *altexts;
1675 char dahdicopy[256];
1676 char *
ext, altcopy[256];
1679 int start, finish, x;
1688 if (!strcasecmp(cat,
"general"))
1692 snprintf(tmp,
sizeof(tmp),
"SIP/%s", cat);
1696 snprintf(tmp,
sizeof(tmp),
"IAX2/%s", cat);
1700 snprintf(tmp,
sizeof(tmp),
"H323/%s", cat);
1704 if (hasexten && !
ast_true(hasexten))
1715 if (sscanf(chan,
"%30d-%30d", &start, &finish) == 2) {
1717 }
else if (sscanf(chan,
"%30d", &start)) {
1721 start = 0; finish = 0;
1723 if (finish < start) {
1728 for (x = start; x <= finish; x++) {
1729 snprintf(tmp,
sizeof(tmp),
"DAHDI/%d", x);
1750 snprintf(tmp,
sizeof(tmp),
"stdexten,%s,${HINT}", cat);
1757 snprintf(tmp,
sizeof(tmp),
"%s,1", cat);
1789 local_contexts = NULL;
1805 if (static_config && !write_protect_config)
1817 if (clearglobalvars_config)
struct ast_include * ast_walk_context_includes(struct ast_context *con, struct ast_include *inc)
ast_include: include= support in extensions.conf
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
static int clearglobalvars_config
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
hashtable functions for contexts
int ast_unlock_context(struct ast_context *con)
static char exten[AST_MAX_EXTENSION]
static int pbx_load_config(const char *config_file)
static char * handle_cli_dialplan_remove_include(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_CLI_DEFINE(fn, txt,...)
static int autofallthrough_config
int ast_context_add_include2(struct ast_context *con, const char *include, const char *registrar)
Add a context include.
int ast_get_extension_priority(struct ast_exten *exten)
Asterisk main include file. File version handling, generic pbx functions.
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
static const char config_file[]
const char * ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable)
Gets a variable.
int ast_hashtab_newsize_java(struct ast_hashtab *tab)
Create a prime number roughly 2x the current table size.
int ast_context_remove_include(const char *context, const char *include, const char *registrar)
Remove a context include.
int ast_context_remove_ignorepat(const char *context, const char *ignorepat, const char *registrar)
void pbx_builtin_clear_globals(void)
char * strsep(char **str, const char *delims)
const char * ast_get_extension_registrar(struct ast_exten *e)
static char * handle_cli_dialplan_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_cli_register(struct ast_cli_entry *e)
Registers a command or an array of commands.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
static char * complete_dialplan_add_include(struct ast_cli_args *)
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
static char * complete_dialplan_remove_include(struct ast_cli_args *)
static int write_protect_config
static int extenpatternmatchnew_config
int ast_cli_unregister(struct ast_cli_entry *e)
Unregisters a command or an array of commands.
descriptor for a cli entry.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category)
Goes through variables.
const char * ast_get_extension_app(struct ast_exten *e)
int ast_add_extension2(struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add an extension to an extension context, this time with an ast_context *.
Structure for variables, used for configurations and for channel variables.
Configuration File Parser.
static char * complete_dialplan_add_extension(struct ast_cli_args *)
static char userscontext[AST_MAX_EXTENSION]
void * ast_get_extension_app_data(struct ast_exten *e)
int ast_rdlock_contexts(void)
Read locks the context list.
const char * ast_get_extension_label(struct ast_exten *e)
#define ast_mutex_lock(a)
int ast_wrlock_contexts(void)
Write locks the context list.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
const char * ast_config_option(struct ast_config *cfg, const char *cat, const char *var)
Retrieve a configuration variable within the configuration set.
static int load_module(void)
const char * ast_get_context_registrar(struct ast_context *c)
void ast_cli(int fd, const char *fmt,...)
static int pbx_load_module(void)
int ast_context_add_switch2(struct ast_context *con, const char *sw, const char *data, int eval, const char *registrar)
Adds a switch (first param is a ast_context)
static int partial_match(const char *s, const char *word, int len)
match the first 'len' chars of word. len==0 always succeeds
void ast_free_ptr(void *ptr)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
int ast_context_add_include(const char *context, const char *include, const char *registrar)
Add a context include.
int ast_hashtab_resize_java(struct ast_hashtab *tab)
Determines if a table resize should occur using the Java algorithm (if the table load factor is 75% o...
const char * ast_get_switch_name(struct ast_sw *sw)
static char * handle_cli_dialplan_add_extension(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
ADD EXTENSION command stuff.
static int lookup_ci(struct ast_context *c, const char *name)
return true if 'name' is included by context c
const char * ast_get_include_name(struct ast_include *include)
const char * ast_get_include_registrar(struct ast_include *i)
#define ast_asprintf(a, b, c...)
#define ast_opt_dont_warn
static void pbx_load_users(void)
ast_sw: Switch statement in extensions.conf
General Asterisk PBX channel definitions.
struct ast_exten * ast_walk_context_extensions(struct ast_context *con, struct ast_exten *priority)
Asterisk file paths, configured in asterisk.conf.
#define ast_config_load(filename, flags)
Load a config file.
int ast_context_add_ignorepat(const char *context, const char *ignorepat, const char *registrar)
Add an ignorepat.
static char * handle_cli_dialplan_save(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
'save dialplan' CLI command implementation functions ...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define AST_MAX_EXTENSION
int pbx_set_extenpatternmatchnew(int newval)
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
const char * ast_get_ignorepat_registrar(struct ast_ignorepat *ip)
char * ast_category_browse(struct ast_config *config, const char *prev)
Goes through categories.
const char * ast_get_switch_data(struct ast_sw *sw)
static const char registrar[]
struct ast_ignorepat * ast_walk_context_ignorepats(struct ast_context *con, struct ast_ignorepat *ip)
int pbx_set_autofallthrough(int newval)
struct ast_hashtab * ast_hashtab_create(int initial_buckets, int(*compare)(const void *a, const void *b), int(*resize)(struct ast_hashtab *), int(*newsize)(struct ast_hashtab *tab), unsigned int(*hash)(const void *obj), int do_locking)
Create the hashtable list.
const char * ast_get_extension_cidmatch(struct ast_exten *e)
int ast_context_add_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar)
struct ast_context * ast_walk_contexts(struct ast_context *con)
const char * ast_get_context_name(struct ast_context *con)
static char * complete_dialplan_remove_ignorepat(struct ast_cli_args *)
Core PBX routines and definitions.
static char * overrideswitch_config
static char * handle_cli_dialplan_remove_extension(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ast_strdupa(s)
duplicate a string in memory from the stack
static char * handle_cli_dialplan_add_ignorepat(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int lookup_c_ip(struct ast_context *c, const char *name)
return true if 'name' is in the ignorepats for context c
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
static struct ast_cli_entry cli_dialplan_save
const char * ast_config_AST_CONFIG_DIR
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
Merge the temporary contexts into a global contexts list and delete from the global list the ones tha...
const char * ast_get_switch_registrar(struct ast_sw *sw)
struct ast_exten * ast_walk_extension_priorities(struct ast_exten *exten, struct ast_exten *priority)
ast_ignorepat: Ignore patterns in dial plan
int ast_unlock_contexts(void)
Unlocks contexts.
static int split_ec(const char *src, char **ext, char **const ctx, char **const cid)
split extension@context in two parts, return -1 on error. The return string is malloc'ed and pointed ...
static ast_mutex_t reload_lock
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int unload_module(void)
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
int ast_context_remove_extension_callerid(const char *context, const char *extension, int priority, const char *callerid, int matchcid, const char *registrar)
static char * pbx_strsep(char **destructible, const char *delim)
static void append_interface(char *iface, int maxlen, char *add)
const char * ast_get_extension_name(struct ast_exten *exten)
static struct ast_hashtab * local_table
const char * ast_get_ignorepat_name(struct ast_ignorepat *ip)
unsigned int ast_hashtab_hash_contexts(const void *obj)
static ast_mutex_t save_dialplan_lock
static const char config[]
static struct ast_cli_entry cli_pbx_config[]
Structure used to handle boolean flags.
Support for logging to various files, console and syslog Configuration in file logger.conf.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
struct ast_sw * ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw)
static char * complete_dialplan_add_ignorepat(struct ast_cli_args *)
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
Standard Command Line Interface.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
static struct ast_context * local_contexts
static char * overrideswitch
void pbx_set_overrideswitch(const char *newval)
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context (or ANY context if NULL)
static char * handle_cli_dialplan_add_include(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_context_verify_includes(struct ast_context *con)
Verifies includes in an ast_contect structure.
struct ast_variable * next
#define CONFIG_STATUS_FILEINVALID
static char context[AST_MAX_CONTEXT]
static const char * skip_words(const char *p, int n)
moves to the n-th word in the string, or empty string if none
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
static char * handle_cli_dialplan_remove_ignorepat(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_get_extension_matchcid(struct ast_exten *e)
Asterisk module definitions.
int ast_findlabel_extension2(struct ast_channel *c, struct ast_context *con, const char *exten, const char *label, const char *callerid)
Find the priority of an extension that has the specified label.
ast_context: An extension context
static char * complete_dialplan_remove_extension(struct ast_cli_args *)
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
int ast_rdlock_context(struct ast_context *con)
Read locks a given context.
#define ast_mutex_unlock(a)