From 10c8290fc336d47166d1a5e8beb8286a8ad80b99 Mon Sep 17 00:00:00 2001 From: lazedo Date: Fri, 22 Jun 2018 14:16:35 +0100 Subject: [PATCH] handle variations of push notification * invite only * push_and_invite * push_only (by exclusion) --- kamailio/pusher-role.cfg | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kamailio/pusher-role.cfg b/kamailio/pusher-role.cfg index 1b57d8f..cb49a73 100644 --- a/kamailio/pusher-role.cfg +++ b/kamailio/pusher-role.cfg @@ -12,20 +12,28 @@ route[PUSHER_ROUTE] if ( (!is_method("INVITE")) || (!isflagset(FLAG_INTERNALLY_SOURCED)) || $hdr(X-KAZOO-PUSHER-Token-ID) == $null) return; - if(registered("location") && $hdr(X-KAZOO-PUSHER-Invite-Format) != "push_and_invite") { + if(registered("location") && $hdr(X-KAZOO-PUSHER-Invite-Format) == "invite_only") { return; } - xlog("L_INFO", "$ci| pusher received request to wakeup $tu\n"); + xlog("L_INFO", "$ci|pusher received request to wakeup $(tu{s.tolower})\n"); sl_send_reply(180, "waking the dead guy"); + t_set_fr(0, 20000); if (t_newtran()) { route(SEND_PUSH_NOTIFICATION); remove_hf_re("^X-.*"); t_save_lumps(); ts_store("$(tu{s.tolower})"); + t_suspend(); } else { sl_send_reply(500, "error creating transaction for waking the dead guy"); } + + if($hdr(X-KAZOO-PUSHER-Invite-Format) == "push_and_invite") { + return; + } + + exit(); } route[SEND_PUSH_NOTIFICATION]