From 05b082cfbeb9dc85ff87087c27569ebab238e2d7 Mon Sep 17 00:00:00 2001 From: Daniel Finke Date: Thu, 20 Jul 2017 17:11:49 +0000 Subject: [PATCH] Continue processing SIP messaging even if push notification sent This fixes an issue so devices that remain registered after sleeping can still be woke by a push. Also, if it happens that their socket is still open, as happens for a short time during background fetch on iOS, they can answer the SIP signalling on that socket and handle the call. --- kamailio/default.cfg | 6 ++++++ kamailio/pusher-role.cfg | 11 ++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/kamailio/default.cfg b/kamailio/default.cfg index dc22a5f..9228f4c 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -623,6 +623,12 @@ route[INTERNAL_TO_EXTERNAL_RELAY] $du = $(ulc(callee=>received)); $fs = $(ulc(callee=>socket)); xlog("L_INFO", "$ci|log|routing $hdr(X-KAZOO-AOR) to $du via $fs\n"); + } else if ($hdr(X-KAZOO-PUSHER-Token-ID) != $null) { + xlog("L_INFO", "$ci|log|ignoring missing registration while waiting for push notification response\n"); + t_on_reply("EXTERNAL_REPLY"); + t_set_fr(0, 10000); + t_release(); + exit; } else { xlog("L_INFO", "$ci|end|user is not registered\n"); sl_send_reply("404", "Not registered"); diff --git a/kamailio/pusher-role.cfg b/kamailio/pusher-role.cfg index 6640352..71d374f 100644 --- a/kamailio/pusher-role.cfg +++ b/kamailio/pusher-role.cfg @@ -3,6 +3,7 @@ ####### SQL OPS module ########## #!ifndef TSILO_LOADED loadmodule "tsilo.so" +modparam("tsilo", "use_domain", 1) #!trydef TSILO_LOADED #!endif @@ -11,24 +12,16 @@ route[PUSHER_ROUTE] if ( (!is_method("INVITE")) || (!isflagset(FLAG_INTERNALLY_SOURCED)) || $hdr(X-KAZOO-PUSHER-Token-ID) == $null) return; - if(registered("location")) { - return; - } - xlog("L_INFO", "$ci| pusher received request to wakeup $tu\n"); sl_send_reply(180, "waking the dead guy"); if (t_newtran()) { route(SEND_PUSH_NOTIFICATION); - t_on_reply("EXTERNAL_REPLY"); - t_set_fr(0, 10000); remove_hf_re("^X-.*"); t_save_lumps(); - ts_store(); - t_release(); + ts_store("$(tu{s.tolower})"); } else { sl_send_reply(500, "error creating transaction for waking the dead guy"); } - exit; } route[SEND_PUSH_NOTIFICATION]