]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
RTP: need to reset DTMF last seqno/timestamp on voice packet with marker bit
authorAlexei Gradinari <alex2grad@gmail.com>
Fri, 23 Nov 2018 15:40:50 +0000 (10:40 -0500)
committerAlexei Gradinari <alex2grad@gmail.com>
Fri, 23 Nov 2018 16:18:47 +0000 (11:18 -0500)
The marker bit set on the voice packet indicates the start
of a new stream and a new time stamp.
Need to reset the DTMF last sequence number and the timestamp
of the last END packet.

If the new time stamp is lower then the timestamp of the last DTMF END packet
the asterisk drops all DTMF frames as out of order.

This bug was caught using Cisco ip-phone SPA50X and codec g722.
On SIP session update the SPA50X resets stream indicating it with market bit
and a new timestamp is twice smaller then the previous.

ASTERISK-28162 #close

Change-Id: If9c5742158fa836ad549713a9814d46a5d2b1620

res/res_rtp_asterisk.c

index 465f9bc23ac51e381bf88d74feb00d1fb700243c..ff8e453055a774f2a0b5d18d9e444b9993b7629e 100644 (file)
@@ -6438,6 +6438,16 @@ static struct ast_frame *ast_rtp_interpret(struct ast_rtp_instance *instance, st
        switch (ast_format_get_type(rtp->f.subclass.format)) {
        case AST_MEDIA_TYPE_AUDIO:
                rtp->f.frametype = AST_FRAME_VOICE;
+
+               /* The marker bit set on the voice packet indicates the start
+                * of a new stream and a new time stamp. Need to reset the DTMF
+                * last sequence number and the timestamp of the last END packet.
+                */
+               if (mark) {
+                       rtp->last_seqno = 0;
+                       rtp->last_end_timestamp = 0;
+               }
+
                break;
        case AST_MEDIA_TYPE_VIDEO:
                rtp->f.frametype = AST_FRAME_VIDEO;