]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 376167 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Mon, 12 Nov 2012 21:25:47 +0000 (21:25 +0000)
committerAutomerge script <automerge@asterisk.org>
Mon, 12 Nov 2012 21:25:47 +0000 (21:25 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r376167 | file | 2012-11-12 14:44:56 -0600 (Mon, 12 Nov 2012) | 14 lines

  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
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10-digiumphones@376194 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/pbx.c

index edfab51d2e368aeb1b883c98d90b2b8d686effc7..e353b8cf793d59b2641736b3b3c087c7f4d80c3d 100644 (file)
@@ -7320,17 +7320,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);
@@ -7338,6 +7338,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"