]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix dtmf bug
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 10 Feb 2007 23:16:34 +0000 (23:16 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 10 Feb 2007 23:16:34 +0000 (23:16 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4194 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
src/switch_ivr.c
src/switch_rtp.c

index 2dbd0beb5f6cfa27f76d397c33297eea6436f0ff..6080808236498c5e620e08d5b413d30c7c8e67e3 100644 (file)
@@ -1282,7 +1282,7 @@ static JSBool session_get_digits(JSContext *cx, JSObject *obj, uintN argc, jsval
 {
        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 @@ static JSBool session_get_digits(JSContext *cx, JSObject *obj, uintN argc, jsval
                        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;
        }
index e014819cd58857642438f05c221ad2079e0c37d6..b3d745b3d3ab1a117133ba5244f796cc8214834e 100644 (file)
@@ -314,7 +314,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
                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) {
index 3a8cfa31ccbffc5f8b5383c4e8372e3210539fb0..fcfd8a16ae82fecb941d385af067bcbf028cb03e 100644 (file)
@@ -838,6 +838,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                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 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_queue_dtmf(switch_rtp_t *rtp_session,
                }
                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);