[OpenSIPS-Users] STOP waiting for new branches and close transaction by t_wait_no_more_branches()

Ярослав Нападайло napadailo at kolesa.kz
Fri Aug 12 12:12:35 UTC 2022


Hi everybody!

I'm writing script with Push Notification mechanism using TM module and
t_wait_for_new_branches() function and EBR.
Here example in docs
https://opensips.org/docs/modules/3.2.x/event_routing.html#idp5576704

My  is:

route {
      ...
      t_newtran();
      ....
      create_dialog();
      ...
      t_on_reply("HANDLE_REPLY");
      t_wait_for_new_branches();
      ....
      notify_on_event("E_UL_CONTACT_INSERT", $avp(filter), "fork_call",
$var(ttl));
}

onreply_route[HANDLE_REPLY] {
  xlog("L_DBG", "received reply $rs $rr");
  switch($rs) {
    case "486":
      xlog("L_DBG", "wait no more branches DLG_DID=$DLG_did");
      t_wait_no_more_branches();
      t_cancel_branch("a");
      break;
    default:
  }
}

route[fork_call] {
  xlog("L_DBG", "[$ci] user $avp(aor) registered a new contact $avp(uri),
injecting");
  t_inject_branches("event");
}

First, I create dialog. Then, call t_wait_for_new_branches() and set
notify_on_event() handler.
Then I'm waiting for new REGISTERs. When new contacts register to usrloc,
I'm injecting received contacts as new branches to current transaction.
I do all things as described in docs.
Now I want to control negative replies from ongoing branches. By default,
OS ignores negative replies and continue waiting for new branches. For
example, I want to ignore 480, but handle 486.
I try handle 486, calling t_wait_no_more_branches().
I expect that OS will stop waiting for new branches and t_inject_branches
will not add anymore.
Also I expect that OS stop PHONY branch, which is created first when
calling t_wait_for_new_branches(), and sends final response (486 in my
case) to caller.
But in real next things happen:
1. t_wait_no_more_branches() doesn't affect adding new branches. If 1st
callee reject call, then 2nd callee register new contact,
t_inject_branches() adds new branch all the same
2. If no other branches added, caller hears ringing until FR_INV_TIMEOUT
expires. And only when FR_INV_TIMEOUT expires, OS sends final response to
caller.

WIDW??

How to stop transaction immeditially when at least one ongoing branch reply
486 code and to wait no more for any branches?
Thx for answers

-- 
Regards,
Yaroslav Napadilo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20220812/6b5d0ba8/attachment-0001.html>


More information about the Users mailing list