[Asterisk-code-review] pjsip sdp rtp: Make create rtp use endpt/media address for ... (asterisk[13])
George Joseph
asteriskteam at digium.com
Thu Jan 7 12:13:35 CST 2016
George Joseph has uploaded a new change for review.
https://gerrit.asterisk.org/1928
Change subject: pjsip_sdp_rtp: Make create_rtp use endpt/media_address for new rtp instance
......................................................................
pjsip_sdp_rtp: Make create_rtp use endpt/media_address for new rtp instance
On a system with multiple ip addresses in the same subnet, if a
transport is bound to a specific ip address and endpoint/media_address
is set, the SIP/SDP will have the correct address in all fields but
the rtp stream MAY still originate from one of the other ip addresses,
most probably the "primary" ip address.
With this patch, res_pjsip_sdp_rtp/create_rtp calls ast_rtp_instance_new
with the endpoint's media_address (if specified) instead of the "all"
address (0.0.0.0 or ::). This causes the packets to originate from
the specified address.
ASTERISK-25632
ASTERISK-25637
Reported-by: Olivier Krief
Reported-by: Dan Journo
Change-Id: I3dfaa079e54ba7fb7c4fd1f5f7bd9509bbf8bd88
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/28/1928/1
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index f733ea4..aa644e6 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -175,8 +175,15 @@
static int create_rtp(struct ast_sip_session *session, struct ast_sip_session_media *session_media, unsigned int ipv6)
{
struct ast_rtp_engine_ice *ice;
+ struct ast_sockaddr temp_media_address;
+ struct ast_sockaddr *media_address = ipv6 ? &address_ipv6 : &address_ipv4;
- if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->media.rtp.engine, sched, ipv6 ? &address_ipv6 : &address_ipv4, NULL))) {
+ if (!ast_strlen_zero(session->endpoint->media.address)) {
+ ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0);
+ media_address = &temp_media_address;
+ }
+
+ if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->media.rtp.engine, sched, media_address, NULL))) {
ast_log(LOG_ERROR, "Unable to create RTP instance using RTP engine '%s'\n", session->endpoint->media.rtp.engine);
return -1;
}
--
To view, visit https://gerrit.asterisk.org/1928
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3dfaa079e54ba7fb7c4fd1f5f7bd9509bbf8bd88
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
More information about the asterisk-code-review
mailing list