37 #if defined(HAVE_SYSINFO) 38 #include <sys/sysinfo.h> 41 #include <sys/loadavg.h> 214 #define EXT_DATA_SIZE 256 216 #define EXT_DATA_SIZE 8192 219 #define SWITCH_DATA_LENGTH 256 222 #define VAR_SOFTTRAN 2 223 #define VAR_HARDTRAN 3 290 struct ast_includes includes;
291 struct ast_ignorepats ignorepats;
351 #define HINTDEVICE_DATA_LENGTH 16 356 #define HASH_EXTENHINT_SIZE 17 358 #define HASH_EXTENHINT_SIZE 563 425 const char *right_key = arg;
433 cmp = strcasecmp(left->
hintdevice, right_key);
440 cmp = strncmp(left->
hintdevice, right_key, strlen(right_key));
478 const char *right_key = arg;
486 cmp = strcasecmp(left->
context, right_key);
493 cmp = strncmp(left->
context, right_key, strlen(right_key));
510 if (!strcasecmp(candidate->
hintdevice, device)
511 && candidate->
hint == hint) {
560 if (!hint || !devicelist) {
571 while ((cur =
strsep(&parse,
"&,"))) {
574 devicelength = strlen(cur);
585 "allocating a hintdevice structure");
598 ao2_t_link(hintdevices, device,
"Linking device into hintdevice container.");
599 ao2_t_ref(device, -1,
"hintdevice is linked so we can unref");
630 static int matchcid(
const char *cidpattern,
const char *callerid);
635 struct match_char *tree,
int length,
int spec,
const char *callerid,
654 int replace,
const char *extension,
int priority,
const char *label,
const char *callerid,
655 const char *application,
void *data,
void (*
datad)(
void *),
661 static unsigned int ext_strncpy(
char *dst,
const char *src,
size_t dst_size,
int nofluff);
676 const unsigned char *ac =
a;
677 const unsigned char *
bc =
b;
819 void check_contexts_trouble(
void);
821 void check_contexts_trouble(
void)
827 int check_contexts(
char *,
int);
829 int check_contexts(
char *
file,
int line )
840 if (!contexts_table) {
847 for(c2=contexts;c2;c2=c2->
next) {
854 ast_log(
LOG_NOTICE,
"Called from: %s:%d: Could not find the %s context in the linked list\n", file, line, c1->
name);
855 check_contexts_trouble();
859 for(c2=contexts;c2;c2=c2->
next) {
862 ast_log(
LOG_NOTICE,
"Called from: %s:%d: Could not find the %s context in the hashtab\n", file, line, c2->
name);
863 check_contexts_trouble();
870 for(c2=contexts;c2;c2=c2->
next) {
878 char dummy_name[1024];
879 ex.exten = dummy_name;
887 "the exten %s (CID match: %s) but it is not in its root_table\n",
891 "the exten %s but it is not in its root_table\n",
892 file, line, c2->
name, dummy_name);
894 check_contexts_trouble();
914 ast_log(
LOG_NOTICE,
"Called from: %s:%d: The %s context records the exten %s but it is not in its root_table\n", file, line, c2->
name, e2->
exten);
915 check_contexts_trouble();
927 for(e1 = c2->
root; e1; e1 = e1->
next) {
929 for(e2=e1;e2;e2=e2->
peer) {
932 ast_log(
LOG_NOTICE,
"Called from: %s:%d: The %s context, %s exten, %d priority has a peer_table entry, and shouldn't!\n", file, line, c2->
name, e1->
exten, e2->
priority );
933 check_contexts_trouble();
937 ast_log(
LOG_NOTICE,
"Called from: %s:%d: The %s context, %s exten, %d priority has a peer_label_table entry, and shouldn't!\n", file, line, c2->
name, e1->
exten, e2->
priority );
938 check_contexts_trouble();
943 check_contexts_trouble();
948 check_contexts_trouble();
955 check_contexts_trouble();
967 for(e3=e1;e3;e3=e3->
peer) {
975 check_contexts_trouble();
1075 #ifdef NEED_DEBUG_HERE 1088 if (node && node->
exten)
1089 snprintf(extenstr,
sizeof(extenstr),
"(%p)", node->
exten);
1091 if (strlen(node->
x) > 1) {
1107 log_match_char_tree(node->
alt_char, prefix);
1119 snprintf(extenstr,
sizeof(extenstr),
"(%p)", node->
exten);
1122 if (strlen(node->
x) > 1) {
1123 ast_cli(fd,
"%s[%s]:%c:%c:%d:%s%s%s\n", prefix, node->
x, node->
is_pattern ?
'Y' :
'N',
1146 for (node2 = node; node2; node2 = node2->
next_char) {
1148 #ifdef NEED_DEBUG_HERE 1151 return node2->
exten;
1154 #ifdef NEED_DEBUG_HERE 1166 if (node && node->
x[0] ==
'.' && !node->
x[1]) {
1170 if (node && node->
x[0] ==
'!' && !node->
x[1]) {
1188 for (m4 = m3; m4; m4 = m4->
alt_char) {
1222 while (*str ==
'-') {
1228 #define MORE(s) (*candidate_exten_advance(s)) 1229 #define ADVANCE(s) candidate_exten_advance(s) 1237 ast_log(
LOG_NOTICE,
"new_find_extension called with %s on (sub)tree %s action=%s\n", str, tree->
x, action2str(action));
1239 ast_log(
LOG_NOTICE,
"new_find_extension called with %s on (sub)tree NULL action=%s\n", str, action2str(action));
1241 for (p = tree; p; p = p->
alt_char) {
1243 if (p->
x[0] ==
'N') {
1244 if (p->
x[1] == 0 && *str >=
'2' && *str <=
'9' ) {
1245 #define NEW_MATCHER_CHK_MATCH \ 1246 if (p->exten && !MORE(str)) { \ 1247 if (action == E_MATCH || action == E_SPAWN || action == E_FINDLABEL) { \ 1248 update_scoreboard(score, length + 1, spec + p->specificity, p->exten, 0, callerid, p->deleted, p); \ 1249 if (!p->deleted) { \ 1250 if (action == E_FINDLABEL) { \ 1251 if (ast_hashtab_lookup(score->exten->peer_label_table, &pattern)) { \ 1252 ast_debug(4, "Found label in preferred extension\n"); \ 1256 ast_debug(4, "returning an exact match-- first found-- %s\n", p->exten->name); \ 1263 #define NEW_MATCHER_RECURSE \ 1264 if (p->next_char && (MORE(str) || (p->next_char->x[0] == '/' && p->next_char->x[1] == 0) \ 1265 || p->next_char->x[0] == '!')) { \ 1266 if (MORE(str) || p->next_char->x[0] == '!') { \ 1267 new_find_extension(ADVANCE(str), score, p->next_char, length + 1, spec + p->specificity, callerid, label, action); \ 1268 if (score->exten) { \ 1269 ast_debug(4 ,"returning an exact match-- %s\n", score->exten->name); \ 1273 new_find_extension("/", score, p->next_char, length + 1, spec + p->specificity, callerid, label, action); \ 1274 if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) { \ 1275 ast_debug(4,"returning a (can/more) match--- %s\n", score->exten ? score->exten->name : \ 1280 } else if ((p->next_char || action == E_CANMATCH) && !MORE(str)) { \ 1281 score->canmatch = 1; \ 1282 score->canmatch_exten = get_canmatch_exten(p); \ 1283 if (action == E_CANMATCH || action == E_MATCHMORE) { \ 1284 ast_debug(4, "returning a canmatch/matchmore--- str=%s\n", str); \ 1292 }
else if (p->
x[0] ==
'Z') {
1293 if (p->
x[1] == 0 && *str >=
'1' && *str <=
'9' ) {
1297 }
else if (p->
x[0] ==
'X') {
1298 if (p->
x[1] == 0 && *str >=
'0' && *str <=
'9' ) {
1302 }
else if (p->
x[0] ==
'.' && p->
x[1] == 0) {
1305 const char *str2 =
str;
1306 while (*str2 && *str2 !=
'/') {
1310 if (p->
exten && *str2 !=
'/') {
1313 ast_debug(4,
"return because scoreboard has a match with '/'--- %s\n",
1321 ast_debug(4,
"return because scoreboard has exact match OR " 1322 "CANMATCH/MATCHMORE & canmatch set--- %s\n",
1327 }
else if (p->
x[0] ==
'!' && p->
x[1] == 0) {
1330 const char *str2 =
str;
1331 while (*str2 && *str2 !=
'/') {
1335 if (p->
exten && *str2 !=
'/') {
1338 ast_debug(4,
"return because scoreboard has a '!' match--- %s\n",
1346 ast_debug(4,
"return because scoreboard has exact match OR " 1347 "CANMATCH/MATCHMORE & canmatch set with '/' and '!'--- %s\n",
1352 }
else if (p->
x[0] ==
'/' && p->
x[1] == 0) {
1354 if (p->
next_char && callerid && *callerid) {
1357 ast_debug(4,
"return because scoreboard has exact match OR " 1358 "CANMATCH/MATCHMORE & canmatch set with '/'--- %s\n",
1363 }
else if (strchr(p->
x, *str)) {
1364 ast_debug(4,
"Nothing strange about this match\n");
1368 }
else if (strchr(p->
x, *str)) {
1369 ast_debug(4,
"Nothing strange about this match\n");
1374 ast_debug(4,
"return at end of func\n");
1405 for (t = current; t; t = t->
alt_char) {
1406 if (is_pattern == t->
is_pattern && !strcmp(pat, t->
x)) {
1424 if (!(*parent_ptr)) {
1429 if ((*parent_ptr)->specificity > node->
specificity) {
1436 lcurr = *parent_ptr;
1463 if (!(m =
ast_calloc(1,
sizeof(*m) + strlen(pattern->
buf)))) {
1470 strcpy(m->
x, pattern->
buf);
1475 if (pattern->
specif == 1 && is_pattern && pattern->
buf[0] ==
'N') {
1477 }
else if (pattern->
specif == 1 && is_pattern && pattern->
buf[0] ==
'Z') {
1479 }
else if (pattern->
specif == 1 && is_pattern && pattern->
buf[0] ==
'X') {
1481 }
else if (pattern->
specif == 1 && is_pattern && pattern->
buf[0] ==
'.') {
1483 }
else if (pattern->
specif == 1 && is_pattern && pattern->
buf[0] ==
'!') {
1515 #define INC_DST_OVERFLOW_CHECK \ 1517 if (dst - node->buf < sizeof(node->buf) - 1) { \ 1525 node->
buf[0] =
'\0';
1527 if (*src ==
'[' && pattern) {
1528 char *dst = node->
buf;
1529 const char *src_next;
1539 if (*src ==
'[' || *src ==
'\\' || *src ==
'-' || *src ==
']') {
1543 }
else if (*src ==
'-') {
1544 unsigned char first;
1548 first = *(src_next - 1);
1557 if (node->
buf[0] && last) {
1559 while (++first <= last) {
1572 }
else if (*src ==
'\0') {
1574 "A matching ']' was not found for '[' in exten pattern '%s'\n",
1577 }
else if (*src ==
']') {
1590 "Expanded character set too large to deal with in exten pattern '%s'. Ignoring character set.\n",
1592 node->
buf[0] =
'\0';
1597 length = strlen(node->
buf);
1601 node->
buf[0] =
'\0';
1608 src_next = node->
buf;
1609 while (*src_next++) {
1610 if (*dst != *src_next) {
1615 length = strlen(node->
buf);
1617 node->
specif = length | (
unsigned char) node->
buf[0];
1619 }
else if (*src ==
'-') {
1629 node->
buf[0] = *++src;
1630 if (!node->
buf[0]) {
1634 node->
buf[0] = *src;
1637 if (node->
buf[0] ==
'n') {
1639 }
else if (node->
buf[0] ==
'x') {
1641 }
else if (node->
buf[0] ==
'z') {
1646 node->
buf[1] =
'\0';
1654 #undef INC_DST_OVERFLOW_CHECK 1671 if (
sizeof(extenbuf) < strlen(e1->
exten) + strlen(e1->
cidmatch) + 2) {
1673 "The pattern %s/%s is too big to deal with: it will be ignored! Disaster!\n",
1683 ast_debug(1,
"Adding exten %s to tree\n", extenbuf);
1696 for (; pat_node[idx_cur].
buf[0]; idx_cur = idx_next) {
1697 idx_next = (idx_cur + 1) %
ARRAY_LEN(pat_node);
1704 if (!pat_node[idx_next].buf[0]) {
1738 if (!pat_node[idx_next].buf[0]) {
1739 if (m2 && m2->
exten) {
1761 int biggest_bucket, resizes, numobjs, numbucks;
1763 ast_debug(1,
"Creating Extension Trie for context %s(%p)\n", con->
name, con);
1765 ast_debug(1,
"This tree has %d objects in %d bucket lists, longest list=%d objects, and has resized %d times\n",
1766 numobjs, numbucks, biggest_bucket, resizes);
1773 ast_log(
LOG_ERROR,
"Attempt to create extension with no extension name.\n");
1791 pattern_tree->
exten = 0;
1810 while (*str ==
'-') {
1839 while (*left ==
'-') {
1842 while (*right ==
'-') {
1855 cmp = *left - *right;
1882 while (*left ==
'-') {
1885 while (*right ==
'-') {
1889 cmp = *left - *right;
1989 return 0x0800 |
'2';
1996 return 0x0A00 |
'0';
2003 return 0x0900 |
'1';
2023 end = strchr(*p,
']');
2032 for (; *p <
end; ++*p) {
2037 if (*p + 2 < end && (*p)[1] ==
'-') {
2046 for (; c1 <= c2; ++c1) {
2055 if (!(bitwise[c1 / BITS_PER] & mask)) {
2064 return count | cmin;
2085 unsigned char left_bitwise[32] = { 0, };
2086 unsigned char right_bitwise[32] = { 0, };
2090 cmp = left_pos - right_pos;
2099 cmp = memcmp(right_bitwise, left_bitwise,
ARRAY_LEN(left_bitwise));
2126 static int ext_cmp(
const char *left,
const char *right)
2129 if (left[0] !=
'_') {
2130 if (right[0] ==
'_') {
2136 if (right[0] !=
'_') {
2152 if (*exten !=
'_') {
2155 if (*exten ==
'-') {
2166 if (*exten ==
'-') {
2168 }
else if (*exten ==
'[') {
2170 exten = strchr(exten,
']');
2213 #ifdef NEED_DEBUG_HERE 2214 ast_log(
LOG_NOTICE,
"match core: pat: '%s', dat: '%s', mode=%d\n", pattern, data, (
int)mode);
2217 if (pattern[0] !=
'_') {
2222 #ifdef NEED_DEBUG_HERE 2229 #ifdef NEED_DEBUG_HERE 2230 ast_log(
LOG_NOTICE,
"return (!ext_cmp_exten(%s,%s) when mode== E_MATCH)\n", pattern, data);
2235 #ifdef NEED_DEBUG_HERE 2236 ast_log(
LOG_NOTICE,
"return (mode(%d) == E_MATCHMORE ? lp(%d) > ld(%d) : 1)\n", mode, lp, ld);
2240 #ifdef NEED_DEBUG_HERE 2241 ast_log(
LOG_NOTICE,
"return (0) when ld(%d) > 0 && pattern(%s) != data(%s)\n", ld, pattern, data);
2246 if (mode ==
E_MATCH && data[0] ==
'_') {
2256 #ifdef NEED_DEBUG_HERE 2257 ast_log(
LOG_NOTICE,
"Comparing as patterns first. pattern:%s data:%s\n", pattern, data);
2260 #ifdef NEED_DEBUG_HERE 2276 while (*data ==
'-') {
2279 while (*pattern ==
'-') {
2282 if (!*data || !*pattern || *pattern ==
'/') {
2289 end = strchr(pattern,
']');
2294 if (pattern == end) {
2299 for (; pattern <
end; ++pattern) {
2300 if (pattern+2 < end && pattern[1] ==
'-') {
2301 if (*data >= pattern[0] && *data <= pattern[2])
2307 }
else if (*data == pattern[0])
2310 if (pattern >= end) {
2311 #ifdef NEED_DEBUG_HERE 2320 if (*data < '2' || *data >
'9') {
2321 #ifdef NEED_DEBUG_HERE 2329 if (*data < '0' || *data >
'9') {
2330 #ifdef NEED_DEBUG_HERE 2338 if (*data < '1' || *data >
'9') {
2339 #ifdef NEED_DEBUG_HERE 2346 #ifdef NEED_DEBUG_HERE 2351 #ifdef NEED_DEBUG_HERE 2356 if (*data != *pattern) {
2357 #ifdef NEED_DEBUG_HERE 2358 ast_log(
LOG_NOTICE,
"return (0) when *data(%c) != *pattern(%c)\n", *data, *pattern);
2368 #ifdef NEED_DEBUG_HERE 2378 if (*pattern ==
'\0' || *pattern ==
'/') {
2379 #ifdef NEED_DEBUG_HERE 2383 }
else if (*pattern ==
'!') {
2384 #ifdef NEED_DEBUG_HERE 2389 #ifdef NEED_DEBUG_HERE 2392 return (mode ==
E_MATCH) ? 0 : 1;
2403 static int prof_id = -2;
2404 if (prof_id == -2) {
2433 struct ast_includes includes;
2434 struct ast_ignorepats ignorepats;
2435 struct ast_sws alts;
2452 if (contexts_table) {
2458 if (!strcasecmp(name, tmp->
name)) {
2467 #define STATUS_NO_CONTEXT 1 2468 #define STATUS_NO_EXTENSION 2 2469 #define STATUS_NO_PRIORITY 3 2470 #define STATUS_NO_LABEL 4 2471 #define STATUS_SUCCESS 5 2473 static int matchcid(
const char *cidpattern,
const char *callerid)
2487 const char *context,
const char *
exten,
int priority,
2488 const char *label,
const char *callerid,
enum ext_match_t action)
2500 #ifdef NEED_DEBUG_HERE 2501 ast_log(
LOG_NOTICE,
"Looking for cont/ext/prio/label/action = %s/%s/%d/%s/%d\n", context, exten, priority, label, (
int) action);
2516 for (x = 0; x < q->
stacklen; x++) {
2517 if (!strcasecmp(q->
incstack[x], context))
2542 ast_debug(1,
"Tree Created in context %s:\n", context);
2567 if (osw && strchr(osw,
'$')) {
2595 res = aswf(chan, context, exten, priority, callerid, datap);
2610 if (extenpatternmatchnew) {
2612 eroot = score.
exten;
2618 #ifdef NEED_DEBUG_HERE 2626 #ifdef NEED_DEBUG_HERE 2636 #ifdef NEED_DEBUG_HERE 2641 #ifdef NEED_DEBUG_HERE 2646 #ifdef NEED_DEBUG_HERE 2653 #ifdef NEED_DEBUG_HERE 2674 #ifdef NEED_DEBUG_HERE 2688 if (!match || (eroot->matchcid && !
matchcid(eroot->cidmatch, callerid)))
2752 res = aswf(chan, context, exten, priority, callerid, datap);
2771 #ifdef NEED_DEBUG_HERE 2791 .
type =
"EXCEPTION",
2819 ds->
data = exception;
2822 exception = ds->
data;
2836 if (!ds || !ds->
data)
2838 exception = ds->
data;
2839 if (!strcasecmp(data,
"REASON"))
2841 else if (!strcasecmp(data,
"CONTEXT"))
2843 else if (!strncasecmp(data,
"EXTEN", 5))
2845 else if (!strcasecmp(data,
"PRIORITY"))
2846 snprintf(buf, buflen,
"%d", exception->
priority);
2853 .
name =
"EXCEPTION",
2876 const char *context,
const char *
exten,
int priority,
2877 const char *label,
const char *callerid,
enum ext_match_t action,
int *found,
int combined_find_spawn)
2881 char *substitute =
NULL;
2889 context = con->
name;
2895 e =
pbx_find_extension(c, con, &q, context, exten, priority, label, callerid, action);
2899 if (matching_action) {
2917 if ((!(tmp = strchr(e->
data,
'$'))) || (!strstr(tmp,
"${") && !strstr(tmp,
"$["))) {
2927 ast_log(
LOG_WARNING,
"No application '%s' for extension (%s, %s, %d)\n", e->
app, context, exten, priority);
2941 exten, context, priority,
2953 if (matching_action) {
2967 if (!matching_action && !combined_find_spawn)
2971 if (!matching_action && !combined_find_spawn)
2975 if (!matching_action && !combined_find_spawn)
2976 ast_log(
LOG_NOTICE,
"No such priority %d in extension '%s' in context '%s'\n", priority, exten,
S_OR(context,
""));
2979 if (context && !combined_find_spawn)
2980 ast_log(
LOG_NOTICE,
"No such label '%s' in extension '%s' in context '%s'\n", label, exten,
S_OR(context,
""));
2986 return (matching_action) ? 0 : -1;
3042 if ((tmp = strrchr(copy,
','))) {
3061 if ((tmp = strrchr(copy,
','))) {
3091 while ((cur =
strsep(&rest,
"&"))) {
3095 if (device_state_info) {
3117 if (!e || !hint_app) {
3150 if (e->
exten[0] ==
'_') {
3182 if (device_state_info) {
3187 if (ret < 0 && container) {
3192 if (device_state_info) {
3203 char *presence_provider;
3206 if (!e || !hint_app) {
3234 if (e->
exten[0] ==
'_') {
3251 const char *context,
3284 res = cb(context, exten, &info, data);
3310 struct timeval chantime = {0, };
3337 snprintf(match,
sizeof(match),
"%s-", info->
device_name);
3377 int first_extended_cb_call = 1;
3394 sizeof(context_name));
3396 sizeof(exten_name));
3444 if (state_cb->
extended && first_extended_cb_call) {
3446 first_extended_cb_call = 0;
3449 if (state_cb->
extended || !same_state) {
3485 sizeof(context_name));
3487 sizeof(exten_name));
3558 char *presence_subtype =
NULL;
3559 char *presence_message =
NULL;
3563 hint->
exten, &presence_subtype, &presence_message);
3567 .subtype = presence_subtype,
3568 .message = presence_message
3593 char *virtual_device;
3630 if (dev_state->
eid) {
3655 "find devices in container");
3674 virtual_device = strchr(type,
':');
3675 device_name = strchr(type,
'/');
3676 if (virtual_device && (!device_name || (virtual_device < device_name))) {
3677 device_name = virtual_device;
3685 *device_name++ =
'\0';
3738 if (!context && !exten) {
3762 if (!context || !exten)
3775 if (e->
exten[0] ==
'_') {
3782 if (!e || e->
exten[0] ==
'_') {
3804 }
while (
id == -1 ||
id == 0);
3928 if (!hint_remove_message_type()) {
3987 char *subtype =
NULL;
4011 hint_new->
exten = e;
4012 if (strstr(e->
app,
"${") && e->
exten[0] ==
'_') {
4029 hint_found =
ao2_find(hints, e, 0);
4034 ast_debug(2,
"HINTS: Not re-adding existing hint %s: %s\n",
4040 ast_debug(2,
"HINTS: Adding hint %s: %s\n",
4050 if (!(strstr(e->
app,
"${") && e->
exten[0] ==
'_')) {
4078 if (!hint_change_message_type()) {
4249 if (found && spawn_error) {
4251 ast_debug(1,
"Spawn extension (%s,%s,%d) exited non-zero on '%s'\n",
4254 ast_verb(2,
"Spawn extension (%s, %s, %d) exited non-zero on '%s'\n",
4300 if (pos < buflen - 1) {
4370 char dst_exten[256];
4377 dst_exten[pos] =
'\0';
4415 ast_debug(1,
"Extension %s, priority %d returned normally even though call was hung up\n",
4422 if (strchr(
"0123456789ABCDEF*#", res)) {
4423 ast_debug(1,
"Oooh, got something to jump out with ('%c')!\n", res);
4425 dst_exten[pos++] = digit = res;
4426 dst_exten[pos] =
'\0';
4438 pos = strlen(dst_exten);
4502 ast_verb(3,
"Channel '%s' sent to invalid extension: context,exten,priority=%s,%s,%d\n",
4510 ast_log(
LOG_WARNING,
"Channel '%s' sent to invalid extension but no invalid handler: context,exten,priority=%s,%s,%d\n",
4522 else if (!autofallthrough)
4529 if (!strcasecmp(status,
"CONGESTION"))
4531 else if (!strcasecmp(status,
"CHANUNAVAIL"))
4533 else if (!strcasecmp(status,
"BUSY"))
4539 if (
collect_digits(c, waittime, dst_exten,
sizeof(dst_exten), pos))
4561 "Invalid extension '%s', but no rule 'i' or 'e' in context '%s'\n",
4577 "Timeout, but no rule 't' or 'e' in context '%s'\n",
4587 if (!found && !error) {
4625 #if defined(HAVE_SYSINFO) 4626 struct sysinfo sys_info;
4643 #if defined(HAVE_SYSINFO) 4646 if (!sysinfo(&sys_info)) {
4649 uint64_t curfreemem = sys_info.freeram + sys_info.bufferram;
4650 curfreemem *= sys_info.mem_unit;
4651 curfreemem /= 1024 * 1024;
4653 ast_log(
LOG_WARNING,
"Available system memory (~%" PRIu64
"MB) is below the configured low watermark (%ldMB)\n",
4777 autofallthrough = newval;
4784 extenpatternmatchnew = newval;
4790 if (overrideswitch) {
4796 overrideswitch =
NULL;
4965 matchcallerid, registrar, 0);
4992 char dummy_name[1024];
4993 char dummy_cid[1024];
4998 if (!already_locked)
5002 ast_verb(3,
"Removing %s/%s/%d%s%s from trees, registrar=%s\n", con->
name, extension, priority, matchcallerid ?
"/" :
"", matchcallerid ? callerid :
"", registrar);
5004 #ifdef CONTEXT_DEBUG 5005 check_contexts(__FILE__, __LINE__);
5008 ex.
exten = dummy_name;
5009 ext_strncpy(dummy_name, extension,
sizeof(dummy_name), 1);
5013 ext_strncpy(dummy_cid, callerid,
sizeof(dummy_cid), 1);
5019 if (priority == 0) {
5022 ast_log(
LOG_ERROR,
"Trying to delete the exten %s from context %s, but could not remove from the root_table\n", extension, con->
name);
5030 ast_log(
LOG_WARNING,
"Trying to delete an exten from a context, but the pattern tree node returned isn't a full extension\n");
5037 if (exten2->
label) {
5041 "from the peer_label_table of context %s, extension %s!\n",
5049 "peer_table of context %s, extension %s!\n",
5050 priority, con->
name, exten2->
name);
5052 if (exten2 == exten && exten2->
peer) {
5062 "context root_table (%s) (priority %d)\n",
5074 ast_log(
LOG_ERROR,
"Could not find priority %d of exten %s in context %s!\n",
5081 extension, con->
name);
5091 for (exten = con->
root; exten; prev_exten = exten, exten = exten->
next) {
5101 if (!already_locked)
5107 for (peer = exten, next_peer = exten->
peer ? exten->
peer : exten->
next;
5110 peer = next_peer, next_peer = next_peer ? (next_peer->
peer ? next_peer->
peer : next_peer->
next) :
NULL) {
5112 if ((priority == 0 || peer->
priority == priority) &&
5113 (!registrar || !strcmp(peer->
registrar, registrar) )) {
5117 if (!previous_peer) {
5132 con->
root = next_node;
5134 prev_exten->
next = next_node;
5147 previous_peer =
peer;
5150 if (!already_locked)
5152 return found ? 0 : -1;
5215 e->
command =
"core show hints";
5217 "Usage: core show hints\n" 5218 " List registered hints.\n" 5219 " Hint details are shown in five columns. In order from left to right, they are:\n" 5220 " 1. Hint extension URI.\n" 5221 " 2. List of mapped device or presence state identifiers.\n" 5222 " 3. Current extension state. The aggregate of mapped device states.\n" 5223 " 4. Current presence state for the mapped presence state provider.\n" 5224 " 5. Watchers - number of subscriptions and other entities watching this hint.\n";
5231 ast_cli(a->
fd,
"There are no registered dialplan hints\n");
5235 ast_cli(a->
fd,
"\n -= Registered Asterisk Dial Plan Hints =-\n");
5246 snprintf(buf,
sizeof(buf),
"%s@%s",
5250 ast_cli(a->
fd,
"%-20.20s: %-20.20s State:%-15.15s Presence:%-15.15s Watchers %2d\n",
5263 ast_cli(a->
fd,
"- %d hints registered\n", num);