Browse Source

handle variations of push notification

* invite only
* push_and_invite
* push_only (by exclusion)
drop_requests
lazedo 8 years ago
committed by Luis Azedo
parent
commit
10c8290fc3
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      kamailio/pusher-role.cfg

+ 10
- 2
kamailio/pusher-role.cfg View File

@ -12,20 +12,28 @@ route[PUSHER_ROUTE]
if ( (!is_method("INVITE")) || (!isflagset(FLAG_INTERNALLY_SOURCED)) || $hdr(X-KAZOO-PUSHER-Token-ID) == $null) if ( (!is_method("INVITE")) || (!isflagset(FLAG_INTERNALLY_SOURCED)) || $hdr(X-KAZOO-PUSHER-Token-ID) == $null)
return; 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; 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"); sl_send_reply(180, "waking the dead guy");
t_set_fr(0, 20000);
if (t_newtran()) { if (t_newtran()) {
route(SEND_PUSH_NOTIFICATION); route(SEND_PUSH_NOTIFICATION);
remove_hf_re("^X-.*"); remove_hf_re("^X-.*");
t_save_lumps(); t_save_lumps();
ts_store("$(tu{s.tolower})"); ts_store("$(tu{s.tolower})");
t_suspend();
} else { } else {
sl_send_reply(500, "error creating transaction for waking the dead guy"); 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] route[SEND_PUSH_NOTIFICATION]


Loading…
Cancel
Save