void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch_mutex_t *mutex);
void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql, switch_mutex_t *mutex);
void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
+void sofia_glue_execute_sql_soon(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot);
void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now);
switch_assert(sqlp && *sqlp);
sql = *sqlp;
- switch_sql_queue_manager_push(profile->qm, sql, 0, !sql_already_dynamic);
+ switch_sql_queue_manager_push(profile->qm, sql, 1, !sql_already_dynamic);
if (sql_already_dynamic) {
*sqlp = NULL;
}
}
+void sofia_glue_execute_sql_soon(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic)
+{
+ char *sql;
+
+ switch_assert(sqlp && *sqlp);
+ sql = *sqlp;
+
+ switch_sql_queue_manager_push(profile->qm, sql, 0, !sql_already_dynamic);
+
+ if (sql_already_dynamic) {
+ *sqlp = NULL;
+ }
+}
+
switch_cache_db_handle_t *_sofia_glue_get_db_handle(sofia_profile_t *profile, const char *file, const char *func, int line)
{
}
if (zstr(call_id)) {
-
+
sql = switch_mprintf("update sip_subscriptions set version=version+1 where hostname='%q' and profile_name='%q' and "
"sip_subscriptions.event != 'line-seize' "
"and sip_subscriptions.proto='%q' and (event='%q' or event='%q') and sub_to_user='%q' and "
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PRES SQL %s\n", sql);
}
- sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
-
+ sofia_glue_execute_sql_soon(profile, &sql, SWITCH_TRUE);
+
sql = switch_mprintf("select distinct sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
"sip_subscriptions.accept,sip_subscriptions.profile_name"
",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q',"
- "sip_subscriptions.version, '%q',sip_subscriptions.orig_proto,sip_subscriptions.full_to,"
+ "sip_subscriptions.version+1, '%q',sip_subscriptions.orig_proto,sip_subscriptions.full_to,"
"sip_subscriptions.network_ip, sip_subscriptions.network_port "
"from sip_subscriptions "
"left join sip_presence on "
event_type, alt_event_type, euser, host, profile->sipip,
profile->extsipip ? profile->extsipip : "N/A", host);
} else {
+
sql = switch_mprintf("update sip_subscriptions set version=version+1 where sip_subscriptions.event != 'line-seize' and "
"hostname='%q' and profile_name = '%q' and sip_subscriptions.call_id='%q'",
mod_sofia_globals.hostname, profile->name, call_id);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PRES SQL %s\n", sql);
}
- sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+ sofia_glue_execute_sql_soon(profile, &sql, SWITCH_TRUE);
sql = switch_mprintf("select distinct sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
"sip_subscriptions.accept,sip_subscriptions.profile_name"
",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q',"
- "sip_subscriptions.version, '%q',sip_subscriptions.orig_proto,sip_subscriptions.full_to,"
+ "sip_subscriptions.version+1, '%q',sip_subscriptions.orig_proto,sip_subscriptions.full_to,"
"sip_subscriptions.network_ip, sip_subscriptions.network_port "
"from sip_subscriptions "
"left join sip_presence on "
switch(dbh->type) {
case SCDB_TYPE_CORE_DB:
{
- switch_cache_db_execute_sql_real(dbh, "BEGIN", &errmsg);
+ switch_cache_db_execute_sql_real(dbh, "BEGIN EXCLUSIVE", &errmsg);
}
break;
case SCDB_TYPE_ODBC:
switch(qm->event_db->type) {
case SCDB_TYPE_CORE_DB:
{
- switch_cache_db_execute_sql_real(qm->event_db, "BEGIN", &errmsg);
+ switch_cache_db_execute_sql_real(qm->event_db, "BEGIN EXCLUSIVE", &errmsg);
}
break;
case SCDB_TYPE_ODBC:
switch(sql_manager.dbh->type) {
case SCDB_TYPE_CORE_DB:
{
- switch_cache_db_execute_sql_real(sql_manager.dbh, "BEGIN", &err);
+ switch_cache_db_execute_sql_real(sql_manager.dbh, "BEGIN EXCLUSIVE", &err);
}
break;
case SCDB_TYPE_ODBC: