[OpenSIPS-Users] Call Branching in parallel and series

Conrad de Wet conradjdw at gmail.com
Tue Nov 1 15:12:10 UTC 2022


Hi All, 
I’m trying to work out how to Fork/Branch calls to various contacts.
 
Firstly, my setup is that I have, let’s say, OpenSIPS-Gateway(os-gw) and OpenSIPS-Websocket clients (os-ws). Both of these are a load balanced array of servers. So when a client registers on os-ws he could register on any of the possible os-ws servers. With os-gw, again there can be N number of servers, but this plays little part in my issue, except that all calls are always sent from os-ws to os-gw for onward sending, even if the call is to be turned around on os-gw back to a registered user on os-ws (internal calling).
 
Let’s take this flow:
[os-ws(x)] <----- INVITE ----> [os-gw(y)] <---- INVITE ----> [os-ws(z)]
 
It will be the responsibility of the os-gw to find the correct os-ws (by looking in the location table) and sending the call on to the correct os-ws server, so that in can reach the actual client endpoint. 
 
I’m busy with my own sort of “lookup()” replacement but with a few more encasements. I have managed to get the contacts list form the database, and can call something like:
 
seturi("sip:bob at 10.0.0.3");
append_branch("sip:bob1 at 10.0.0.2");
append_branch("sip:bob2 at 10.0.0.2");
append_branch("sip:bob3 at 10.0.0.1");
t_relay();
 
This works, except I want to extend this even further. I want these 4 branches to keep trying on a loop until the transaction timeout occurs or one of the calls is answered. Except I find that the “failure_route” has two main problems, firstly if I try a “t_relay()” in the failure_route, the original call gets relayed again and I can’t seem to refer back to the branch.
 
This causes the number of branches to quickly run out (I think max is 16), as it seem to nest the branch. Also because the t_relay() appears to act on the main branch, all the urls are reset, so I don’t really know where I was originally sending this request to.
 
failure_route[my_on_failure]{
                seturi($branch(uri));   # <-- This is null
                t_relay(); # causes new branches that don’t seem to kill the old ones.
}
 
So basically, I’m trying to parallel fork the original call (probably no more than about 5), and have these branches, retry in a loop (series) until one of the contacts answers or the timeout occurs, at this time the cancel will be sent to all the “other” branches (probably t_cancel_branch("o") would work for that, but I have not been able to test this).
 
The ultimate benefit here: it would be possible that, even if a call has been sent to one of the endpoints and is ringing, another endpoint can come online and would soon begin to ring. You would have a choice of devices to answer the call with.
 
Thanks, Conrad


Sent from my iPhone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20221101/d1527c1d/attachment.html>


More information about the Users mailing list