Compare commits
4 Commits
53d8375df7
...
ec82a53673
Author | SHA1 | Date |
---|---|---|
shaunjstokes | ec82a53673 | |
Aron Podrigal | 5cb74797fe | |
shaunjstokes | a6bc59d12d | |
shaunjstokes | 385a3cda7d |
|
@ -106,6 +106,22 @@ char * pgsql_handle_get_error(switch_pgsql_handle_t *handle)
|
|||
return err_str;
|
||||
}
|
||||
|
||||
void pgsql_handle_set_error_if_not_set(switch_pgsql_handle_t *handle, char **err)
|
||||
{
|
||||
char *err_str;
|
||||
|
||||
if (err && !(*err)) {
|
||||
err_str = pgsql_handle_get_error(handle);
|
||||
|
||||
if (zstr(err_str)) {
|
||||
switch_safe_free(err_str);
|
||||
err_str = strdup((char *)"SQL ERROR!");
|
||||
}
|
||||
|
||||
*err = err_str;
|
||||
}
|
||||
}
|
||||
|
||||
static int db_is_up(switch_pgsql_handle_t *handle)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -553,8 +569,15 @@ switch_status_t pgsql_handle_exec_detailed(const char *file, const char *func, i
|
|||
goto error;
|
||||
}
|
||||
|
||||
return pgsql_finish_results(handle);
|
||||
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
error:
|
||||
pgsql_handle_set_error_if_not_set(handle, err);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -630,6 +653,7 @@ done:
|
|||
|
||||
pgsql_free_result(&result);
|
||||
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
||||
pgsql_handle_set_error_if_not_set(handle, err);
|
||||
sstatus = SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -638,6 +662,7 @@ done:
|
|||
error:
|
||||
|
||||
pgsql_free_result(&result);
|
||||
pgsql_handle_set_error_if_not_set(handle, err);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
@ -1050,6 +1075,8 @@ switch_status_t pgsql_handle_callback_exec_detailed(const char *file, const char
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
error:
|
||||
|
||||
pgsql_handle_set_error_if_not_set(handle, err);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -770,6 +770,12 @@ const char *sofia_glue_transport2str(const sofia_transport_t tp)
|
|||
}
|
||||
}
|
||||
|
||||
char *sofia_glue_create_external_via_custom(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport, const char *ip)
|
||||
{
|
||||
return sofia_glue_create_via(session, ip, (sofia_glue_transport_has_tls(transport))
|
||||
? profile->tls_sip_port : profile->extsipport, transport);
|
||||
}
|
||||
|
||||
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))
|
||||
|
@ -1183,6 +1189,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display");
|
||||
const char *invite_req_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_req_uri");
|
||||
const char *invite_domain = switch_channel_get_variable(tech_pvt->channel, "sip_invite_domain");
|
||||
const char *invite_via_host = switch_channel_get_variable(tech_pvt->channel, "sip_invite_via_host");
|
||||
|
||||
const char *use_name, *use_number;
|
||||
|
||||
|
@ -1293,7 +1300,11 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
}
|
||||
|
||||
if (!zstr(tech_pvt->mparams.remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->mparams.remote_ip)) {
|
||||
tech_pvt->user_via = sofia_glue_create_external_via(session, tech_pvt->profile, tech_pvt->transport);
|
||||
if (!zstr(invite_via_host)) {
|
||||
tech_pvt->user_via = sofia_glue_create_external_via_custom(session, tech_pvt->profile, tech_pvt->transport, invite_via_host);
|
||||
} else {
|
||||
tech_pvt->user_via = sofia_glue_create_external_via(session, tech_pvt->profile, tech_pvt->transport);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_TLS) && sofia_glue_transport_has_tls(tech_pvt->transport)) {
|
||||
|
@ -1307,7 +1318,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
char *ip_addr = tech_pvt->profile->sipip;
|
||||
char *ipv6;
|
||||
|
||||
if ( !zstr(tech_pvt->mparams.remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->mparams.remote_ip ) ) {
|
||||
const char *invite_contact_host;
|
||||
if ((invite_contact_host = switch_channel_get_variable(channel, "sip_invite_contact_host"))) {
|
||||
ip_addr = (char *) invite_contact_host;
|
||||
} else if ( !zstr(tech_pvt->mparams.remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->mparams.remote_ip ) ) {
|
||||
ip_addr = tech_pvt->profile->extsipip;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue