mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-03 17:30:37 +00:00
Compare commits
4 Commits
53d8375df7
...
ec82a53673
Author | SHA1 | Date | |
---|---|---|---|
|
ec82a53673 | ||
|
5cb74797fe | ||
|
a6bc59d12d | ||
|
385a3cda7d |
@ -106,6 +106,22 @@ char * pgsql_handle_get_error(switch_pgsql_handle_t *handle)
|
|||||||
return err_str;
|
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)
|
static int db_is_up(switch_pgsql_handle_t *handle)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -553,8 +569,15 @@ switch_status_t pgsql_handle_exec_detailed(const char *file, const char *func, i
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pgsql_finish_results(handle);
|
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,6 +653,7 @@ done:
|
|||||||
|
|
||||||
pgsql_free_result(&result);
|
pgsql_free_result(&result);
|
||||||
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
sstatus = SWITCH_STATUS_FALSE;
|
sstatus = SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,6 +662,7 @@ done:
|
|||||||
error:
|
error:
|
||||||
|
|
||||||
pgsql_free_result(&result);
|
pgsql_free_result(&result);
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
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;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
error:
|
error:
|
||||||
|
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
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)
|
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))
|
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 *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_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_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;
|
const char *use_name, *use_number;
|
||||||
|
|
||||||
@ -1293,8 +1300,12 @@ 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)) {
|
if (!zstr(tech_pvt->mparams.remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->mparams.remote_ip)) {
|
||||||
|
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);
|
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)) {
|
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_TLS) && sofia_glue_transport_has_tls(tech_pvt->transport)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "TLS not supported by profile\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "TLS not supported by profile\n");
|
||||||
@ -1307,7 +1318,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||||||
char *ip_addr = tech_pvt->profile->sipip;
|
char *ip_addr = tech_pvt->profile->sipip;
|
||||||
char *ipv6;
|
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;
|
ip_addr = tech_pvt->profile->extsipip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user