res_pjsip_session: Rewrite o= with external_media_address.
authorAlexander Traud <pabstraud@compuserve.com>
Fri, 13 Oct 2017 14:43:12 +0000 (16:43 +0200)
committerAlexander Traud <pabstraud@compuserve.com>
Sat, 14 Oct 2017 10:57:03 +0000 (12:57 +0200)
PJSIP allows a domain name as external_media_address. This allows chan_pjsip to
be used behind a NAT with changing IP addresses. The IP address of that domain
is resolved to the c= line already. This change sets also the o= line to that
domain.

ASTERISK-27341 #close

Change-Id: I690163b6e762042ec38b3995aa5c9bea909d8ec4

res/res_pjsip_session.c

index d8789ae..37ff531 100644 (file)
@@ -4006,6 +4006,7 @@ static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_trans
                if (ast_sip_transport_is_local(transport_state, &our_sdp_addr) || !transport_state->localnet) {
                        ast_debug(5, "Setting external media address to %s\n", ast_sockaddr_stringify_host(&transport_state->external_media_address));
                        pj_strdup2(tdata->pool, &sdp->conn->addr, ast_sockaddr_stringify_host(&transport_state->external_media_address));
+                       pj_strdup2(tdata->pool, &sdp->origin.addr, transport->external_media_address);
                }
        }