ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
}
profile->sipip = switch_core_strdup(profile->pool, ip);
+ } else if (!strcasecmp(var, "ext-sip-port") && val) {
+ int tmp = atoi(val);
+ if (tmp > 0) profile->extsipport = tmp;
} else if (!strcasecmp(var, "ext-sip-ip")) {
if (!zstr(val)) {
char *ip = mod_sofia_globals.guess_ip;
} else if (!strcasecmp(val, "auto-nat")) {
ip = NULL;
} else if (strcasecmp(val, "auto")) {
- switch_port_t port = 0;
- if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
+ if (!profile->extsipport) {
+ profile->extsipport = profile->sip_port;
+ }
+
+ if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &profile->extsipport, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
ip = myip;
sofia_clear_pflag(profile, PFLAG_AUTO_NAT);
} else {
}
done:
+ if (!profile->extsipport) {
+ profile->extsipport = profile->sip_port;
+ }
+
if (profile_already_started) {
sofia_glue_release_profile(profile_already_started);
}
char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport)
{
return sofia_glue_create_via(session, profile->extsipip, (sofia_glue_transport_has_tls(transport))
- ? profile->tls_sip_port : profile->sip_port, transport);
+ ? profile->tls_sip_port : profile->extsipport, transport);
}
char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport)