[SR-Users] Forward SIP request between two Kamailio servers

Daniel Tryba d.tryba at pocos.nl
Fri Sep 14 11:26:10 CEST 2018


On Thu, Sep 13, 2018 at 08:19:00AM +0000, Nathanael Eneroth wrote:
> UA1<--->KAM1<---->KAM2<---->UA2
> int1    int1      int3      int3
>         int2      int2
> 
 
> I would like KAM1 to forward all SIP requests destined to int3 via
> KAM2 and vice versa. I am aware of the routing logic in
> 'kamailio.cfg', but i find rather excessive. Pseudo code of what i'm
> trying to achieve:

This is a very basic question, but I can't find any explanation/examples
about how to do this. Routing calls happens on
either 
$du https://www.kamailio.org/wiki/cookbooks/5.1.x/pseudovariables#du_-_destination_uri
of 
$ru https://www.kamailio.org/wiki/cookbooks/5.1.x/pseudovariables#ru_-_request_uri

You can manipulate components like the domain with $dd/$rd. Changing
them and than calling t_relay() will route the calls to somewhere else.
Regaring you examples: TIMTOWTDI

>         if (is_method("INVITE")) {
>              if(dst_ip == int3)
>                  set_next_kamailio_server(KAM2)
>     }

if()
{
	$rd="ip/dnsofkam2";
	route(RELAY);
	exit;
}
 
 
> Or:
> 
>         if (is_method("INVITE")) {
>              if(callee is unkown)
>                  ask_kamailio_server(KAM2)
>     }

if(!location())
{
	$rd="ip/dnsofkam2";
	route(RELAY);
	exit;
}



More information about the sr-users mailing list