]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11807 [mod_commands] uuid_recv_dtmf changed to report OK when well formed request...
authorChris Rienzo <chris@signalwire.com>
Wed, 24 Apr 2019 18:27:27 +0000 (14:27 -0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 17 Jul 2019 19:00:44 +0000 (23:00 +0400)
src/mod/applications/mod_commands/mod_commands.c
src/switch_channel.c

index 3ab5007ee3e0bf0f516f07728c0dd612edc1134f..c188defa64bdc51e302e908309f7c4498f210565 100644 (file)
@@ -6347,11 +6347,10 @@ SWITCH_STANDARD_API(uuid_recv_dtmf_function)
                return SWITCH_STATUS_SUCCESS;
        }
 
-    if (switch_channel_queue_dtmf_string(switch_core_session_get_channel(psession), dtmf_data) == SWITCH_STATUS_SUCCESS) {
-               stream->write_function(stream, "+OK %s received DTMF %s.\n", uuid, dtmf_data);
-       } else {
-               stream->write_function(stream, "-ERR Operation failed\n");
+       if (switch_channel_queue_dtmf_string(switch_core_session_get_channel(psession), dtmf_data) == SWITCH_STATUS_GENERR) {
+               goto usage;
        }
+       stream->write_function(stream, "+OK %s received DTMF %s.\n", uuid, dtmf_data);
 
        goto done;
 
index 4283a162315f22542666dbc66707d95ef6dc6e5f..c638fbc6285c9ff925628177e94d706a4d8b4e72 100644 (file)
@@ -570,13 +570,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_
 {
        char *p;
        switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0), 0, SWITCH_DTMF_APP };
-       int sent = 0, dur;
+       int sent = 0, dur, bad_input = 0;
        char *string;
        int i, argc;
        char *argv[256];
 
        if (zstr(dtmf_string)) {
-               return SWITCH_STATUS_FALSE;
+               return SWITCH_STATUS_GENERR;
        }
 
 
@@ -619,12 +619,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_
                                                                          switch_channel_get_name(channel), dtmf.digit, dur, dtmf.duration);
                                        sent++;
                                }
+                       } else {
+                               bad_input++;
                        }
                }
 
        }
-
-       return sent ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+       if (sent) {
+               return SWITCH_STATUS_SUCCESS;
+       }
+       return bad_input ? SWITCH_STATUS_GENERR : SWITCH_STATUS_FALSE;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *channel, switch_dtmf_t *dtmf)