]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk: Only raise flash control frame on end.
authorJoshua C. Colp <jcolp@sangoma.com>
Mon, 29 Mar 2021 22:52:08 +0000 (19:52 -0300)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 31 Mar 2021 16:55:12 +0000 (11:55 -0500)
Flash in RTP is conveyed the same as DTMF, just with a
specific digit. In Asterisk however we do flash as a
single control frame.

This change makes it so that only on end do we provide
the flash control frame to the core. Previously we would
provide a flash control frame on both begin and end,
causing flash to work improperly.

ASTERISK-29373

Change-Id: I1accd9c6e859811336e670e698bd8bd124f33226

res/res_rtp_asterisk.c

index ac01d39ed6b308d4a09cbf69192ceb919719a567..17041fec7c5e2763f34beb62e804a73ae2cc967d 100644 (file)
@@ -5479,15 +5479,24 @@ static struct ast_frame *create_dtmf_frame(struct ast_rtp_instance *instance, en
                rtp->resp = 0;
                rtp->dtmfsamples = 0;
                return &ast_null_frame;
+       } else if (type == AST_FRAME_DTMF_BEGIN && rtp->resp == 'X') {
+               ast_debug_rtp(1, "(%p) RTP ignore flash begin from '%s'\n",
+                       instance, ast_sockaddr_stringify(&remote_address));
+               rtp->resp = 0;
+               rtp->dtmfsamples = 0;
+               return &ast_null_frame;
        }
-       ast_debug_rtp(1, "(%p) RTP creating %s DTMF Frame: %d (%c), at %s\n",
-               instance, type == AST_FRAME_DTMF_END ? "END" : "BEGIN",
-               rtp->resp, rtp->resp,
-               ast_sockaddr_stringify(&remote_address));
+
        if (rtp->resp == 'X') {
+               ast_debug_rtp(1, "(%p) RTP creating flash Frame at %s\n",
+                       instance, ast_sockaddr_stringify(&remote_address));
                rtp->f.frametype = AST_FRAME_CONTROL;
                rtp->f.subclass.integer = AST_CONTROL_FLASH;
        } else {
+               ast_debug_rtp(1, "(%p) RTP creating %s DTMF Frame: %d (%c), at %s\n",
+                       instance, type == AST_FRAME_DTMF_END ? "END" : "BEGIN",
+                       rtp->resp, rtp->resp,
+                       ast_sockaddr_stringify(&remote_address));
                rtp->f.frametype = type;
                rtp->f.subclass.integer = rtp->resp;
        }