indent run
This commit is contained in:
parent
4f235af8b4
commit
f2ea3ee315
|
@ -121,7 +121,7 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
|
|||
}
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
|
||||
switch_mutex_unlock(tech_pvt->sofia_mutex);
|
||||
|
||||
|
@ -702,7 +702,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) {
|
||||
/* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless
|
||||
we do so in this case we will abandon the SOA rules and go rogue.
|
||||
*/
|
||||
*/
|
||||
sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
|
||||
}
|
||||
|
||||
|
@ -1100,7 +1100,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||
tech_pvt->mismatch_count = 0;
|
||||
tech_pvt->last_ts = 0;
|
||||
}
|
||||
skip:
|
||||
skip:
|
||||
|
||||
if ((bytes = tech_pvt->read_impl.encoded_bytes_per_packet)) {
|
||||
frames = (tech_pvt->read_frame.datalen / bytes);
|
||||
|
@ -2162,7 +2162,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) {
|
||||
/* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless
|
||||
we do so in this case we will abandon the SOA rules and go rogue.
|
||||
*/
|
||||
*/
|
||||
sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
|
||||
}
|
||||
|
||||
|
@ -2207,7 +2207,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
break;
|
||||
}
|
||||
|
||||
end_lock:
|
||||
end_lock:
|
||||
|
||||
//if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
|
||||
//sofia_send_callee_id(session, NULL, NULL);
|
||||
|
@ -2215,7 +2215,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
|
||||
switch_mutex_unlock(tech_pvt->sofia_mutex);
|
||||
|
||||
end:
|
||||
end:
|
||||
|
||||
if (switch_channel_down(channel) || !tech_pvt || sofia_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
|
@ -3158,7 +3158,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
|||
|
||||
stream->write_function(stream, "-ERR Unknown command!\n");
|
||||
|
||||
done:
|
||||
done:
|
||||
if (profile) {
|
||||
sofia_glue_release_profile(profile);
|
||||
}
|
||||
|
@ -3456,7 +3456,7 @@ SWITCH_STANDARD_API(sofia_gateway_data_function)
|
|||
|
||||
sofia_reg_release_gateway(gateway);
|
||||
|
||||
end:
|
||||
end:
|
||||
switch_safe_free(mydata);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -3559,7 +3559,7 @@ SWITCH_STANDARD_API(sofia_function)
|
|||
stream->write_function(stream, "Unknown Command [%s]\n", argv[0]);
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
switch_safe_free(mycmd);
|
||||
return status;
|
||||
}
|
||||
|
@ -3946,7 +3946,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||
if (switch_core_session_compare(session, nsession)) {
|
||||
/* It's another sofia channel! so lets cache what they use as a pt for telephone event so
|
||||
we can keep it the same
|
||||
*/
|
||||
*/
|
||||
private_object_t *ctech_pvt;
|
||||
ctech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(ctech_pvt != NULL);
|
||||
|
@ -3979,14 +3979,14 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||
|
||||
goto done;
|
||||
|
||||
error:
|
||||
error:
|
||||
if (nsession) {
|
||||
switch_core_session_destroy(&nsession);
|
||||
}
|
||||
if (pool) {
|
||||
*pool = NULL;
|
||||
}
|
||||
done:
|
||||
done:
|
||||
|
||||
if (profile) {
|
||||
if (cause == SWITCH_CAUSE_SUCCESS) {
|
||||
|
@ -4140,12 +4140,12 @@ static void general_event_handler(switch_event_t *event)
|
|||
sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
|
||||
"from sip_registrations where mwi_user='%s' and mwi_host='%q'",
|
||||
ct, es, switch_str_nil(body), switch_str_nil(user), switch_str_nil(host)
|
||||
);
|
||||
);
|
||||
} else {
|
||||
sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
|
||||
"from sip_registrations where sip_user='%s' and sip_host='%q'",
|
||||
ct, es, switch_str_nil(body), switch_str_nil(user), switch_str_nil(host)
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4299,7 +4299,7 @@ static void general_event_handler(switch_event_t *event)
|
|||
sofia_glue_release_profile(profile);
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
|
||||
switch_safe_free(local_dup);
|
||||
|
||||
|
@ -4463,7 +4463,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
|
|||
status = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
|
||||
switch_safe_free(dup);
|
||||
|
||||
|
@ -4553,6 +4553,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
|||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, MY_EVENT_RECOVERY, sofia_glue_track_event_handler, NULL,
|
||||
&mod_sofia_globals.recovery_node) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, general_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
|
@ -4647,6 +4653,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
|
|||
switch_event_unbind(&mod_sofia_globals.roster_node);
|
||||
switch_event_unbind(&mod_sofia_globals.custom_node);
|
||||
switch_event_unbind(&mod_sofia_globals.mwi_node);
|
||||
switch_event_unbind(&mod_sofia_globals.recovery_node);
|
||||
switch_event_unbind_callback(general_event_handler);
|
||||
|
||||
while (mod_sofia_globals.threads) {
|
||||
|
|
|
@ -83,6 +83,8 @@ typedef struct private_object private_object_t;
|
|||
#define MY_EVENT_REINVITE "sofia::reinvite"
|
||||
#define MY_EVENT_GATEWAY_ADD "sofia::gateway_add"
|
||||
#define MY_EVENT_GATEWAY_DEL "sofia::gateway_delete"
|
||||
#define MY_EVENT_RECOVERY "sofia::recovery"
|
||||
#define MY_EVENT_RECOVERY_SEND "sofia::recovery_send"
|
||||
|
||||
#define MULTICAST_EVENT "multicast::event"
|
||||
#define SOFIA_REPLACES_HEADER "_sofia_replaces_"
|
||||
|
@ -209,6 +211,7 @@ typedef enum {
|
|||
PFLAG_PASS_CALLEE_ID,
|
||||
PFLAG_LOG_AUTH_FAIL,
|
||||
PFLAG_TRACK_CALLS,
|
||||
PFLAG_TRACK_CALLS_EVENTS,
|
||||
PFLAG_DESTROY,
|
||||
PFLAG_EXTENDED_INFO_PARSING,
|
||||
PFLAG_T38_PASSTHRU,
|
||||
|
@ -295,6 +298,7 @@ struct mod_sofia_globals {
|
|||
switch_event_node_t *roster_node;
|
||||
switch_event_node_t *custom_node;
|
||||
switch_event_node_t *mwi_node;
|
||||
switch_event_node_t *recovery_node;
|
||||
int guess_mask;
|
||||
char guess_mask_str[16];
|
||||
int debug_presence;
|
||||
|
@ -761,8 +765,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||
|
||||
void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
|
||||
|
||||
void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
|
||||
tagi_t tags[]);
|
||||
void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
||||
|
||||
void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
|
||||
tagi_t tags[]);
|
||||
|
@ -792,6 +795,7 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
|
|||
void event_handler(switch_event_t *event);
|
||||
void sofia_presence_event_handler(switch_event_t *event);
|
||||
void sofia_presence_mwi_event_handler(switch_event_t *event);
|
||||
void sofia_glue_track_event_handler(switch_event_t *event);
|
||||
void sofia_presence_cancel(void);
|
||||
switch_status_t config_sofia(int reload, char *profile_name);
|
||||
void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_regtype_t regtype, const char *realm, int stale);
|
||||
|
@ -910,7 +914,7 @@ void sofia_reg_release_gateway__(const char *file, const char *func, int line, s
|
|||
/*
|
||||
* Transport handling helper functions
|
||||
*/
|
||||
sofia_transport_t sofia_glue_via2transport(const sip_via_t *via);
|
||||
sofia_transport_t sofia_glue_via2transport(const sip_via_t * via);
|
||||
sofia_transport_t sofia_glue_url2transport(const url_t *url);
|
||||
sofia_transport_t sofia_glue_str2transport(const char *str);
|
||||
|
||||
|
@ -922,8 +926,7 @@ char *sofia_glue_strip_uri(const char *str);
|
|||
int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip);
|
||||
int sofia_glue_transport_has_tls(const sofia_transport_t tp);
|
||||
const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name);
|
||||
switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type,
|
||||
switch_rtp_crypto_direction_t direction);
|
||||
switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction);
|
||||
void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt);
|
||||
switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt);
|
||||
void sofia_presence_event_thread_start(void);
|
||||
|
|
|
@ -2949,8 +2949,13 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
|
||||
}
|
||||
} else if (!strcasecmp(var, "track-calls") && switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_TRACK_CALLS);
|
||||
} else if (!strcasecmp(var, "track-calls")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_TRACK_CALLS);
|
||||
} else if (!strcasecmp(val, "events")) {
|
||||
sofia_set_pflag(profile, PFLAG_TRACK_CALLS);
|
||||
sofia_set_pflag(profile, PFLAG_TRACK_CALLS_EVENTS);
|
||||
}
|
||||
} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact") && switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
|
||||
} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
|
||||
|
|
|
@ -4403,7 +4403,6 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
|
|||
}
|
||||
|
||||
switch_channel_set_variable(channel, "sip_invite_call_id", switch_channel_get_variable(channel, "sip_call_id"));
|
||||
switch_channel_set_variable(channel, "sip_invite_cseq", switch_channel_get_variable(channel, "sip_cseq"));
|
||||
|
||||
if (switch_true(switch_channel_get_variable(channel, "sip_nat_detected"))) {
|
||||
switch_channel_set_variable_printf(channel, "sip_route_uri", "sip:%s@%s:%s",
|
||||
|
@ -4575,9 +4574,28 @@ int sofia_glue_recover(switch_bool_t flush)
|
|||
return r;
|
||||
}
|
||||
|
||||
void sofia_glue_track_event_handler(switch_event_t *event)
|
||||
{
|
||||
char *sql, *buf = NULL;
|
||||
char *profile_name = NULL;
|
||||
|
||||
switch_assert(event); // Just a sanity check
|
||||
|
||||
if ((buf = switch_event_get_header_nil(event, "sql")) && (profile_name = switch_event_get_header_nil(event, "profile_name"))) {
|
||||
sofia_profile_t *profile;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", switch_event_get_header_nil(event, "Event-Calling-Function"));
|
||||
if ((profile = sofia_glue_find_profile(profile_name))) {
|
||||
sql = switch_mprintf("%s", buf);
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
sofia_glue_release_profile(profile);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *session, switch_bool_t force)
|
||||
{
|
||||
char *sql;
|
||||
char *sql = NULL;
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
|
||||
if (!sofia_test_pflag(profile, PFLAG_TRACK_CALLS) || (sofia_test_flag(tech_pvt, TFLAG_RECOVERING))) {
|
||||
|
@ -4585,6 +4603,7 @@ void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *se
|
|||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_TRACK_CALLS) && (sofia_test_flag(tech_pvt, TFLAG_TRACKED) || force)) {
|
||||
switch_event_t *event = NULL;
|
||||
|
||||
if (force) {
|
||||
sql = switch_mprintf("delete from sip_recovery where uuid='%q'", switch_core_session_get_uuid(session));
|
||||
|
@ -4593,15 +4612,29 @@ void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *se
|
|||
sql = switch_mprintf("delete from sip_recovery where runtime_uuid='%q' and uuid='%q'",
|
||||
switch_core_get_uuid(), switch_core_session_get_uuid(session));
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_TRACK_CALLS_EVENTS)) {
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RECOVERY_SEND) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sql", sql);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
}
|
||||
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
sofia_clear_flag(tech_pvt, TFLAG_TRACKED);
|
||||
|
||||
switch_safe_free(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *session)
|
||||
{
|
||||
switch_event_t *event;
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_xml_t cdr = NULL;
|
||||
char *xml_cdr_text = NULL;
|
||||
char *sql = NULL;
|
||||
|
||||
if (!sofia_test_pflag(profile, PFLAG_TRACK_CALLS) || sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) {
|
||||
return;
|
||||
|
@ -4611,27 +4644,34 @@ void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *sess
|
|||
sofia_glue_tech_untrack(profile, session, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_xml_t cdr = NULL;
|
||||
char *xml_cdr_text = NULL;
|
||||
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
|
||||
xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE);
|
||||
switch_xml_free(cdr);
|
||||
}
|
||||
|
||||
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
|
||||
xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE);
|
||||
switch_xml_free(cdr);
|
||||
if (xml_cdr_text) {
|
||||
sql = switch_mprintf("insert into sip_recovery (runtime_uuid, profile_name, hostname, uuid, metadata) values ('%q','%q','%q','%q','%q')",
|
||||
switch_core_get_uuid(), profile->name, mod_sofia_globals.hostname, switch_core_session_get_uuid(session), xml_cdr_text);
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_TRACK_CALLS_EVENTS)) {
|
||||
switch_event_t *event = NULL;
|
||||
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RECOVERY_SEND) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sql", sql);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml_cdr_text) {
|
||||
char *sql;
|
||||
sql = switch_mprintf("insert into sip_recovery (runtime_uuid, profile_name, hostname, uuid, metadata) values ('%q','%q','%q','%q','%q')",
|
||||
switch_core_get_uuid(), profile->name, mod_sofia_globals.hostname, switch_core_session_get_uuid(session), xml_cdr_text);
|
||||
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
free(xml_cdr_text);
|
||||
sofia_set_flag(tech_pvt, TFLAG_TRACKED);
|
||||
}
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
free(xml_cdr_text);
|
||||
sofia_set_flag(tech_pvt, TFLAG_TRACKED);
|
||||
|
||||
}
|
||||
|
||||
|
||||
switch_safe_free(sql);
|
||||
|
||||
}
|
||||
|
||||
int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
|
@ -5135,7 +5175,7 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
|
|||
|
||||
switch_cache_db_persistant_execute_trans(dbh, sql, 1);
|
||||
|
||||
end:
|
||||
end:
|
||||
|
||||
switch_cache_db_release_db_handle(&dbh);
|
||||
|
||||
|
@ -5159,7 +5199,7 @@ void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch
|
|||
|
||||
switch_cache_db_execute_sql(dbh, sql, NULL);
|
||||
|
||||
end:
|
||||
end:
|
||||
|
||||
switch_cache_db_release_db_handle(&dbh);
|
||||
|
||||
|
@ -5191,7 +5231,7 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
|
|||
free(errmsg);
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
|
||||
switch_cache_db_release_db_handle(&dbh);
|
||||
|
||||
|
@ -5324,7 +5364,7 @@ sofia_destination_t *sofia_glue_get_destination(char *data)
|
|||
dst->route_uri = route_uri;
|
||||
return dst;
|
||||
|
||||
mem_fail:
|
||||
mem_fail:
|
||||
switch_safe_free(contact);
|
||||
switch_safe_free(to);
|
||||
switch_safe_free(route);
|
||||
|
|
|
@ -53,7 +53,7 @@ static struct {
|
|||
/*!
|
||||
\brief Open the default system database
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line)
|
||||
SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line)
|
||||
{
|
||||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_status_t r;
|
||||
|
@ -152,7 +152,7 @@ SWITCH_DECLARE(void) switch_cache_db_flush_handles(void)
|
|||
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t ** dbh)
|
||||
SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t **dbh)
|
||||
{
|
||||
if (dbh && *dbh) {
|
||||
|
||||
|
@ -172,7 +172,7 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t
|
|||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t ** dbh)
|
||||
SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t **dbh)
|
||||
{
|
||||
if (dbh && *dbh) {
|
||||
|
||||
|
@ -188,7 +188,7 @@ SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t
|
|||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_cache_db_destroy_db_handle(switch_cache_db_handle_t ** dbh)
|
||||
SWITCH_DECLARE(void) switch_cache_db_destroy_db_handle(switch_cache_db_handle_t **dbh)
|
||||
{
|
||||
if (dbh && *dbh) {
|
||||
switch_mutex_lock(sql_manager.dbh_mutex);
|
||||
|
@ -251,7 +251,7 @@ SWITCH_DECLARE(void) switch_cache_db_detach(void)
|
|||
switch_mutex_unlock(sql_manager.dbh_mutex);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_handle_t ** dbh,
|
||||
SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_handle_t **dbh,
|
||||
switch_cache_db_handle_type_t type,
|
||||
switch_cache_db_connection_options_t *connection_options,
|
||||
const char *file, const char *func, int line)
|
||||
|
@ -857,7 +857,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
|
|||
}
|
||||
|
||||
while (!sql_manager.event_db) {
|
||||
if (switch_core_db_handle(&sql_manager.event_db) == SWITCH_STATUS_SUCCESS && sql_manager.event_db) break;
|
||||
if (switch_core_db_handle(&sql_manager.event_db) == SWITCH_STATUS_SUCCESS && sql_manager.event_db)
|
||||
break;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error getting core db, Retrying\n");
|
||||
switch_yield(500000);
|
||||
sanity--;
|
||||
|
@ -994,7 +995,8 @@ static void core_event_handler(switch_event_t *event)
|
|||
if (id) {
|
||||
new_sql() = switch_mprintf("update tasks set task_desc='%q',task_group='%q', task_sql_manager=%q where task_id=%q and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "task-desc"),
|
||||
switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", id, switch_core_get_variable("hostname"));
|
||||
switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", id,
|
||||
switch_core_get_variable("hostname"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1097,8 +1099,7 @@ static void core_event_handler(switch_event_t *event)
|
|||
{
|
||||
new_sql() = switch_mprintf("update channels set callstate='%q' where uuid='%q' and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "channel-call-state"),
|
||||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_core_get_variable("hostname"));
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -1244,7 +1245,7 @@ static void core_event_handler(switch_event_t *event)
|
|||
if (sql_idx) {
|
||||
int i = 0;
|
||||
|
||||
for(i = 0; i < sql_idx; i++) {
|
||||
for (i = 0; i < sql_idx; i++) {
|
||||
if (switch_stristr("update channels", sql[i]) || switch_stristr("delete from channels", sql[i])) {
|
||||
switch_queue_push(sql_manager.sql_queue[1], sql[i]);
|
||||
} else {
|
||||
|
@ -1330,10 +1331,10 @@ static char create_calls_sql[] =
|
|||
" callee_chan_name VARCHAR(1024),\n"
|
||||
" callee_uuid VARCHAR(256),\n"
|
||||
" hostname VARCHAR(256)\n"
|
||||
");\n" "create index eruuindex on calls (caller_uuid,hostname);\n"
|
||||
");\n"
|
||||
"create index eruuindex on calls (caller_uuid,hostname);\n"
|
||||
"create index eeuuindex on calls (callee_uuid,hostname);\n"
|
||||
"create index eeuuindex2 on calls (call_uuid,hostname);\n"
|
||||
;
|
||||
"create index eeuuindex2 on calls (call_uuid,hostname);\n";
|
||||
|
||||
static char create_interfaces_sql[] =
|
||||
"CREATE TABLE interfaces (\n"
|
||||
|
|
Loading…
Reference in New Issue