From a670864dd32b4c2d664c17cf87fb29957d3a928d Mon Sep 17 00:00:00 2001 From: lazedo Date: Thu, 5 Jul 2018 10:19:43 +0100 Subject: [PATCH] accept token-reg from uri.params and tobody.params --- kamailio/pusher-role.cfg | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/kamailio/pusher-role.cfg b/kamailio/pusher-role.cfg index b93de7f..2119810 100644 --- a/kamailio/pusher-role.cfg +++ b/kamailio/pusher-role.cfg @@ -30,11 +30,14 @@ route[PUSHER_TO_EXTERNAL_RELAY] failure_route[PUSHER_EXTERNAL_FAULT] { - xlog("L_INFO", "$ci|pusher|fault reply $T_reply_code\n"); - if (!t_check_status("486|603") && $avp(push_sent) != 1) { + if (!t_check_status("486|487|603") && $avp(push_sent) != 1) { send_reply(182, "waking the dead guy"); route(PUSHER_SEND_PUSH_NOTIFICATION); + } else if (t_check_status("487")) { + xlog("L_INFO", "$ci|pusher|push transaction canceled\n"); + t_reply("$T_reply_code", "Pusher Canceled"); } else { + xlog("L_INFO", "$ci|pusher|push transaction result - $T_reply_code\n"); t_reply("$T_reply_code", "Pusher Failed"); } } @@ -114,10 +117,21 @@ route[PUSHER_ATTEMPT_REGISTRATION] if($sht(push_cache=>$(sel(contact.uri){uri.param,x-token-reg})) != $null) { $var(password) = $null; $sht(push_cache=>$(sel(contact.uri){uri.param,x-token-reg})) = $null; - xlog("L_INFO", "$ci|pusher|registration with x-token-reg\n"); + xlog("L_INFO", "$ci|pusher|registration with x-token-reg $(sel(contact.uri){uri.param,x-token-reg})\n"); + route(SAVE_LOCATION); + } else { + xlog("L_INFO", "$ci|pusher|registration x-token-reg from contact uri param '$(sel(contact.uri){uri.param,x-token-reg})' was not found\n"); + } + } + + if($(sel(contact){tobody.params}{param.value,x-token-reg}) != "") { + if($sht(push_cache=>$(sel(contact){tobody.params}{param.value,x-token-reg})) != $null) { + $var(password) = $null; + $sht(push_cache=>$(sel(contact){tobody.params}{param.value,x-token-reg})) = $null; + xlog("L_INFO", "$ci|pusher|registration with x-token-reg $(sel(contact){tobody.params}{param.value,x-token-reg})\n"); route(SAVE_LOCATION); } else { - xlog("L_INFO", "$ci|pusher|registration x-token-reg from contact '$(sel(contact.uri){uri.param,x-token-reg})' was not found\n"); + xlog("L_INFO", "$ci|pusher|registration x-token-reg from contact param '$(sel(contact){tobody.params}{param.value,x-token-reg})' was not found\n"); } }