[SR-Users] Basic question regarding Routing

Alex Balashov abalashov at evaristesys.com
Thu Apr 17 09:49:24 CEST 2014


On 04/17/2014 03:39 AM, aawaise wrote:

> 1. What is exactly achieved by "route(RELAY)" ?? Routing calls from local
> users to other domains ??

The effect of the RELAY request route, which for the most part just 
encapsulates t_relay(), is specific to the vector by which the call 
entered Kamailio and the egress path out of which it is being directed.

t_relay() simply consumes the Request URI ($ru) of the request and 
routes to the domain part of that RURI. The forwarding destination can 
be overridden by setting the destination set ($du), if you for need to 
send a request to a different place network/transport-wise than where 
the domain itself resolves to.

So, where the request will go as a result of the RELAY route being 
called depends on the processing that took place beforehand. If, for 
example, it was a registrar lookup(), then the request will be routed to 
a registered user (if a contact binding was found by the lookup()). If 
Kamailio determined that this call should be routed to your PSTN 
gateway, it'll go there instead. And so on.

So, the key thing to understand is that the other processing functions 
in the end just set the RURI/destination set, and t_relay() actually 
operates on the RURI/destination set. It also creates a TM transaction 
to keep state for the request. The transaction is not created until 
t_relay() is called, unless you explicitly created one beforehand with 
t_newtran(), which is not usually necessary.

> 2. If user 1 is caller and user 2 is being called. Which pseudo
> variable will be used to catch value of called user i.e user 2 and
> his domain ?? I want to pick domain name from location table in
> database and not from the authorization module.

lookup() will, under ordinary circumstances, set the request URI, so you 
should look at the value of $ru (which can be split into its component 
parts: $rU - the user part, $rd - the domain part, $rp - the port).

-- Alex

Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

More information about the sr-users mailing list