[SR-Users] kamailio as SIP Agent

SamyGo govoiper at gmail.com
Thu Jul 30 15:05:23 CEST 2015


Below is output from the dispatcher table, Set-2 is a pool of asterisk
servers to be Load balanced, and Set-1 is the Telco IP.

KAMSBC01:~# kamctl dispatcher dump
SET_NO:: 2
*SET:: 2 *
        URI:: sip:192.168.0.150:5050 flags=AP priority=1 attrs=
        URI:: sip:192.168.0.151:5060 flags=AP priority=1 attrs=
        URI:: sip:192.168.0.152:5070 flags=AP priority=1 attrs=
        URI:: sip:192.168.0.153:5080 flags=AP priority=1 attrs=
        URI:: sip:192.168.0.155:5090 flags=AP priority=1 attrs=
*SET:: 1*
        URI:: sip:124.311.201.600:5060 flags=AP priority=1 attrs=

Now in my kamailio.cfg in relevant route

if(ds_is_from_list
<http://kamailio.org/docs/modules/4.3.x/modules/dispatcher.html#dispatcher.f.ds_is_from_list>("1"))
{
#Call from Telco Should goto Asterisk pool in Loadbalanced mode
                 if(!ds_select_dst("2", "4")) {
                        sl_send_reply("500", "Service Unavailable");
                        xlog("L_INFO","[$fU@$si:$sp]{$rm} No destinations
available for $rd \n");
                        exit;
                }
} else if (ds_is_from_list("2")) {
#Call from Asterisk servers pool, send it to telco using LoadBalancer
                if(!ds_select_dst("1", "4")) {
                        sl_send_reply("500", "Service Unavailable");
                        xlog("L_INFO","[$fU@$si:$sp]{$rm} No destinations
available for $rd \n");
                        exit;
                }
}


So if your Telco has more than 1 IP you can do Load balancing.

I hope this solves your problem.


Best Regards,
Sammy



On Thu, Jul 30, 2015 at 3:17 AM, Sandeep Chakravarthi <
ivschakravarthi at gmail.com> wrote:

> Hi,
>
> Can you share the sample code to differentiate the both telco IP and our
> server IP?
>
> .
>
>
>
> Warm Regards,
> Sandeep Chakravarthi.
>
> On Tue, Jul 14, 2015 at 10:55 PM, SamyGo <govoiper at gmail.com> wrote:
>
>> Sure but if you look into the dispatcher module there is a field called
>> 'setid' or groupid. Use it wisely to differentiate between the Load
>> Balanced asterisk pool and the Telco IP.
>> The dispatcher module is exactly what you should use. You can find out if
>> incoming source IP belongs to a particular set in dispatcher table thus you
>> can tell if call is coming from Telco or from your Asterisks.
>> You can select the dispatcher set for load balancing but if we only have
>> one IP in there then it gets all the load.
>>
>> BR,
>> Sammy
>>
>>
>> On Tue, Jul 14, 2015 at 1:21 PM, Sandeep Chakravarthi <
>> ivschakravarthi at gmail.com> wrote:
>>
>>> Hi,
>>> Thanks for the immediate reply.
>>>
>>> You are right ,using the dispatcher module , i am able to send the
>>> OPTIONS packet to MSC Telco.
>>>
>>> But as i describer in  my earlier mail, i am using the same dispatcher
>>> module to establish the sip trunk  between my My Kamailio server and my
>>> Asterisk server.
>>>
>>> There is a table in the database with the name dispatcher.
>>> Now, in that table i have 2 records
>>> one is my Telco SIP IP and the other is Asterisk PBX IP.
>>>
>>> But as per my understanding from the google, dispatcher module is used
>>> for load balancing between the servers
>>>
>>> Telco SIP server will be sending the calls to Kamailio and Kamailio has
>>> to distribute completely to Asterisk server instead of distributing the
>>> calls between Telco SIP IP and Asterisk.
>>>
>>>
>>> Please help with it.
>>>
>>>
>>>
>>>
>>> Warm Regards,
>>> Sandeep Chakravarthi.
>>>
>>> On Tue, Jul 14, 2015 at 10:28 PM, SamyGo <govoiper at gmail.com> wrote:
>>>
>>>> Hi,
>>>> You're right about using IP Auth in Kamailio. You'll need to use the
>>>> permissions module. However I believe permissions module wont send the
>>>> OPTIONS to the MSC SIP Server. For this you may alternatively use the
>>>> "dispatcher" module.
>>>>
>>>> Take a look at the sample kamailio.cfg here:
>>>> http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb
>>>>
>>>> Follow the tag WITH_IPAUTH and I'm sure you'll be able to implement it
>>>> easily.
>>>>
>>>> BR,
>>>> Sammy
>>>>
>>>> On Tue, Jul 14, 2015 at 12:51 PM, Sandeep Chakravarthi <
>>>> ivschakravarthi at gmail.com> wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>> We have a requirement with one of our telco
>>>>> We are using asterisk in our servers and we are planning to implement
>>>>> SIP-I protocol and we choosed kamailio for it.
>>>>>
>>>>> In Kamailio website, i came to know that kamailio will be supporting
>>>>> both SIP-I and SIP-T protocols
>>>>>
>>>>> Below is what we need and pls confirm whether it is possible or not?
>>>>>
>>>>> Asterisk PBX <-------> Kamailio <--------> Telco MSC
>>>>>
>>>>>
>>>>> Telco will be forwarding the calls to kamailio on sip-i protocol and
>>>>> kamailio server has to forward the calls to our Asterisk server by
>>>>> converting sip-i to standard sip protocol
>>>>>
>>>>> Similiarly Asterisk will be initiating sip call to kamailio server and
>>>>> kamailio server should convert it into SIP-I and should forward the call to
>>>>> Telco MSC
>>>>>
>>>>>
>>>>> 1.  I am able to establish the SIP trunk [sending OPTIONS from
>>>>> asterisk and kamailio acknowledges with 200 OK] between Asterisk and
>>>>> Kamailio using dispatcher module in kamailio and sip.conf in asterisk.
>>>>>
>>>>> How to establish the SIP trunk between kamailio and telco MSC?
>>>>> [Generally MSC will act as SIP server and kamalio should send OPTIONS
>>>>> packet and MSC will acknowledges with 200 OK]
>>>>>
>>>>>
>>>>> My telco MSC has only provided me the MSC SIP IP and there were no
>>>>> username/passwords provided.
>>>>> Means i need to use IP based authentication for the SIP Trunk
>>>>> establishment.
>>>>>
>>>>> In Kamailio how to achieve it?
>>>>>
>>>>> Please help and any suggestions/feedback will be highly appreciated
>>>>> and thankful
>>>>>
>>>>>
>>>>> Regards,
>>>>> Sandeep
>>>>>
>>>>> _______________________________________________
>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>>> sr-users at lists.sip-router.org
>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>> sr-users at lists.sip-router.org
>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150730/f00df1a1/attachment.html>


More information about the sr-users mailing list