From c2b78628eef6abc2470d3e57daa2effd2d150e73 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 15 Jan 2007 04:32:21 +0000 Subject: [PATCH] bind to the right address when using ext-sip-ip git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3962 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index d7a9f14ad9..d310ea328f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -227,6 +227,7 @@ struct sofia_profile { char *extsipip; char *username; char *url; + char *bindurl; char *sipdomain; char *timer_name; int sip_port; @@ -4633,7 +4634,7 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void profile->nua = nua_create(profile->s_root, /* Event loop */ event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ - NUTAG_URL(profile->url), + NUTAG_URL(profile->bindurl), NTATAG_UDP_MTU(65536), TAG_END()); /* Last tag should always finish the sequence */ @@ -4779,7 +4780,7 @@ static switch_status_t config_sofia(int reload) switch_status_t status = SWITCH_STATUS_SUCCESS; sofia_profile_t *profile = NULL; char url[512] = ""; - + char bindurl[512] =""; switch_mutex_lock(globals.mutex); globals.running = 1; switch_mutex_unlock(globals.mutex); @@ -4954,10 +4955,14 @@ static switch_status_t config_sofia(int reload) } if (profile->extsipip) { snprintf(url, sizeof(url), "sip:mod_sofia@%s:%d", profile->extsipip, profile->sip_port); + snprintf(bindurl, sizeof(url), "sip:mod_sofia@%s:%d", profile->sipip, profile->sip_port); + profile->url = switch_core_strdup(profile->pool, url); + profile->bindurl = switch_core_strdup(profile->pool, bindurl); } else { snprintf(url, sizeof(url), "sip:mod_sofia@%s:%d", profile->sipip, profile->sip_port); + profile->url = switch_core_strdup(profile->pool, url); + profile->bindurl = profile->url; } - profile->url = switch_core_strdup(profile->pool, url); } if (profile) { if ((registrations = switch_xml_child(xprofile, "registrations"))) {