From 70331e88bdf782c5374f61cb1f121fcd6c924cb4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 30 Aug 2010 17:33:05 -0500 Subject: [PATCH] when getting presence with no payload consider it an extension to the expires time in the dialog --- src/mod/endpoints/mod_sofia/sofia_presence.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 82e975c6dd..39b495d392 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2467,6 +2467,10 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n from_host = (char *) from->a_url->url_host; } + + exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); + exp = (long) switch_epoch_time_now(NULL) + exp_delta; + if (payload) { switch_xml_t xml, note, person, tuple, status, basic, act; switch_event_t *event; @@ -2499,9 +2503,6 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n } } - exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); - exp = (long) switch_epoch_time_now(NULL) + exp_delta; - if ((sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " @@ -2542,6 +2543,10 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n switch_xml_free(xml); } + } else { + char *sql = switch_mprintf("update sip_presence set expires=%ld where sip_user='%q' and sip_host='%q' and profile_name='%q' and hostname='%q'", + exp, from_user, from_host, profile->name, mod_sofia_globals.hostname); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } switch_safe_free(pd_dup);