From 722feefd56ba91edba2f89851b27db22932b7d45 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Fri, 27 Jan 2017 15:13:18 -0600 Subject: [PATCH] FS-9970: [mod_sofia] don't detect nat in cases when the contact is in the acl, but the packet actually came from a proxy. We need to check where we got the packet from as being a natted address instead of the contact in order to properly handle nat to our next hop --- src/mod/endpoints/mod_sofia/sofia.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8bd66b472a..e9c157d5ab 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -10042,8 +10042,12 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *last_acl = NULL; const char *contact_host = NULL; - if (sip && sip->sip_contact) { - contact_host = sip->sip_contact->m_url->url_host; + if (sip) { + if (sip->sip_via && sip->sip_via->v_host) { + contact_host = sip->sip_via->v_host; + } else if (sip->sip_contact) { + contact_host = sip->sip_contact->m_url->url_host; + } } if (!zstr(contact_host)) {