]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
bind to the right address when using ext-sip-ip
authorMichael Jerris <mike@jerris.com>
Mon, 15 Jan 2007 04:32:21 +0000 (04:32 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 15 Jan 2007 04:32:21 +0000 (04:32 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3962 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c

index d7a9f14ad952d77dfeb2795c3c9bb43fbc1033a7..d310ea328f015fb2340d90263d686fe54c424ef1 100644 (file)
@@ -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"))) {