[Freeswitch-svn] [commit] r4194 - in freeswitch/trunk/src: . mod/languages/mod_spidermonkey

Freeswitch SVN anthm at freeswitch.org
Sat Feb 10 18:16:35 EST 2007


Author: anthm
Date: Sat Feb 10 18:16:34 2007
New Revision: 4194

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/trunk/src/switch_ivr.c
   freeswitch/trunk/src/switch_rtp.c

Log:
fix dtmf bug

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Sat Feb 10 18:16:34 2007
@@ -1282,7 +1282,7 @@
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
 	char *terminators = NULL;
-	char *buf;
+	char buf[128] = "";
 	int digits;
 	int32 timeout = 5000;
 	switch_channel_t *channel;
@@ -1307,8 +1307,8 @@
 			JS_ValueToInt32(cx, argv[2], &timeout);
 		}
 
-		buf = switch_core_session_alloc(jss->session, digits);
-		switch_ivr_collect_digits_count(jss->session, buf, digits, digits, terminators, &term, timeout);
+
+		switch_ivr_collect_digits_count(jss->session, buf, sizeof(buf), digits, terminators, &term, timeout);
 		*rval = STRING_TO_JSVAL ( JS_NewStringCopyZ(cx, buf) );
 		return JS_TRUE;
 	}

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Sat Feb 10 18:16:34 2007
@@ -314,7 +314,7 @@
 		if (switch_channel_has_dtmf(channel)) {
 			char dtmf[128];
 
-			switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+			switch_channel_dequeue_dtmf(channel, dtmf, maxdigits);
 			for(i =0 ; i < (uint32_t) strlen(dtmf); i++) {
 
 				if (!switch_strlen_zero(terminators) && strchr(terminators, dtmf[i]) && terminator != NULL) {

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Sat Feb 10 18:16:34 2007
@@ -838,6 +838,7 @@
 				rtp_session->dtmf_data.last_digit = 0;
 				rtp_session->dtmf_data.dc = 0;
 			}
+
 			if (duration && end) {
 				if (key != rtp_session->dtmf_data.last_digit) {
 					char digit_str[] = {key, 0};
@@ -917,6 +918,7 @@
 		}
 		p++;
 	}
+
 	status = switch_buffer_write(rtp_session->dtmf_data.dtmf_buffer, dtmf, wr) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_MEMERR;
 	switch_mutex_unlock(rtp_session->dtmf_data.dtmf_mutex);
 



More information about the Freeswitch-svn mailing list