[SR-Users] basic Kamailio frontend to Asterisk

Travis Ryan travis at travisryan.com
Tue Aug 20 17:10:25 CEST 2019


Thanks,

I want to eventually get to a setup like the one here: 
https://github.com/CyCoreSystems/asterisk-k8s-demo

But since I'll need Kamailio to handle a high load of incoming calls, I 
think I need it to direct traffic, etc for any number of Asterisk 
servers behind it.

In this setup it indeed has RTPProxy, etc. I just want to understand how 
to use it rather than just drop it in, etc. Also the demo doesn't have 
any config for an outside SIP trunk, etc.

Maybe this helps?

Thanks,
Travis

On 8/20/19 11:01 AM, Daniel Tryba wrote:
> On Tue, Aug 20, 2019 at 10:22:26AM -0400, Travis Ryan wrote:
>> What role is Kamailio to my Asterisk? Just an Outbound proxy? Do I need to
>> still register the trunk from each Asterisk box "thru" the Kamailio proxy,
>> etc?
>>
>> Also, I'm merely accepting outside calls and then validating the caller and
>> bridging them back out to the PSTN, so I don't have any local SIP clients,
>> etc., so no need to register the sip devices, etc.
> The real question is what do you need kamailio to do? You answer this
> with as a simple proxy.
>
> A possible solution for you is to use kamilio with the dispatcher module. One
> id (1) for the PSTN side, one id (2) for the Asterisk side. If a call comes in
> from 1, route it to 2 and v.v.
>
> This makes the kamailio machine the "endpoint" for both PSTN and
> Asterisk side.
>
> With the "default" config that comes with kamailio all you need to do is
> strip out anything from the accounting bit in request_route (line 508)
> https://github.com/kamailio/kamailio/blob/master/etc/kamailio.cfg
> and insert something like:
>
> if(ds_is_from_list("1",3))
> {
> 	$avp(dispatcherid)="2";
> }
> else if(ds_is_from_list("2",3))
> {
> 	$avp(dispatcherid)="1";
> }
> else
> {
> 	send_reply("403", "Go away");
> 	exit;
> }
>
> route(DISPATCHER);
> route(RELAY);
>
> With route DISPATCHER being:
> route[DISPATCHER]
> {
> 	if(!ds_select_dst($avp(dispatcherid), "4"))
> 	{
> 		send_reply("501", "No dispatcher available");
> 		exit;
> 	}
>
> 	t_on_failure("RTF_DISPATCH");
>
> 	return;
> }
>
> See https://kamailio.org/docs/modules/stable/modules/dispatcher.html#dispatcher.ex.config
> for more info on integrating the dispatcher module.
>
> More advanced subjects to look at are:
> -do you need an rtp proxy?
> -do you need topology hiding?
> -is NAT involved?
>
> But leave them until you have a clue about how to use kamailio as a sip proxy in a
> simple test environment (e.g. between 2 asterisk servers).
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



More information about the sr-users mailing list