I have a problem when using t_suspend() and t_continue().
Let's say I would like to have a 5 sec delay before relaying an INVITE.
For example the following code:
route[MYROUTE] {
t_newtran();
if (is_method("INVITE")) {
t_reply("100", "Trying");
t_reply("180", "In Queue");
$sht(a=>$ci::t_index) = $T(id_index);
$sht(a=>$ci::t_label) = $T(id_label);
$sht(a=>$ci::t_suspended) = 1;
xlog("L_WARN","SUSPENDING t_index = $sht(a=>$ci::t_index) and t_label = $sht(a=>$ci::t_label)");
t_suspend();
sleep(5);
if (t_is_canceled()) drop;
$sht(a=>$ci::t_suspended) = 0;
t_continue("$avp(t_index)","$avp(t_label)","1");
}
route(RELAY);
exit;
}
route[1] {
xlog("L_WARN","After transaction continue\n");
route(RELAY);
exit;
}
When using this code, I get the following error:
Mar 9 16:49:32 mysip /usr/local/sbin/kamailio[5260]: WARNING: <script>: After transaction continue
Mar 9 16:49:32 mysip /usr/local/sbin/kamailio[5260]: ERROR: <core> [resolve.c:1693]: sip_hostport2su(): could not resolve hostname: "mysip"
Mar 9 16:49:32 mysip /usr/local/sbin/kamailio[5260]: ERROR: tm [ut.h:319]: uri2dst2(): failed to resolve "mysip"
Mar 9 16:49:32 mysip /usr/local/sbin/kamailio[5260]: ERROR: tm [t_fwd.c:1711]: t_forward_nonack(): ERROR: t_forward_nonack: failure to add branches
Mar 9 16:49:32 mysip /usr/local/sbin/kamailio[5260]: ERROR: sl [sl_funcs.c:363]: sl_reply_error(): ERROR: sl_reply_error used: Unresolvable destination (478/SL)
Mar 9 16:49:32 mysip /usr/local/sbin/kamailio[5260]: BUG: tm [t_lookup.c:1481]: t_unref(): tm: t_unref: REQ_ERR DELAYED should have been caught much earlier for 0x7fd4e727a468: 27 (hex 1b)
If I try to t_continue() without any route:
t_continue("$avp(t_index)","$avp(t_label)","");
The call is working great and the following error pops up:
Mar 9 17:10:36 mysip /usr/local/sbin/kamailio[5830]: ERROR: tmx [tmx_mod.c:635]: w_t_continue(): empty action lists in route block []
Am I doing something wrong?
My other question is regarding CANCEL.
Let's assume I suspended the INVITE and in these 5 sec I received CANCEL for it.
Is there a short and elegant way to remove the transaction from suspension?
For now I do:
if (is_method("CANCEL")) {
if (t_check_trans()) {
if($sht(a=>$ci::t_suspended) == 1) {
t_continue("$sht(a=>$ci::t_index)","$sht(a=>$ci::t_label)","");
xlog("L_WARN","After transaction continue\n");
}
route(RELAY);
}
exit;
}
Thanks,
Uri