summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2012-11-12 20:46:51 +0000
committerJoshua Colp <jcolp@digium.com>2012-11-12 20:46:51 +0000
commitc42d9d0d62f15bb7d69fa20b8b201f9484de7738 (patch)
tree72b773655726a4fd128b2d0b172c00d9e309ee09
parentd04bf3021519473e8c39d16e26a56668f500fd8e (diff)
Properly check if the "Context" and "Extension" headers are empty in a ShowDialPlan action.
The code which handles the ShowDialPlan action wrongly assumed that a non-NULL return value from the function which retrieves headers from an action indicates that the header has a value. This is incorrect and the contents must be checked to see if they are blank. (closes issue ASTERISK-20628) Reported by: jkroon Patches: asterisk-showdialplan-incorrect-error.patch uploaded by jkroon ........ Merged revisions 376166 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376167 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376168 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--main/pbx.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/pbx.c b/main/pbx.c
index e0fc3cbee..19b284c83 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7891,17 +7891,17 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m)
manager_show_dialplan_helper(s, m, idtext, context, exten, &counters, NULL);
- if (context && !counters.context_existence) {
+ if (!ast_strlen_zero(context) && !counters.context_existence) {
char errorbuf[BUFSIZ];
snprintf(errorbuf, sizeof(errorbuf), "Did not find context %s", context);
astman_send_error(s, m, errorbuf);
return 0;
}
- if (exten && !counters.extension_existence) {
+ if (!ast_strlen_zero(exten) && !counters.extension_existence) {
char errorbuf[BUFSIZ];
- if (context)
+ if (!ast_strlen_zero(context))
snprintf(errorbuf, sizeof(errorbuf), "Did not find extension %s@%s", exten, context);
else
snprintf(errorbuf, sizeof(errorbuf), "Did not find extension %s in any context", exten);
@@ -7909,6 +7909,10 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m)
return 0;
}
+ if (!counters.total_items) {
+ manager_dpsendack(s, m);
+ }
+
astman_append(s, "Event: ShowDialPlanComplete\r\n"
"EventList: Complete\r\n"
"ListItems: %d\r\n"