This commit is contained in:
Anthony Minessale 2012-11-21 10:32:41 -06:00
parent af786291ef
commit 294a6016b8
3 changed files with 14 additions and 3 deletions

View File

@ -600,6 +600,7 @@ struct sofia_profile {
sofia_dtmf_t dtmf_type;
int auto_restart;
switch_port_t sip_port;
switch_port_t extsipport;
switch_port_t tls_sip_port;
int tls_version;
unsigned int tls_timeout;

View File

@ -3988,6 +3988,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
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;
@ -4002,8 +4005,11 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
} 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 {
@ -4687,6 +4693,10 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
}
done:
if (!profile->extsipport) {
profile->extsipport = profile->sip_port;
}
if (profile_already_started) {
sofia_glue_release_profile(profile_already_started);
}

View File

@ -1373,7 +1373,7 @@ const char *sofia_glue_transport2str(const sofia_transport_t tp)
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)