From: Anthony Minessale Date: Sun, 26 Aug 2012 17:35:30 +0000 (-0500) Subject: FS-4561 please test this X-Git-Tag: v1.2.3^2~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d8c82c86b43549c87b6f0b4a6ee999c587110b3;p=thirdparty%2Ffreeswitch.git FS-4561 please test this --- diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 105f58c582..066f3c6b90 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3320,7 +3320,7 @@ static int sync_sla(sofia_profile_t *profile, const char *to_user, const char *t "hostname='%q' and profile_name='%q' " "and sub_to_user='%q' and sub_to_host='%q' " - "and event='line-seize'", (long) switch_epoch_time_now(NULL), + "and event='line-seize'", (long) switch_epoch_time_now(NULL) + 2, mod_sofia_globals.hostname, profile->name, to_user, to_host ); @@ -3349,17 +3349,6 @@ static int sync_sla(sofia_profile_t *profile, const char *to_user, const char *t switch_safe_free(sql); } - - sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and profile_name='%q' and " - "((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " - "and call_info_state='seized'", mod_sofia_globals.hostname, profile->name, to_user, to_host, to_user, to_host); - - - if (mod_sofia_globals.debug_sla > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql); - } - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - switch_safe_free(sql); } @@ -3426,7 +3415,19 @@ static int sync_sla(sofia_profile_t *profile, const char *to_user, const char *t sh = NULL; switch_core_destroy_memory_pool(&pool); + + if (clear) { + sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and profile_name='%q' and " + "((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " + "and call_info_state='seized'", mod_sofia_globals.hostname, profile->name, to_user, to_host, to_user, to_host); + + if (mod_sofia_globals.debug_sla > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql); + } + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + switch_safe_free(sql); + }