[asterisk-commits] res pjsip sdp rtp: RTP instance does not use same IP as expl... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 17 08:58:43 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5197 )

Change subject: res_pjsip_sdp_rtp: RTP instance does not use same IP as explicit transport
......................................................................


res_pjsip_sdp_rtp: RTP instance does not use same IP as explicit transport

Currently a wildcard address is used for the local RTP socket, which
will not always result in the same address as used by the SIP socket
(e.g. if explicit transport addresses are configured).
Use the transport's host address when binding new local RTP sockets if
available.

ASTERISK-26851

Change-Id: I098c29c9d1f79a4f970d72ba894874ac75954f1a
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index b27050e..2b31d14 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -179,6 +179,20 @@
 	if (session->endpoint->media.bind_rtp_to_media_address && !ast_strlen_zero(session->endpoint->media.address)) {
 		ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0);
 		media_address = &temp_media_address;
+	} else {
+		struct ast_sip_transport *transport =
+			ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport",
+									   session->endpoint->transport);
+
+		if (transport && transport->state) {
+			char hoststr[PJ_INET6_ADDRSTRLEN];
+
+			pj_sockaddr_print(&transport->state->host, hoststr, sizeof(hoststr), 0);
+			ast_debug(1, "Transport: %s bound to host: %s, using this for media.\n",
+					  session->endpoint->transport, hoststr);
+			ast_sockaddr_parse(media_address, hoststr, 0);
+		}
+		ao2_cleanup(transport);
 	}
 
 	if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->media.rtp.engine, sched, media_address, NULL))) {

-- 
To view, visit https://gerrit.asterisk.org/5197
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I098c29c9d1f79a4f970d72ba894874ac75954f1a
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Begg <asterisk at meric.id.au>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list