summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_macro.c36
-rw-r--r--apps/app_queue.c11
-rw-r--r--main/pbx.c25
-rw-r--r--third-party/pjproject/patches/config_site.h8
4 files changed, 69 insertions, 11 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 26e4262b1..61f3ab722 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -245,7 +245,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
int setmacrocontext=0;
int autoloopflag, inhangup = 0;
struct ast_str *tmp_subst = NULL;
-
+ const char *my_macro_exten = NULL;
char *save_macro_exten;
char *save_macro_context;
char *save_macro_priority;
@@ -306,12 +306,32 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
}
snprintf(fullmacro, sizeof(fullmacro), "macro-%s", macro);
- if (!ast_exists_extension(chan, fullmacro, "s", 1,
- S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
- if (!ast_context_find(fullmacro))
- ast_log(LOG_WARNING, "No such context '%s' for macro '%s'. Was called by %s@%s\n", fullmacro, macro, ast_channel_exten(chan), ast_channel_context(chan));
- else
- ast_log(LOG_WARNING, "Context '%s' for macro '%s' lacks 's' extension, priority 1\n", fullmacro, macro);
+
+ /* first search for the macro */
+ if (!ast_context_find(fullmacro)) {
+ ast_log(LOG_WARNING, "No such context '%s' for macro '%s'. Was called by %s@%s\n",
+ fullmacro, macro, ast_channel_exten(chan), ast_channel_context(chan));
+ return 0;
+ }
+
+ /* now search for the right extension */
+ if (ast_exists_extension(chan, fullmacro, "s", 1,
+ S_COR(ast_channel_caller(chan)->id.number.valid,
+ ast_channel_caller(chan)->id.number.str, NULL))) {
+ /* We have a normal macro */
+ my_macro_exten = "s";
+ } else if (ast_exists_extension(chan, fullmacro, "~~s~~", 1,
+ S_COR(ast_channel_caller(chan)->id.number.valid,
+ ast_channel_caller(chan)->id.number.str, NULL))) {
+ /* We have an AEL generated macro */
+ my_macro_exten = "~~s~~";
+ }
+
+ /* do we have a valid exten? */
+ if (!my_macro_exten) {
+ ast_log(LOG_WARNING,
+ "Context '%s' for macro '%s' lacks 's' extension, priority 1\n",
+ fullmacro, macro);
return 0;
}
@@ -363,7 +383,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
ast_set_flag(ast_channel_flags(chan), AST_FLAG_SUBROUTINE_EXEC);
/* Setup environment for new run */
- ast_channel_exten_set(chan, "s");
+ ast_channel_exten_set(chan, my_macro_exten);
ast_channel_context_set(chan, fullmacro);
ast_channel_priority_set(chan, 1);
diff --git a/apps/app_queue.c b/apps/app_queue.c
index a5cb12640..f9dd86b67 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4102,6 +4102,17 @@ static void hangupcalls(struct queue_ent *qe, struct callattempt *outgoing, stru
ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
ast_channel_publish_dial(qe->chan, outgoing->chan, outgoing->interface, "CANCEL");
+
+ /* When dialing channels it is possible that they may not ever
+ * leave the not in use state (Local channels in particular) by
+ * the time we cancel them. If this occurs but we know they were
+ * dialed we explicitly remove them from the pending members
+ * container so that subsequent call attempts occur.
+ */
+ if (outgoing->member->status == AST_DEVICE_NOT_INUSE) {
+ pending_members_remove(outgoing->member);
+ }
+
ast_hangup(outgoing->chan);
}
oo = outgoing;
diff --git a/main/pbx.c b/main/pbx.c
index 63385f91f..7cd420adb 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5794,7 +5794,8 @@ static void manager_dpsendack(struct mansession *s, const struct message *m)
static int manager_show_dialplan_helper(struct mansession *s, const struct message *m,
const char *actionidtext, const char *context,
const char *exten, struct dialplan_counters *dpc,
- const struct ast_include *rinclude)
+ const struct ast_include *rinclude,
+ int includecount, const char *includes[])
{
struct ast_context *c;
int res = 0, old_total_exten = dpc->total_exten;
@@ -5876,7 +5877,24 @@ static int manager_show_dialplan_helper(struct mansession *s, const struct messa
if (exten) {
/* Check all includes for the requested extension */
- manager_show_dialplan_helper(s, m, actionidtext, ast_get_include_name(i), exten, dpc, i);
+ if (includecount >= AST_PBX_MAX_STACK) {
+ ast_log(LOG_WARNING, "Maximum include depth exceeded!\n");
+ } else {
+ int dupe = 0;
+ int x;
+ for (x = 0; x < includecount; x++) {
+ if (!strcasecmp(includes[x], ast_get_include_name(i))) {
+ dupe++;
+ break;
+ }
+ }
+ if (!dupe) {
+ includes[includecount] = ast_get_include_name(i);
+ manager_show_dialplan_helper(s, m, actionidtext, ast_get_include_name(i), exten, dpc, i, includecount + 1, includes);
+ } else {
+ ast_log(LOG_WARNING, "Avoiding circular include of %s within %s\n", ast_get_include_name(i), context);
+ }
+ }
} else {
if (!dpc->total_items++)
manager_dpsendack(s, m);
@@ -5932,6 +5950,7 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m)
{
const char *exten, *context;
const char *id = astman_get_header(m, "ActionID");
+ const char *incstack[AST_PBX_MAX_STACK];
char idtext[256];
/* Variables used for different counters */
@@ -5947,7 +5966,7 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m)
exten = astman_get_header(m, "Extension");
context = astman_get_header(m, "Context");
- manager_show_dialplan_helper(s, m, idtext, context, exten, &counters, NULL);
+ manager_show_dialplan_helper(s, m, idtext, context, exten, &counters, NULL, 0, incstack);
if (!ast_strlen_zero(context) && !counters.context_existence) {
char errorbuf[BUFSIZ];
diff --git a/third-party/pjproject/patches/config_site.h b/third-party/pjproject/patches/config_site.h
index 07e4d97a9..f9f76dc6c 100644
--- a/third-party/pjproject/patches/config_site.h
+++ b/third-party/pjproject/patches/config_site.h
@@ -4,6 +4,14 @@
#include <sys/select.h>
+/*
+ * Defining PJMEDIA_HAS_SRTP to 0 does NOT disable Asterisk's ability to use srtp.
+ * It only disables the pjmedia srtp transport which Asterisk doesn't use.
+ * The reason for the disable is that while Asterisk works fine with older libsrtp
+ * versions, newer versions of pjproject won't compile with them.
+ */
+#define PJMEDIA_HAS_SRTP 0
+
#define PJ_HAS_IPV6 1
#define NDEBUG 1
#define PJ_MAX_HOSTNAME (256)