From 60cd56d1fcc73edeafa65e4a41b5c44867519972 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 24 Aug 2012 17:53:47 -0500 Subject: [PATCH] FS-4561 send notify with terminate state when we get a SUBSCRIBE with expires 0 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 6f734782eb..105f58c582 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3597,7 +3597,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, if ((subbed = atoi(buf)) > 0) { sub_state = nua_substate_active; - } + } } if (sub_state == nua_substate_active) { @@ -3632,6 +3632,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_safe_free(sql); sstr = switch_mprintf("terminated;reason=noresource"); + } else { sip_accept_t *ap = sip->sip_accept; char accept[256] = ""; @@ -3733,6 +3734,13 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_safe_free(new_contactstr); switch_safe_free(sticky); + + if (sub_state == nua_substate_terminated) { + nua_notify(nh, + SIPTAG_EXPIRES_STR("0"), + SIPTAG_SUBSCRIPTION_STATE_STR(sstr), + TAG_END()); + } } if (sub_state == nua_substate_terminated) {