I followed the page 18~23 of this slide 20-Federico.Cabiddu-Kamailio-In-A-Mobile-World to implement suspension & push notification, it worked well on mobile devices.
However, callee might have several location records on some occasions, for instance, they forcibly quit the app or kill the browser, meaning they don't de-register, the location hasn't expired and still exists, but it is stale and unreachable, this makes t_relay
failed (return code is -2 and didn't trigger failure_route) since Kamailio lookup
the stale location rather than the new one as they get push notification, below are some part of logs.
ERROR: tm [t_fwd.c:484]: prepare_new_uac(): could not build request
ERROR: tm [t_fwd.c:1764]: t_forward_nonack(): failure to add branches
ERROR: <script>: not t_relay by INVITE -2
ERROR: <script>: check status code is 100
The rest of Kamailio code triggers sl_reply_error
, caller gets 500 and terminates.
When callee has several locations, even if some of them are stale, callee should not terminate the call and should find a valid location to ring the target.
Caller finds invalid locations and gets 500 error msg.
What I have tried
suspend
when t_relay
failed.if (!t_relay()) {
revert_uri();
route(SUSPEND);
}
It doesn't work since t_continue
still tries to recover the call with the stale location.
append_branch
before t_relay
.if (!lookup("location")) {
send_replay("100", "Trying");
route(SUSPEND);
} else {
append_branch($tu);
t_relay();
ts_store();
$sht(vtp=>stored::$rU) = 1;
xdbg("stored transaction [$T(id_index):$T(id_label)] $fU=> $rU\n");
}
This version of caller won't get 500 and terminate, but callee cannot finds the resumed call.
t_load_contacts
and t_next_contact
.t_load_contacts();
while (t_next_contacts()) {
xlog ("==== $ru\n");
}
t_next_contacts always return -2 (nothing to do), but I can see the new location via command kamctl ul show
.
(paste your log messages here)
(paste your sip traffic here)
kamailio -v
(paste your output here)
(paste your output here)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.