]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4561 send notify with terminate state when we get a SUBSCRIBE with expires 0
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 24 Aug 2012 22:53:47 +0000 (17:53 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 24 Aug 2012 22:53:53 +0000 (17:53 -0500)
src/mod/endpoints/mod_sofia/sofia_presence.c

index 6f734782eb7aeed30236fed5254b990b47cfcd2b..105f58c5825476a1bc5e604c368cd8fdac71639e 100644 (file)
@@ -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) {