Module: kamailio
Branch: master
Commit: 1dfe265ad2fc8c166c27aabf924d581ac5be81af
URL:
https://github.com/kamailio/kamailio/commit/1dfe265ad2fc8c166c27aabf924d581…
Author: lazedo <luis.azedo(a)factorlusitano.com>
Committer: GitHub <noreply(a)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/1dfe265ad2fc8c166c27aabf924d581…
Patch:
https://github.com/kamailio/kamailio/commit/1dfe265ad2fc8c166c27aabf924d581…
---
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);
}