]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
When processing RFC 2833 DTMF, accomodate increasing timestamps in End events
authorMatthew Jordan <mjordan@digium.com>
Thu, 20 Sep 2012 18:44:11 +0000 (18:44 +0000)
committerMatthew Jordan <mjordan@digium.com>
Thu, 20 Sep 2012 18:44:11 +0000 (18:44 +0000)
While endpoints should not be changing the source timestamp between DTMF event
packets, the fact is there exists those endpoints that do exactly that.  To
work around this, we absorb timestamps within the expected re-transmit period.
Note that this period only affects End of Event packets, so it should not
prevent the detection of new DTMF digits that happen to arrive right on top
of each other.

(closes issue ASTERISK-20424)
Reported by: Vladimir Mikhelson
Tested by: mjordan, Vladimir Mikhelson

Review: https://reviewboard.asterisk.org/r/2124
........

Merged revisions 373236 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 373237 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@373238 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_rtp_asterisk.c

index 958d5831c9c65c6bde9809fe2a9ada51ada14017..950fe88fd991fccadaf4eb5687f6be2adc6a98e3 100644 (file)
@@ -2859,8 +2859,9 @@ static void process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned cha
                new_duration = (new_duration & ~0xFFFF) | samples;
 
                if (event_end & 0x80) {
-                       /* End event */
-                       if ((rtp->last_seqno != seqno) && (timestamp > rtp->last_end_timestamp)) {
+                       /* End event.  Absorb re-transmits, and account for some endpoints
+                        * that erroneously increment the timestamp during re-transmissions */
+                       if ((seqno != rtp->last_seqno) && (timestamp > rtp->last_end_timestamp + 320)) {
                                rtp->last_end_timestamp = timestamp;
                                rtp->dtmf_duration = new_duration;
                                rtp->resp = resp;
@@ -2870,7 +2871,7 @@ static void process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned cha
                                rtp->dtmf_duration = rtp->dtmf_timeout = 0;
                                AST_LIST_INSERT_TAIL(frames, f, frame_list);
                        } else if (rtpdebug) {
-                               ast_debug(1, "Dropping duplicate or out of order DTMF END frame (seqno: %d, ts %d, digit %c)\n",
+                               ast_debug(1, "Dropping re-transmitted, duplicate, or out of order DTMF END frame (seqno: %d, ts %d, digit %c)\n",
                                        seqno, timestamp, resp);
                        }
                } else {