]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Jul 2008 22:07:00 +0000 (22:07 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Jul 2008 22:07:00 +0000 (22:07 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8912 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_async.c

index 2d2924e18aba99226c7f8f79673be552f254010a..16f41a257669dcfcbd89ee01dd7afba27ddf2a63 100644 (file)
@@ -1518,6 +1518,49 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj
                                goto done;
                        }
 
+                       if (status == SWITCH_STATUS_SUCCESS && switch_true(switch_channel_get_variable(channel, "asr_intercept_dtmf"))) {
+                               const char *p;
+
+                               if ((p = switch_stristr("<input>", xmlstr))) {
+                                       p += 7;
+                               }
+                               
+                               while(p && *p) {
+                                       char c;
+
+                                       if (*p == '<') {
+                                               break;
+                                       }
+                                       
+                                       if (!strncasecmp(p, "pound", 5)) {
+                                               c = '#';
+                                               p += 5;
+                                       } else if (!strncasecmp(p, "hash", 4)) {
+                                               c = '#';
+                                               p += 4;
+                                       } else if (!strncasecmp(p, "star", 4)) {
+                                               c = '*';
+                                               p += 4;
+                                       } else if (!strncasecmp(p, "asterisk", 8)) {
+                                               c = '*';
+                                               p += 8;
+                                       } else {
+                                               c = *p;
+                                               p++;
+                                       }
+                                       
+                                       if (is_dtmf(c)) {
+                                               switch_dtmf_t dtmf;
+                                               dtmf.digit = c;
+                                               dtmf.duration = switch_core_default_dtmf_duration(0);
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queue speech detected dtmf %c\n", c);
+                                               switch_channel_queue_dtmf(channel, &dtmf);                                              
+                                       }
+                                       
+                               }
+                               switch_ivr_resume_detect_speech(sth->session);
+                       }
+
                        if (switch_event_create(&event, SWITCH_EVENT_DETECTED_SPEECH) == SWITCH_STATUS_SUCCESS) {
                                if (status == SWITCH_STATUS_SUCCESS) {
                                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Speech-Type", "detected-speech");