mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res/res_pjsip_session: Only check localnet if it is defined
If local_net is not defined on a transport, transport_state->localnet will be NULL. ast_apply_ha will, be default, return AST_SENSE_ALLOW in this case, causing the external_media_address, if set, to be skipped. This patch causes us to only check if we are sending within a network if local_net is defined. ASTERISK-26879 #close Change-Id: Ib661c31a954cabc9c99f1f25c9c9a5c5b82cbbfb
This commit is contained in:
@@ -3148,7 +3148,10 @@ static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_trans
|
||||
ast_copy_pj_str(host, &sdp->conn->addr, sizeof(host));
|
||||
ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);
|
||||
|
||||
if (ast_apply_ha(transport_state->localnet, &addr) != AST_SENSE_ALLOW) {
|
||||
if (!transport_state->localnet
|
||||
|| (transport_state->localnet
|
||||
&& ast_apply_ha(transport_state->localnet, &addr) == AST_SENSE_ALLOW)) {
|
||||
ast_debug(5, "Setting external media address to %s\n", transport->external_media_address);
|
||||
pj_strdup2(tdata->pool, &sdp->conn->addr, transport->external_media_address);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user