[sr-dev] git:master:1dfe265a: presence: allow control of subscription deletion

GitHub noreply at github.com
Wed Jan 18 14:08:25 CET 2017


Module: kamailio
Branch: master
Commit: 1dfe265ad2fc8c166c27aabf924d581ac5be81af
URL: https://github.com/kamailio/kamailio/commit/1dfe265ad2fc8c166c27aabf924d581ac5be81af

Author: lazedo <luis.azedo at factorlusitano.com>
Committer: GitHub <noreply at github.com>
Date: 2017-01-05T16:18:14Z

presence: allow control of subscription deletion

use the configuration xavp to control subscription deletion after notify
searches for `delete_subscription` value in the configuration xavp

---

Modified: src/modules/presence/notify.c

---

Diff:  https://github.com/kamailio/kamailio/commit/1dfe265ad2fc8c166c27aabf924d581ac5be81af.diff
Patch: https://github.com/kamailio/kamailio/commit/1dfe265ad2fc8c166c27aabf924d581ac5be81af.patch

---

diff --git a/src/modules/presence/notify.c b/src/modules/presence/notify.c
index aaa4b51..c1636c7 100644
--- a/src/modules/presence/notify.c
+++ b/src/modules/presence/notify.c
@@ -1818,6 +1818,23 @@ void run_notify_reply_event(struct cell *t, struct tmcb_params *ps)
 
 }
 
+int pres_get_delete_sub(void)
+{
+       sr_xavp_t *vavp = NULL;
+       str vname = str_init("delete_subscription");
+
+       if(pres_xavp_cfg.s==NULL || pres_xavp_cfg.len<=0) {
+               return 0;
+       }
+
+       vavp = xavp_get_child_with_ival(&pres_xavp_cfg, &vname);
+       if(vavp!=NULL) {
+               return (int)vavp->val.v.i;
+       }
+
+       return 0;
+}
+
 void p_tm_callback( struct cell *t, int type, struct tmcb_params *ps)
 {
 	subs_t* subs;
@@ -1835,7 +1852,10 @@ void p_tm_callback( struct cell *t, int type, struct tmcb_params *ps)
 
 	run_notify_reply_event(t, ps);
 
-	if(ps->code == 404 || ps->code == 481 || (ps->code == 408 && timeout_rm_subs)) {
+        if(ps->code == 404
+	   || ps->code == 481
+	   || (ps->code == 408 && timeout_rm_subs)
+	   || pres_get_delete_sub()) {
 		delete_subs(&subs->pres_uri, &subs->event->name,
 				&subs->to_tag, &subs->from_tag, &subs->callid);
 	}




More information about the sr-dev mailing list