[OpenSIPS-Users] Restrictions using branch_route

John Quick John.Quick at smartvox.co.uk
Wed Dec 2 10:46:50 CET 2009


Hi Bogdan,

Thanks for answering this. I had looked at using a while statement and the branch() variable, but
couldn't see how to end the while loop. Is there a pseudo-variable that gives the total number of
branches?

I eventually found this solution (the code is illustrative, not literal):
route {
...
	exec_dset();
	t_on_branch("1");
	t_relay();
}

branch_route[1] {
	if (is_domain_local("$rd")) {
		route(2)
	}
}

route[2] {
	if (lookup("location","b")) {
		xlog("L_WARN", "Local UA has Contact:$ru; Location:$du\n");
	} else {
		drop();
	}
}

It seems to work ok, but I am still a bit uncertain if the t_relay() should be in the main route or
the branch route or in route(2). Also I wonder how engage_media_proxy interacts with parallel forking
if some branches need media proxy but others don't?

John


> -----Original Message-----
> From: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
> Sent: 01 December 2009 22:31
> To: John.Quick at smartvox.co.uk; OpenSIPS users mailling list
> Subject: Re: [OpenSIPS-Users] Restrictions using branch_route
> 
> Hi John,
> 
> well, if you use 1.6, you have a nice way to iterate through all the
> branches directly from the request route, via the branch() variable:
>     http://www.opensips.org/Resources/DocsCoreVar16#toc14
> 
> So, you could iterate (using the index and "while" statement) through
> all the existing branches and do whatever you want to do directly from
> request route.
> 
> Regards,
> Bogdan
> 
> John Quick wrote:
> > This question follows on from an earlier one about finding a way to process each uri in a
> destination
> > set. The main route calls exec_dset which returns a destination set (a list of URI's). I then
> need to
> > process each URI from that set, particularly by checking the URI against the registered UAC's
> stored
> > in the location server. AOR has to be converted to the registered IP address and port of the UAC
> > before the request is relayed.
> >
> > If it was a single URI I would just call lookup("location"). When it is a destination set, the
> only
> > way I have found to process the destinations one at a time is by calling t_on_branch("1") and
> defining
> > a branch_route. However, in the branch_route section it is not permissible to call
> lookup("location").
> > Any suggestions please?
> >
> > John Quick
> >
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
> >
> 
> 
> --
> Bogdan-Andrei Iancu
> www.voice-system.ro





More information about the Users mailing list