]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make send_dtmf parse w and W for 500 and 1000 ms pause
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 29 Jan 2007 20:11:26 +0000 (20:11 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 29 Jan 2007 20:11:26 +0000 (20:11 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4086 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_core.c

index 98a2e172587cfd5dae0dd3e994a2694355610421..16dd598247bb106cda3956694a5df2a02d004f49 100644 (file)
@@ -2469,13 +2469,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
        switch_status_t status = SWITCH_STATUS_FALSE;
 
        if (session->endpoint_interface->io_routines->send_dtmf) {
-               if ((status = session->endpoint_interface->io_routines->send_dtmf(session, dtmf)) == SWITCH_STATUS_SUCCESS) {
-                       for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
-                               if ((status = ptr->send_dtmf(session, dtmf)) != SWITCH_STATUS_SUCCESS) {
-                                       break;
-                               }
-                       }
-               }
+        if (strchr(dtmf, 'w') || strchr(dtmf, 'W')) {
+            char *d;
+            for (d = dtmf; d && *d; d++) {
+                char digit[2] = "";
+                
+                if (*d == 'w') {
+                    switch_yield(500000);
+                    continue;
+                } else if (*d == 'W') {
+                    switch_yield(1000000);
+                    continue;
+                }
+
+                digit[0] = *d;
+                if ((status = session->endpoint_interface->io_routines->send_dtmf(session, digit)) != SWITCH_STATUS_SUCCESS) {
+                    return status;
+                }
+            }
+        } else {
+            status = session->endpoint_interface->io_routines->send_dtmf(session, dtmf);
+        }
+
+        if (status == SWITCH_STATUS_SUCCESS) {
+            for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
+                if ((status = ptr->send_dtmf(session, dtmf)) != SWITCH_STATUS_SUCCESS) {
+                    break;
+                }
+            }
+        }
        }
 
        return status;