Compare commits
3 Commits
505d950f31
...
0f2c4d0912
Author | SHA1 | Date |
---|---|---|
themsley-voiceflex | 0f2c4d0912 | |
Aron Podrigal | 5cb74797fe | |
Trevor Hemsley | 44e6948aaa |
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -742,7 +742,7 @@ static void do_normal_probe(switch_event_t *event)
|
||||||
|
|
||||||
"left join sip_dialogs on "
|
"left join sip_dialogs on "
|
||||||
"sip_dialogs.hostname = sip_registrations.hostname and sip_dialogs.profile_name = sip_registrations.profile_name and ("
|
"sip_dialogs.hostname = sip_registrations.hostname and sip_dialogs.profile_name = sip_registrations.profile_name and ("
|
||||||
"sip_dialogs.presence_id = sip_registrations.sip_user %q '@' %q sip_registrations.sub_host "
|
"sip_dialogs.presence_id = concat(sip_registrations.sip_user, '@', sip_registrations.sub_host) "
|
||||||
"or (sip_dialogs.sip_from_user = sip_registrations.sip_user "
|
"or (sip_dialogs.sip_from_user = sip_registrations.sip_user "
|
||||||
"and sip_dialogs.sip_from_host = sip_registrations.sip_host)) "
|
"and sip_dialogs.sip_from_host = sip_registrations.sip_host)) "
|
||||||
|
|
||||||
|
@ -751,11 +751,10 @@ static void do_normal_probe(switch_event_t *event)
|
||||||
"(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and "
|
"(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and "
|
||||||
"sip_registrations.profile_name=sip_presence.profile_name) "
|
"sip_registrations.profile_name=sip_presence.profile_name) "
|
||||||
"where sip_registrations.hostname='%q' and sip_registrations.profile_name='%q' and sip_dialogs.call_info_state != 'seized' "
|
"where sip_registrations.hostname='%q' and sip_registrations.profile_name='%q' and sip_dialogs.call_info_state != 'seized' "
|
||||||
"and sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and "
|
"and (sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and "
|
||||||
"(sip_registrations.orig_server_host='%q' or sip_registrations.sub_host='%q' "
|
"(sip_registrations.orig_server_host='%q' or sip_registrations.sub_host='%q' "
|
||||||
"))",
|
")))",
|
||||||
dh.status, dh.rpid, switch_str_nil(sub_call_id),
|
dh.status, dh.rpid, switch_str_nil(sub_call_id),
|
||||||
switch_sql_concat(), switch_sql_concat(),
|
|
||||||
mod_sofia_globals.hostname, profile->name, probe_euser, probe_host, probe_euser, probe_host, probe_host);
|
mod_sofia_globals.hostname, profile->name, probe_euser, probe_host, probe_euser, probe_host, probe_host);
|
||||||
|
|
||||||
|
|
||||||
|
@ -881,9 +880,9 @@ static void do_dialog_probe(switch_event_t *event)
|
||||||
"(sip_dialogs.sip_from_host = sip_registrations.orig_server_host or "
|
"(sip_dialogs.sip_from_host = sip_registrations.orig_server_host or "
|
||||||
"sip_dialogs.sip_from_host = sip_registrations.sip_host) ) "
|
"sip_dialogs.sip_from_host = sip_registrations.sip_host) ) "
|
||||||
"where sip_dialogs.hostname='%q' and sip_dialogs.profile_name='%q' and "
|
"where sip_dialogs.hostname='%q' and sip_dialogs.profile_name='%q' and "
|
||||||
"sip_dialogs.call_info_state != 'seized' and sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and "
|
"sip_dialogs.call_info_state != 'seized' and (sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and "
|
||||||
"(sip_registrations.orig_server_host='%q' or sip_registrations.sub_host='%q' "
|
"(sip_registrations.orig_server_host='%q' or sip_registrations.sub_host='%q' "
|
||||||
"or sip_registrations.presence_hosts like '%%%q%%'))",
|
"or sip_registrations.presence_hosts like '%%%q%%')))",
|
||||||
probe_euser, probe_host,
|
probe_euser, probe_host,
|
||||||
sub_call_id, probe_host,
|
sub_call_id, probe_host,
|
||||||
mod_sofia_globals.hostname, profile->name,
|
mod_sofia_globals.hostname, profile->name,
|
||||||
|
@ -1189,7 +1188,7 @@ static switch_event_t *actual_sofia_presence_event_handler(switch_event_t *event
|
||||||
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and "
|
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and "
|
||||||
"sip_subscriptions.sub_to_host=sip_presence.sip_host and "
|
"sip_subscriptions.sub_to_host=sip_presence.sip_host and "
|
||||||
"sip_subscriptions.profile_name=sip_presence.profile_name and "
|
"sip_subscriptions.profile_name=sip_presence.profile_name and "
|
||||||
"sip_presence.profile_name=sip_subscriptions.profile_name) "
|
"sip_subscriptions.hostname = sip_presence.hostname) "
|
||||||
"where sip_subscriptions.hostname='%q' and sip_subscriptions.profile_name='%q' and "
|
"where sip_subscriptions.hostname='%q' and sip_subscriptions.profile_name='%q' and "
|
||||||
"sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'",
|
"sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'",
|
||||||
switch_str_nil(status), switch_str_nil(rpid), mod_sofia_globals.hostname, profile->name, from);
|
switch_str_nil(status), switch_str_nil(rpid), mod_sofia_globals.hostname, profile->name, from);
|
||||||
|
|
Loading…
Reference in New Issue