From 7afd4cae6708fb68accb663c56a639daef8d8178 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 4 Oct 2012 08:02:32 -0500 Subject: [PATCH] FS-4677 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index d7d7a49cf7..eea01d50a5 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -934,7 +934,7 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, " "'%q' as ct,'%q' as pt " " from sip_subscriptions where " - "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'" + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' " "and call_id = '%q' ", switch_sql_concat(), type, @@ -956,10 +956,19 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_send_sql, &cb); if (switch_true(final)) { - sql = switch_mprintf("delete from sip_subscriptions where " - "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'", - mod_sofia_globals.hostname, profile->name, - from_user, from_host, event_str); + if (call_id) { + sql = switch_mprintf("delete from sip_subscriptions where " + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' " + "and call_id = '%q' ", + mod_sofia_globals.hostname, profile->name, + from_user, from_host, event_str, call_id); + + } else { + sql = switch_mprintf("delete from sip_subscriptions where " + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'", + mod_sofia_globals.hostname, profile->name, + from_user, from_host, event_str); + } sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); }