Folks,
We are currently trying to implement owerflow routing with sip and b2bua. Our network setup looks like the following (two GWs here is for simplicity, actually there would be dozens of them):
--------- /--|PSTN GW|-\ ---- ----------------- ------- /~~~~~~/ --------- \ /~~~~~~~~\ |UA|--|PROXY/REGISTRAR|--|B2BUA|--<IP CLOUD> <PSTN CLOUD> ---- ----------------- ------- ______/\ --------- / ________/ --|PSTN GW|-/ ---------
Since potentially each destination in the PSTN could be reached through more than one GW we would like to use that for adding some more robustness to the system, beause from time to time some of gateways might be unavailable for one reason of another (network outage, maintenance, overload etc.). t_on_negative() looks like a pretty suitable feature for the job modulo that we need to add some scheme for distinguishing real failures, such as "number is busy", from transient ones.
The problem here is that b2bua is unable to do prefix-based routing, while we can't put b2bua between the UA and PROXY because for accounting reasons we should be able to get from b2bua IP number of the gateway the call was forwarded to. Therefore, we do gateway selection based on prefix in ser (using rewritehostport) and then just forward request to the b2bua using t_relay_to(). To catch failures and perform retries we use t_on_negative() and number of reply_route[] blocks and it is where the problem lies - after appending a new branch ser forwards the request to the host:port specified in the uri directly, but not through the b2bua.
Attached patch adds a new variable sticky_relay_to, which if set to non-zero value instructs ser to record proxy address to which transaction was originally forwarded with t_relay_to(). On failure ser forwards request to that address if another branch was appended in reply_route[].
I think that it is generally useful feature and it would be nice to see it integrated into the next release.
Thanks!
-Maxim