mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
pjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_address
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. This happens because res_pjsip_sdp_rtp/create_rtp always calls ast_instance_new with the "all" ip address (0.0.0.0 or ::). The new option causes res_pjsip_sdp_rtp/create_rtp to call ast_rtp_instance_new with the endpoint's media_address (if specified) instead of the "all" address. 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
This commit is contained in:
@@ -175,8 +175,15 @@ static int rtp_check_timeout(const void *data)
|
||||
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 (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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user