[Asterisk-code-review] res pjsip sdp rtp: Fix address family of explicit media addr... (asterisk[master])
Anonymous Coward
asteriskteam at digium.com
Thu Oct 27 22:22:58 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4182 )
Change subject: res_pjsip_sdp_rtp: Fix address family of explicit media_address.
......................................................................
res_pjsip_sdp_rtp: Fix address family of explicit media_address.
When an explicit media_address is provided the address family
in the SDP needs to be set to reflect it.
ASTERISK-26309
Change-Id: Ib9350cc91c120eb2f96f0623d3907d12af67eb79
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 12 insertions(+), 1 deletion(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index a69aa1a..71eba14 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1052,6 +1052,7 @@
pj_pool_t *pool = session->inv_session->pool_prov;
static const pj_str_t STR_IN = { "IN", 2 };
static const pj_str_t STR_IP4 = { "IP4", 3};
+ static const pj_str_t STR_IP6 = { "IP6", 3};
static const pj_str_t STR_SENDRECV = { "sendrecv", 8 };
static const pj_str_t STR_SENDONLY = { "sendonly", 8 };
pjmedia_sdp_media *media;
@@ -1116,9 +1117,19 @@
}
media->conn->net_type = STR_IN;
- /* Connection information will be updated by the multihomed module */
+ /* Assume that the connection will use IPv4 until proven otherwise */
media->conn->addr_type = STR_IP4;
pj_strdup2(pool, &media->conn->addr, hostip);
+
+ if (!ast_strlen_zero(session->endpoint->media.address)) {
+ pj_sockaddr ip;
+
+ if ((pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &media->conn->addr, &ip) == PJ_SUCCESS) &&
+ (ip.addr.sa_family == pj_AF_INET6())) {
+ media->conn->addr_type = STR_IP6;
+ }
+ }
+
ast_rtp_instance_get_local_address(session_media->rtp, &addr);
media->desc.port = direct_media_enabled ? ast_sockaddr_port(&session_media->direct_media_addr) : (pj_uint16_t) ast_sockaddr_port(&addr);
media->desc.port_count = 1;
--
To view, visit https://gerrit.asterisk.org/4182
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9350cc91c120eb2f96f0623d3907d12af67eb79
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
More information about the asterisk-code-review
mailing list