[SR-Users] Best way to 'detect' direction

Klaus Darilion klaus.mailinglists at pernau.at
Mon Feb 4 17:15:31 CET 2013



On 31.01.2013 00:34, Paul Belanger wrote:
> Greetings,
>
> I'm in the process of adding logic to 'detect' the direction of my
> message, I have to set:
>
> rtpproxy_manage("ei")
> or
> rtpproxy_manage("ie")
>
> respectively. Rather then hard-coding IP addresses in my
> configuration, I was curious how other people over come this? Perhaps
> tagging their call control in some other method?
>

On the initial INVITE you usually always have some kind of direction 
detection (e.g. is it an incoming call, or outgoing call, or internal 
call) as you have different routing.

Then you can set a record-route cookie with this information, e.g. 
";dir=inbound" which means an incoming call which means that you have 
rtpproxy_manage("ei") for the INVITE and rtpproxy_manage("ie") for the 
200 OK.

On in-dialog requests get the value of the RR-Cookie (e.g. 
check_route_param("dir=inbound) and check the direction of the 
transaction 
(http://kamailio.org/docs/modules/3.3.x/modules_k/rr.html#id2527914) and 
use the same logic as for the initial INVITE (or vice versa).

Instead of a RR cookie you could also use the dialog module and dialog 
profiles.

regards
Klaus



More information about the sr-users mailing list