[Freeswitch-svn] [commit] r4086 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Mon Jan 29 15:11:27 EST 2007


Author: anthm
Date: Mon Jan 29 15:11:26 2007
New Revision: 4086

Modified:
   freeswitch/trunk/src/switch_core.c

Log:
make send_dtmf parse w and W for 500 and 1000 ms pause

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Mon Jan 29 15:11:26 2007
@@ -2469,13 +2469,35 @@
 	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;



More information about the Freeswitch-svn mailing list