102static const char config[] =
"extensions.conf";
144 e->
command =
"dialplan remove context";
146 "Usage: dialplan remove context <context>\n"
147 " Removes all extensions from a specified context.\n";
158 ast_cli(
a->fd,
"There is no such context as '%s'\n",
a->argv[3]);
161 ast_cli(
a->fd,
"Removed context '%s'\n",
a->argv[3]);
172 e->
command =
"dialplan remove include";
174 "Usage: dialplan remove include <context> from <context>\n"
175 " Remove an included context from another context.\n";
181 if (
a->argc != 6 || strcmp(
a->argv[4],
"from"))
185 ast_cli(
a->fd,
"We are not including '%s' into '%s' now\n",
186 a->argv[3],
a->argv[5]);
190 ast_cli(
a->fd,
"Failed to remove '%s' include from '%s' context\n",
191 a->argv[3],
a->argv[5]);
247 for (;n && *p; p++) {
248 if (isblank(*p) && !in_blank) {
251 }
else if ( in_blank) {
267static int split_ec(
const char *src,
char **
ext,
char **
const ctx,
char **
const cid)
281 if (strchr(
c,
'@')) {
286 if (cid && (i = strchr(e,
'/'))) {
301 int len = strlen(
a->word);
320 int already_served = 0;
333 if (!already_served && ++which >
a->n) {
343 }
else if (
a->pos == 4) {
375 }
else if (
a->pos == 5) {
379 char *
context, *dupline, *from;
390 from =
strsep(&dupline,
" ");
391 if (!from || strcmp(from,
"from")) {
425 int removing_priority = 0;
431 e->
command =
"dialplan remove extension";
433 "Usage: dialplan remove extension exten[/cid]@context [priority]\n"
434 " Remove an extension from a given context. If a priority\n"
435 " is given, only that specific priority from the given extension\n"
436 " will be removed.\n";
442 if (
a->argc != 5 &&
a->argc != 4)
449 const char *
c =
a->argv[4];
455 if (!strcmp(
"hint",
c))
458 while (*
c && isdigit(*
c))
461 ast_cli(
a->fd,
"Invalid priority '%s'\n",
a->argv[4]);
464 removing_priority = atoi(
a->argv[4]);
467 if (removing_priority == 0) {
468 ast_cli(
a->fd,
"If you want to remove whole extension, please " \
469 "omit priority argument\n");
480 if ((!strlen(exten)) || (!(strlen(
context)))) {
481 ast_cli(
a->fd,
"Missing extension or context name in third argument '%s'\n",
489 cid ? cid : (removing_priority ?
"" :
NULL), cid ? 1 : 0,
registrar)) {
490 if (!removing_priority)
491 ast_cli(
a->fd,
"Whole extension %s@%s removed\n",
494 ast_cli(
a->fd,
"Extension %s@%s with priority %d removed\n",
495 exten,
context, removing_priority);
500 ast_cli(
a->fd,
"Failed to remove extension %s/%s@%s\n", exten, cid,
context);
518 char *cidmatch =
NULL;
522 "for DialplanExtensionRemove");
528 if (strchr(exten,
'/')) {
535 }
else if (!strcmp(
"hint",
priority)) {
537 }
else if ((sscanf(
priority,
"%30d", &ipriority) != 1) || ipriority <= 0) {
547 astman_send_ack(s, m,
"Removed the requested priority from the extension");
576 lcid = cid ? strlen(cid) : -1;
590 if ( !strchr(
a->word,
'/') ||
595 if (++which >
a->n) {
619 }
else if (
a->pos == 4) {
628 if ( (p = strchr(exten,
' ')) )
630 if ( (p = strchr(
context,
' ')) )
634 len = strlen(
a->word);
635 if (le == 0 || lc == 0)
684 const char *into_context;
688 e->
command =
"dialplan add include";
690 "Usage: dialplan add include <context> into <context>\n"
691 " Include a context in another context.\n";
701 if (strcmp(
a->argv[4],
"into"))
704 into_context =
a->argv[5];
707 ast_cli(
a->fd,
"Context '%s' did not exist prior to add include - the context will be created.\n", into_context);
711 ast_cli(
a->fd,
"ast_context_find_or_create() failed\n");
712 ast_cli(
a->fd,
"Failed to include '%s' in '%s' context\n",
a->argv[3],
a->argv[5]);
719 ast_cli(
a->fd,
"Out of memory for context addition\n");
723 ast_cli(
a->fd,
"Failed to lock context(s) list, please try again later\n");
727 ast_cli(
a->fd,
"Context '%s' already included in '%s' context\n",
728 a->argv[3],
a->argv[5]);
733 ast_cli(
a->fd,
"There is no existence of context '%s'\n",
734 errno == ENOENT ?
a->argv[5] :
a->argv[3]);
738 ast_cli(
a->fd,
"Failed to include '%s' in '%s' context\n",
739 a->argv[3],
a->argv[5]);
746 ast_cli(
a->fd,
"Context '%s' included in '%s' context\n",
747 a->argv[3],
a->argv[5]);
757 int len = strlen(
a->word);
769 }
else if (
a->pos == 4) {
772 }
else if (
a->pos == 5) {
773 char *
context, *dupline, *into;
783 into =
strsep(&dupline,
" ");
785 if (!strlen(
context) || strcmp(into,
"into")) {
826 const char *base, *slash;
832 "Usage: dialplan save [/path/to/extension/file]\n"
833 " Save dialplan created by pbx_config module.\n"
835 "Example: dialplan save (/etc/asterisk/extensions.conf)\n"
836 " dialplan save /home/markster (/home/markster/extensions.conf)\n";
844 "I can't save dialplan now, see '%s' example file.\n",
849 if (
a->argc != 2 &&
a->argc != 3)
854 "Failed to lock dialplan saving (another process saving?)\n");
862 if (!strstr(
a->argv[2],
".conf")) {
864 slash = (*(
a->argv[2] + strlen(
a->argv[2]) -1) ==
'/') ?
"/" :
"";
873 snprintf(filename,
sizeof(filename),
"%s%s%s", base, slash,
config);
877 ast_cli(
a->fd,
"Failed to load extensions.conf\n");
884 ast_cli(
a->fd,
"Failed to lock contexts list\n");
891 if (!(output = fopen(filename,
"wt"))) {
892 ast_cli(
a->fd,
"Failed to create file '%s'\n",
904 fprintf(output,
"[general]\nstatic=%s\nwriteprotect=%s\nautofallthrough=%s\nclearglobalvars=%s\n%sextenpatternmatchnew=%s\n\n",
913 fprintf(output,
"[globals]\n");
915 int escaped_len = 2 * strlen(v->
value) + 1;
916 char escaped[escaped_len];
919 fprintf(output,
"%s => %s\n", v->
name, escaped);
922 fprintf(output,
"\n");
927#define PUT_CTX_HDR do { \
928 if (!context_header_written) { \
929 fprintf(output, "[%s]\n", ast_get_context_name(c)); \
930 context_header_written = 1; \
936 int context_header_written = 0;
949 context_header_written = 1;
962 if (last_written_e !=
NULL &&
965 fprintf(output,
"\n");
971 fprintf(output,
"exten => %s,hint,%s\n",
975 const char *sep, *cid;
977 char label[128] =
"";
980 int escaped_len = (!
ast_strlen_zero(appdata)) ? 2 * strlen(appdata) + 1 : 1;
981 char escaped[escaped_len];
990 if (
el && (snprintf(
label,
sizeof(
label),
"(%s)",
el) != (strlen(
el) + 2))) {
1000 fprintf(output,
"exten => %s%s%s,%d%s,%s(%s)\n",
1010 fprintf(output,
"\n");
1022 fprintf(output,
"\n");
1032 fprintf(output,
"switch => %s/%s\n",
1037 fprintf(output,
"\n");
1047 fprintf(output,
"ignorepat => %s\n",
1059 ast_cli(
a->fd,
"Saved dialplan is incomplete\n");
1063 ast_cli(
a->fd,
"Dialplan successfully saved into '%s'\n",
1074 char *exten, *prior;
1078 const char *into_context;
1082 e->
command =
"dialplan add extension";
1084 "Usage: dialplan add extension <exten>,<priority>,<app> into <context> [replace]\n"
1086 " app can be either:\n"
1088 " app-name(app-data)\n"
1089 " app-name,<app-data>\n"
1091 " This command will add the new extension into <context>. If\n"
1092 " an extension with the same priority already exists and the\n"
1093 " 'replace' option is given we will replace the extension.\n"
1095 "Example: dialplan add extension 6123,1,Dial,IAX/216.207.245.56/6123 into local\n"
1096 " Now, you can dial 6123 and talk to Markster :)\n";
1103 if (
a->argc != 6 &&
a->argc != 7)
1105 if (strcmp(
a->argv[4],
"into"))
1108 if (strcmp(
a->argv[6],
"replace"))
1112 exten =
strsep(&whole_exten,
",");
1113 if (strchr(exten,
'/')) {
1119 prior =
strsep(&whole_exten,
",");
1121 if (!strcmp(prior,
"hint")) {
1124 if (sscanf(prior,
"%30d", &iprior) != 1) {
1125 ast_cli(
a->fd,
"'%s' is not a valid priority\n", prior);
1132 if ((start = strchr(
app,
'(')) && (
end = strrchr(
app,
')'))) {
1133 *start = *
end =
'\0';
1145 if (!exten || !prior || !
app) {
1152 into_context =
a->argv[5];
1155 ast_cli(
a->fd,
"Context '%s' did not exist prior to add extension - the context will be created.\n", into_context);
1159 ast_cli(
a->fd,
"Failed to add '%s,%s,%s(%s)' extension into '%s' context\n",
1168 ast_cli(
a->fd,
"Out of free memory\n");
1172 ast_cli(
a->fd,
"Failed to lock context(s) list, please try again later\n");
1176 ast_cli(
a->fd,
"No existence of '%s' context\n", into_context);
1180 ast_cli(
a->fd,
"Extension %s@%s with priority %s already exists\n",
1181 exten, into_context, prior);
1185 ast_cli(
a->fd,
"Failed to add '%s,%s,%s(%s)' extension into '%s' context\n",
1193 ast_cli(
a->fd,
"Extension %s@%s (%s) replace by '%s,%s,%s(%s)'\n",
1194 exten, into_context, prior, exten, prior,
app,
app_data);
1196 ast_cli(
a->fd,
"Extension '%s,%s,%s(%s)' added into '%s' context\n",
1213 char *cidmatch =
NULL;
1219 "Application must be defined for DialplanExtensionAdd.");
1226 }
else if ((sscanf(
priority,
"%30d", &ipriority) != 1) || (ipriority < 0)) {
1234 if (strchr(exten,
'/')) {
1247 "for the extension.");
1269 astman_send_error(s, m,
"That extension and priority already exist at that context");
1288 int len = strlen(
a->word);
1320 }
else if (
a->pos == 5) {
1322 int len = strlen(
a->word);
1337 }
else if (
a->pos == 6) {
1350 e->
command =
"dialplan add ignorepat";
1352 "Usage: dialplan add ignorepat <pattern> into <context>\n"
1353 " This command adds a new ignore pattern into context <context>\n"
1355 "Example: dialplan add ignorepat _3XX into local\n";
1364 if (strcmp(
a->argv[4],
"into"))
1370 ast_cli(
a->fd,
"Out of free memory\n");
1374 ast_cli(
a->fd,
"There is no existence of '%s' context\n",
a->argv[5]);
1378 ast_cli(
a->fd,
"Ignore pattern '%s' already included in '%s' context\n",
1379 a->argv[3],
a->argv[5]);
1383 ast_cli(
a->fd,
"Failed to lock context(s) list, please, try again later\n");
1387 ast_cli(
a->fd,
"Failed to add ignore pattern '%s' into '%s' context\n",
1388 a->argv[3],
a->argv[5]);
1394 ast_cli(
a->fd,
"Ignore pattern '%s' added into '%s' context\n",
1395 a->argv[3],
a->argv[5]);
1404 else if (
a->pos == 5) {
1407 char *dupline, *ignorepat =
NULL;
1410 int len = strlen(
a->word);
1421 ignorepat =
strsep(&dupline,
" ");
1435 if (!found && ++which >
a->n)
1451 e->
command =
"dialplan remove ignorepat";
1453 "Usage: dialplan remove ignorepat <pattern> from <context>\n"
1454 " This command removes an ignore pattern from context <context>\n"
1456 "Example: dialplan remove ignorepat _3XX from local\n";
1465 if (strcmp(
a->argv[4],
"from"))
1471 ast_cli(
a->fd,
"Failed to lock context(s) list, please try again later\n");
1475 ast_cli(
a->fd,
"There is no existence of '%s' context\n",
a->argv[5]);
1479 ast_cli(
a->fd,
"There is no existence of '%s' ignore pattern in '%s' context\n",
1480 a->argv[3],
a->argv[5]);
1484 ast_cli(
a->fd,
"Failed to remove ignore pattern '%s' from '%s' context\n",
1485 a->argv[3],
a->argv[5]);
1491 ast_cli(
a->fd,
"Ignore pattern '%s' removed from '%s' context\n",
1492 a->argv[3],
a->argv[5]);
1503 int len = strlen(
a->word);
1533 }
else if (
a->pos == 4) {
1535 }
else if (
a->pos == 5) {
1536 char *dupline, *duplinet, *ignorepat;
1537 int len = strlen(
a->word);
1548 ignorepat =
strsep(&duplinet,
" ");
1588 e->
command =
"dialplan reload";
1590 "Usage: dialplan reload\n"
1591 " Reload extensions.conf without reloading any other\n"
1592 " modules. This command does not delete global variables\n"
1593 " unless clearglobalvars is set to yes in extensions.conf\n";
1606 ast_cli(
a->fd,
"Dialplan reloaded.\n");
1627#define AMI_EXTENSION_ADD "DialplanExtensionAdd"
1628#define AMI_EXTENSION_REMOVE "DialplanExtensionRemove"
1659 if (!destructible || !*destructible) {
1662 res = *destructible;
1663 for (; **destructible; (*destructible)++) {
1664 if (**destructible ==
'[' && !strchr(delim,
'[')) {
1666 }
else if (**destructible ==
']' && !strchr(delim,
']')) {
1670 }
else if (**destructible ==
'\\' && !strchr(delim,
'\\')) {
1672 }
else if (strchr(delim, **destructible) && !square) {
1673 **destructible =
'\0';
1678 if (**destructible ==
'\0') {
1679 *destructible =
NULL;
1690 char realvalue[256];
1692 char realvalue[8192];
1699 const char *newpm, *ovsw;
1701 char lastextension[256];
1731 if (strcasecmp(cxt,
"globals")) {
1745 if (!strcasecmp(cxt,
"general") || !strcasecmp(cxt,
"globals")) {
1753 lastextension[0] =
'\0';
1758 char realext[256] =
"";
1759 char *stringp, *
ext;
1765 if (!strncasecmp(v->
name,
"same", 4)) {
1768 "No previous pattern in the first entry of context '%s' to match '%s' at line %d of %s!\n",
1774 goto process_extension;
1776 }
else if (!strcasecmp(v->
name,
"exten")) {
1779 char *pri, *appl, *data, *cidmatch;
1790 if ((cidmatch = strchr(realext,
'/'))) {
1795 if ((label = strchr(pri,
'('))) {
1797 if ((
end = strchr(label,
')'))) {
1801 "Label missing trailing ')' at line %d of %s\n",
1807 if ((plus = strchr(pri,
'+'))) {
1810 if (!strcmp(pri,
"hint")) {
1812 }
else if (!strcmp(pri,
"next") || !strcmp(pri,
"n")) {
1817 "Can't use 'next' priority on the first entry at line %d of %s!\n",
1822 }
else if (!strcmp(pri,
"same") || !strcmp(pri,
"s")) {
1827 "Can't use 'same' priority on the first entry at line %d of %s!\n",
1832 }
else if (sscanf(pri,
"%30d", &ipri) != 1 &&
1835 "Invalid priority/label '%s' at line %d of %s\n",
1840 }
else if (ipri < 1) {
1846 appl =
S_OR(stringp,
"");
1848 if (!strchr(appl,
'(')) {
1859 appl =
strsep(&stringp,
"(");
1862 if (strstr(appl,
"${") || strstr(appl,
"$[")){
1864 strcpy(appl, orig_appl);
1869 data =
S_OR(stringp,
"");
1870 if ((
end = strrchr(data,
')'))) {
1874 "No closing parenthesis found? '%s(%s' at line %d of %s\n",
1875 appl, data, v->
lineno, vfile);
1883 const char *registrar_file;
1890 "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",
1891 realext, realext[1], v->
lineno, vfile);
1894 registrar_file = strrchr(vfile,
'/');
1895 if (!registrar_file) {
1896 registrar_file = vfile;
1900 if (
ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl,
ast_strdup(data),
ast_free_ptr,
registrar, registrar_file, v->
lineno)) {
1902 "Unable to register extension at line %d of %s\n",
1907 }
else if (!strcasecmp(v->
name,
"include")) {
1921 "Context '%s' already included in '%s' context on include at line %d of %s\n",
1928 "There is no existence of context '%s' included at line %d of %s\n",
1934 "Failed to include '%s' in '%s' context at line %d of %s\n",
1939 }
else if (!strcasecmp(v->
name,
"ignorepat")) {
1943 "Unable to include ignorepat '%s' in context '%s' at line %d of %s\n",
1946 }
else if (!strcasecmp(v->
name,
"switch") || !strcasecmp(v->
name,
"lswitch") || !strcasecmp(v->
name,
"eswitch")) {
1948 stringp = realvalue;
1950 if (!strcasecmp(v->
name,
"switch")) {
1955 appl =
strsep(&stringp,
"/");
1956 data =
S_OR(stringp,
"");
1959 "Unable to include switch '%s' in context '%s' at line %d of %s\n",
1962 }
else if (!strcasecmp(v->
name,
"autohints")) {
1966 "==!!== Unknown directive: %s at line %d of %s -- IGNORING!!!\n",
1977 int len = strlen(iface);
1978 if (strlen(add) +
len < maxlen - 2) {
1979 if (strlen(iface)) {
1981 strcpy(iface +
len + 1, add);
1999 if (strcmp(
type,
"FullyBooted")) {
2003 ast_log(
LOG_WARNING,
"users.conf is deprecated and will be removed in a future version of Asterisk\n");
2012 const char *dahdichan;
2013 const char *hasexten, *altexts;
2016 char dahdicopy[256];
2017 char *
ext, altcopy[256];
2020 int start, finish, x;
2033 if (!strcasecmp(cat,
"general"))
2037 snprintf(tmp,
sizeof(tmp),
"IAX2/%s", cat);
2041 snprintf(tmp,
sizeof(tmp),
"H323/%s", cat);
2045 if (hasexten && !
ast_true(hasexten))
2056 if (sscanf(chan,
"%30d-%30d", &start, &finish) == 2) {
2058 }
else if (sscanf(chan,
"%30d", &start)) {
2062 start = 0; finish = 0;
2064 if (finish < start) {
2069 for (x = start; x <= finish; x++) {
2070 snprintf(tmp,
sizeof(tmp),
"DAHDI/%d", x);
2088 ast_add_extension2(con, 0, cat, -1,
NULL,
NULL, iface,
NULL,
NULL,
registrar,
NULL, 0);
2091 snprintf(tmp,
sizeof(tmp),
"%s,stdexten(${HINT})", cat);
2092 ast_add_extension2(con, 0, cat, 1,
NULL,
NULL,
"Gosub",
ast_strdup(tmp),
ast_free_ptr,
registrar,
NULL, 0);
2094 ast_add_extension2(con, 0, cat, 1,
NULL,
NULL,
"Dial",
ast_strdup(
"${HINT}"),
ast_free_ptr,
registrar,
NULL, 0);
2098 snprintf(tmp,
sizeof(tmp),
"%s,1", cat);
2103 ast_add_extension2(con, 0,
ext, 1,
NULL,
NULL,
"Goto",
ast_strdup(tmp),
ast_free_ptr,
registrar,
NULL, 0);
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
static const char config_file[]
General Asterisk PBX channel definitions.
#define AST_MAX_EXTENSION
Standard Command Line Interface.
int ast_cli_unregister(struct ast_cli_entry *e)
Unregisters a command or an array of commands.
#define ast_cli_register(e)
Registers a command or an array of commands.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
struct stasis_topic * ast_manager_get_topic(void)
Get the Stasis Message Bus API topic for AMI.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
void ast_hashtab_destroy(struct ast_hashtab *tab, void(*objdestroyfunc)(void *obj))
This func will free the hash table and all its memory.
int ast_hashtab_newsize_java(struct ast_hashtab *tab)
Create a prime number roughly 2x the current table size.
#define ast_hashtab_create(initial_buckets, compare, resize, newsize, hash, do_locking)
Create the hashtable list.
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...
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
const char * ast_config_option(struct ast_config *cfg, const char *cat, const char *var)
Retrieve a configuration variable within the configuration set.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
Support for logging to various files, console and syslog Configuration in file logger....
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
#define ast_mutex_unlock(a)
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define EVENT_FLAG_SYSTEM
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
struct stasis_message_type * ast_manager_get_generic_type(void)
Get the stasis_message_type for generic messages.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_opt_dont_warn
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_CONFIG_DIR
static char * overrideswitch
Core PBX routines and definitions.
void * ast_get_extension_app_data(struct ast_exten *e)
const struct ast_sw * ast_context_switches_get(const struct ast_context *con, int idx)
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.
int ast_context_destroy_by_name(const char *context, const char *registrar)
Destroy a context by name.
int ast_context_remove_ignorepat(const char *context, const char *ignorepat, const char *registrar)
Remove an ignorepat.
struct ast_context * ast_walk_contexts(struct ast_context *con)
int ast_get_extension_priority(struct ast_exten *exten)
int ast_wrlock_contexts(void)
Write locks the context list.
void ast_context_set_autohints(struct ast_context *con, int enabled)
Enable or disable autohints support on a context.
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
hashtable functions for contexts
int ast_context_add_ignorepat(const char *context, const char *ignorepat, const char *registrar)
Add an ignorepat.
int ast_get_extension_matchcid(struct ast_exten *e)
struct ast_context * ast_context_find(const char *name)
Find a context.
const char * ast_get_extension_app(struct ast_exten *e)
int ast_context_add_include(const char *context, const char *include, const char *registrar)
Add a context include.
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, const char *registrar_file, int registrar_line)
Add an extension to an extension context, this time with an ast_context *.
int ast_context_add_include2(struct ast_context *con, const char *value, const char *registrar)
Add a context include.
const char * ast_get_switch_name(const struct ast_sw *sw)
int ast_context_add_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar)
const char * ast_get_extension_cidmatch(struct ast_exten *e)
const char * ast_get_extension_label(struct ast_exten *e)
unsigned int ast_hashtab_hash_contexts(const void *obj)
const char * ast_get_switch_data(const struct ast_sw *sw)
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.
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.
const char * ast_get_include_name(const struct ast_include *include)
const char * ast_get_context_registrar(struct ast_context *c)
void pbx_set_overrideswitch(const char *newval)
int ast_unlock_context(struct ast_context *con)
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...
struct ast_exten * ast_walk_extension_priorities(struct ast_exten *exten, struct ast_exten *priority)
int ast_context_remove_extension_callerid(const char *context, const char *extension, int priority, const char *callerid, int matchcid, const char *registrar)
int pbx_set_extenpatternmatchnew(int newval)
const char * ast_get_context_name(struct ast_context *con)
const char * ast_get_ignorepat_registrar(const struct ast_ignorepat *ip)
void pbx_builtin_clear_globals(void)
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context or ANY context if NULL)
int ast_rdlock_contexts(void)
Read locks the context list.
int ast_context_ignorepats_count(const struct ast_context *con)
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)
const struct ast_include * ast_context_includes_get(const struct ast_context *con, int idx)
struct ast_exten * ast_walk_context_extensions(struct ast_context *con, struct ast_exten *priority)
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.
int ast_context_verify_includes(struct ast_context *con)
Verifies includes in an ast_contect structure.
int ast_context_remove_include(const char *context, const char *include, const char *registrar)
Remove a context include.
const struct ast_ignorepat * ast_context_ignorepats_get(const struct ast_context *con, int idx)
int ast_unlock_contexts(void)
Unlocks contexts.
int ast_context_switches_count(const struct ast_context *con)
int pbx_set_autofallthrough(int newval)
int ast_context_includes_count(const struct ast_context *con)
const char * ast_get_include_registrar(const struct ast_include *i)
const char * ast_get_extension_name(struct ast_exten *exten)
int ast_rdlock_context(struct ast_context *con)
Read locks a given context.
const char * ast_get_ignorepat_name(const struct ast_ignorepat *ip)
const char * ast_get_extension_registrar(struct ast_exten *e)
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
const char * ast_get_switch_registrar(const struct ast_sw *sw)
static char * complete_dialplan_remove_extension(struct ast_cli_args *)
static char * complete_dialplan_add_extension(struct ast_cli_args *)
static char * complete_dialplan_remove_context(struct ast_cli_args *)
static int manager_dialplan_extension_add(struct mansession *s, const struct message *m)
static void pbx_load_users(void)
static char * complete_dialplan_add_include(struct ast_cli_args *)
static const char registrar[]
static char * pbx_strsep(char **destructible, const char *delim)
static char * overrideswitch_config
static int extenpatternmatchnew_config
static char * handle_cli_dialplan_remove_context(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int autofallthrough_config
static char * complete_dialplan_add_ignorepat(struct ast_cli_args *)
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 struct ast_cli_entry cli_dialplan_save
static const char * skip_words(const char *p, int n)
moves to the n-th word in the string, or empty string if none
#define AMI_EXTENSION_ADD
static int lookup_c_ip(struct ast_context *c, const char *name)
return true if 'name' is in the ignorepats for context c
static int pbx_load_module(void)
static void startup_event_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static char * handle_cli_dialplan_remove_include(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_context * local_contexts
static struct ast_cli_entry cli_pbx_config[]
static char * handle_cli_dialplan_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AMI_EXTENSION_REMOVE
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 clearglobalvars_config
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 char * handle_cli_dialplan_add_ignorepat(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_dialplan_remove_ignorepat(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct stasis_subscription * fully_booted_subscription
static char * complete_dialplan_remove_include(struct ast_cli_args *)
static const char config[]
static char userscontext[AST_MAX_EXTENSION]
static int pbx_load_config(const char *config_file)
static int lookup_ci(struct ast_context *c, const char *name)
return true if 'name' is included by context c
static ast_mutex_t reload_lock
static int load_module(void)
static void append_interface(char *iface, int maxlen, char *add)
static int unload_module(void)
static char * handle_cli_dialplan_add_include(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static ast_mutex_t save_dialplan_lock
static char * complete_dialplan_remove_ignorepat(struct ast_cli_args *)
static int partial_match(const char *s, const char *word, int len)
match the first 'len' chars of word. len==0 always succeeds
static struct ast_hashtab * local_table
static char * handle_cli_dialplan_remove_extension(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int manager_dialplan_extension_remove(struct mansession *s, const struct message *m)
static int write_protect_config
struct stasis_forward * sub
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
#define stasis_subscribe_pool(topic, callback, data)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
struct stasis_subscription * stasis_unsubscribe(struct stasis_subscription *subscription)
Cancel a subscription.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
descriptor for a cli entry.
ast_context: An extension context
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
Structure used to handle boolean flags.
ast_ignorepat: Ignore patterns in dial plan
ast_include: include= support in extensions.conf
ast_sw: Switch statement in extensions.conf
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
structure to hold extensions
In case you didn't read that giant block of text above the mansession_session struct,...
char * ast_escape_semicolons(const char *string, char *outbuf, int buflen)
Escape semicolons found in a string.