]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime.
authorFrederic LE FOLL <frederic.lefoll@c-s.fr>
Wed, 27 Nov 2019 18:11:33 +0000 (19:11 +0100)
committerFrederic LE FOLL <frederic.lefoll@c-s.fr>
Wed, 4 Dec 2019 10:52:19 +0000 (04:52 -0600)
During capabilities selection (joint capabilities of us and peer,
configured capability for this peer, or general configured
capabilities), if sip_new() does not keep framing information,
then directmedia activation will fail for any framing different
from default framing.

ASTERISK-28637

Change-Id: I99257502788653c2816fc991cac7946453082466

bridges/bridge_native_rtp.c
channels/chan_sip.c

index 34a6a6492dfce189e999cb08e6f37d4db6cc0227..3581ab98975bcfc1cf35d4df15c25c6bf7b51b55 100644 (file)
@@ -715,6 +715,8 @@ static int native_rtp_bridge_compatible_check(struct ast_bridge *bridge, struct
                                framing_inst0, framing_inst1);
                        return 0;
                }
+               ast_debug(3, "Symmetric ptimes on the two call legs (%u). May be able to native bridge in RTP\n",
+                       framing_inst0);
        }
 
        read_ptime0 = ast_format_cap_get_format_framing(cap0, ast_channel_rawreadformat(bc0->chan));
@@ -728,6 +730,9 @@ static int native_rtp_bridge_compatible_check(struct ast_bridge *bridge, struct
                        read_ptime0, write_ptime1, read_ptime1, write_ptime0);
                return 0;
        }
+       ast_debug(3, "Bridge '%s': Packetization comparison success between RTP streams (read_ptime0:%d == write_ptime1:%d and read_ptime1:%d == write_ptime0:%d).\n",
+               bridge->uniqueid,
+               read_ptime0, write_ptime1, read_ptime1, write_ptime0);
 
        return 1;
 }
index 4a8d344c25cf1ebe7545980123d0413151637e19..eb147aef9021f0954fe7cf4b54a285bbe39b83ff 100644 (file)
@@ -8143,8 +8143,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
        /* Use only the preferred audio format, which is stored at the '0' index */
        fmt = ast_format_cap_get_best_by_type(what, AST_MEDIA_TYPE_AUDIO); /* get the best audio format */
        if (fmt) {
+               int framing;
+
                ast_format_cap_remove_by_type(caps, AST_MEDIA_TYPE_AUDIO); /* remove only the other audio formats */
-               ast_format_cap_append(caps, fmt, 0); /* add our best choice back */
+               framing = ast_format_cap_get_format_framing(what, fmt);
+               ast_format_cap_append(caps, fmt, framing); /* add our best choice back */
        } else {
                /* If we don't have an audio format, try to get something */
                fmt = ast_format_cap_get_format(caps, 0);