]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add some more dmachine code for args parsing
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 11 Oct 2010 23:38:30 +0000 (18:38 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 11 Oct 2010 23:38:30 +0000 (18:38 -0500)
src/switch_ivr.c
src/switch_ivr_play_say.c

index ef360d3148a79a5fedc06a5aa4395e8ba106ef24..744072c1459d354a050e9d7c0eb72dc2b4f82fcc 100644 (file)
@@ -232,7 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
                           if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
                         */
                        if (switch_channel_has_dtmf(channel)) {
-                               if (!args->input_callback && !args->buf) {
+                               if (!args->input_callback && !args->buf && !args->dmachine) {
                                        status = SWITCH_STATUS_BREAK;
                                        break;
                                }
@@ -271,6 +271,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
                        break;
                }
 
+               if (args && args->dmachine) {
+                       if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) {
+                               break;
+                       }
+               }
+
                if (sval && write_frame.datalen) {
                        switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval);
                        switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
@@ -923,12 +929,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
 
 
                if (switch_channel_has_dtmf(channel)) {
-                       if (!args->input_callback && !args->buf) {
+                       if (!args->input_callback && !args->buf && !args->dmachine) {
                                status = SWITCH_STATUS_BREAK;
                                break;
                        }
                        switch_channel_dequeue_dtmf(channel, &dtmf);
-                       status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+
+                       if (args->dmachine) {
+                               char ds[2] = {dtmf.digit, '\0'};
+                               if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) {
+                                       break;
+                               }
+                       } else if (args->input_callback) {
+                               status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+                       }
+
                        if (digit_timeout) {
                                digit_started = switch_micro_time_now();
                        }
index fd2f1a98fb6bc34b75d5fef868a714303d51168b..c99745d57c4edd3eb55895932750e3eb9241f2a8 100644 (file)
@@ -842,7 +842,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
                           if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
                         */
                        if (switch_channel_has_dtmf(channel)) {
-                               if (!args->input_callback && !args->buf) {
+                               if (!args->input_callback && !args->buf && !args->dmachine) {
                                        status = SWITCH_STATUS_BREAK;
                                        done = 1;
                                        break;
@@ -1253,7 +1253,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
                                 */
                                if (switch_channel_has_dtmf(channel)) {
-                                       if (!args->input_callback && !args->buf) {
+                                       if (!args->input_callback && !args->buf && !args->dmachine) {
                                                status = SWITCH_STATUS_BREAK;
                                                done = 1;
                                                break;
@@ -1959,7 +1959,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
                         * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
                         */
                        if (switch_channel_has_dtmf(channel)) {
-                               if (!args->input_callback && !args->buf) {
+                               if (!args->input_callback && !args->buf && !args->dmachine) {
                                        status = SWITCH_STATUS_BREAK;
                                        done = 1;
                                        break;