From 1b5ea9482f97877c0c257f81fcf8d51fc62d42c0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 22 Mar 2007 20:55:46 +0000 Subject: [PATCH] dunno maybe this will work git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4735 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_rtp.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index fc9d4d135f..b7dedec88b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -105,6 +105,7 @@ struct switch_rtp_rfc2833_data { unsigned char out_digit_packet[4]; unsigned int out_digit_sofar; unsigned int out_digit_dur; + uint16_t in_digit_seq; uint16_t out_digit_seq; uint32_t out_digit_ssrc; int32_t timestamp_dtmf; @@ -910,31 +911,36 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ int end = packet[1]&0x80; int duration = (packet[2]<<8) + packet[3]; char key = switch_rfc2833_to_char(packet[0]); + uint16_t in_digit_seq = ntohs((uint16_t)rtp_session->recv_msg.header.seq); /* SHEESH.... Curse you RFC2833 inventors!!!!*/ if ((time(NULL) - rtp_session->dtmf_data.last_digit_time) > 2) { rtp_session->dtmf_data.last_digit = 0; rtp_session->dtmf_data.dc = 0; } + if (in_digit_seq > rtp_session->dtmf_data.in_digit_seq) { + rtp_session->dtmf_data.in_digit_seq = in_digit_seq; + + if (duration && end) { + if (key != rtp_session->dtmf_data.last_digit) { + char digit_str[] = {key, 0}; + time(&rtp_session->dtmf_data.last_digit_time); + switch_rtp_queue_dtmf(rtp_session, digit_str); + } + if (++rtp_session->dtmf_data.dc >= 3) { + 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}; - time(&rtp_session->dtmf_data.last_digit_time); - switch_rtp_queue_dtmf(rtp_session, digit_str); - } - if (++rtp_session->dtmf_data.dc >= 3) { + rtp_session->dtmf_data.last_digit = key; + } else { rtp_session->dtmf_data.last_digit = 0; rtp_session->dtmf_data.dc = 0; } - - rtp_session->dtmf_data.last_digit = key; - } else { - rtp_session->dtmf_data.last_digit = 0; - rtp_session->dtmf_data.dc = 0; } continue; + } break;