diff options
Diffstat (limited to 'res/res_pjsip_session.c')
-rw-r--r-- | res/res_pjsip_session.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 4f5071fe4..aad24382f 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -2773,13 +2773,14 @@ static pjsip_inv_callback inv_callback = { /*! \brief Hook for modifying outgoing messages with SDP to contain the proper address information */ static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_transport *transport) { + RAII_VAR(struct ast_sip_transport_state *, transport_state, ast_sip_get_transport_state(ast_sorcery_object_get_id(transport)), ao2_cleanup); struct ast_sip_nat_hook *hook = ast_sip_mod_data_get( tdata->mod_data, session_module.id, MOD_DATA_NAT_HOOK); struct pjmedia_sdp_session *sdp; int stream; /* SDP produced by us directly will never be multipart */ - if (hook || !tdata->msg->body || pj_stricmp2(&tdata->msg->body->content_type.type, "application") || + if (!transport_state || hook || !tdata->msg->body || pj_stricmp2(&tdata->msg->body->content_type.type, "application") || pj_stricmp2(&tdata->msg->body->content_type.subtype, "sdp") || ast_strlen_zero(transport->external_media_address)) { return; } @@ -2793,7 +2794,7 @@ 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->localnet, &addr) != AST_SENSE_ALLOW) { + if (ast_apply_ha(transport_state->localnet, &addr) != AST_SENSE_ALLOW) { pj_strdup2(tdata->pool, &sdp->conn->addr, transport->external_media_address); } } |