[OpenSIPS-Users] Module Path and function loose_route

mayamatakeshi mayamatakeshi at gmail.com
Fri Aug 21 13:45:57 CEST 2009


On Fri, Aug 21, 2009 at 7:50 PM, Iñaki Baz Castillo<ibc at aliax.net> wrote:
> Using loose route makes no sense since its purpose is handling in-dialog
> requests.
> IMHO what you want to achieve is easier:
> - If the proxy receives an initial request from the registrar (no To tag),
> then do loose_route (just to take off the Route header even if it returns
> false) and route the call normally. based on RURI, no more:
>
>  if $si == "REGISTRAR_IP" {
>    loose_route();  # returns false but removes the Route header.
>    t_relay();  # Route based on RURI since the Route header has been removed.
>  }

Thanks,
in my case I will need an extra test as the registrar will actually be
a B2BUA and may require not only termination of calls to users but
also calls to be directed to GWs.
So I came up with this:

if(request came from B2BUA) {
	if($(hdr(Route)[0]{nameaddr.uri}{uri.host}) == "MY_IPADDRESS" &&
$(hdr(Route)[1]) == null) {
		loose_route(); # this forces removal of the Route header detected above.
		t_relay();
		exit;
	}
}

#Proceed to drouting etc.


It's convoluted, but it works.

regards,
takeshi



More information about the Users mailing list