[SR-Users] Kamailio HA with Virtual IP and multiple Asterisk servers for dispatching

Rumen Mihailov zealas1662 at gmail.com
Thu Nov 29 10:44:35 CET 2012


Hello Samy,

this is driving me nuts.

take a look at that:
Kamailio 1
[root at kamailio-1 ~]# kamctl dispatcher show
dispatcher gateways
+----+-------+----------------------+-------+----------+-------+-------------------+
| id | setid | destination          | flags | priority | attrs |
description       |
+----+-------+----------------------+-------+----------+-------+-------------------+
|  1 |     1 | sip:10.2.45.98:5060  |     8 |        1 |       | asterisk-1 |
|  2 |     1 | sip:10.2.45.103:5060 |     8 |        1 |       | asterisk-2 |
+----+-------+----------------------+-------+----------+-------+-------------------+
[root at kamailio-1 ~]# kamctl dispatcher dump
SET_NO:: 1
SET:: 1
        URI:: sip:10.2.45.103:5060 flags=IP priority=1 attrs=
        URI:: sip:10.2.45.98:5060 flags=IP priority=1 attrs=

All is OK.
KAMAILIO 2
[root at kamailio-2 ~]# kamctl dispatcher show
dispatcher gateways
+----+-------+----------------------+-------+----------+-------+-------------------+
| id | setid | destination          | flags | priority | attrs |
description       |
+----+-------+----------------------+-------+----------+-------+-------------------+
|  1 |     1 | sip:10.2.45.98:5060  |     8 |        1 |       | asterisk-1 |
|  2 |     1 | sip:10.2.45.103:5060 |     8 |        1 |       | asterisk-2 |
+----+-------+----------------------+-------+----------+-------+-------------------+

as we can see setid = 1 for both servers, they actually read the data
from one and the same location which is a MySQL table.
[root at kamailio-2 ~]# kamctl dispatcher dump
SET_NO:: 2
SET:: 2
        URI:: sip:10.2.45.103:5060 flags=IP priority=1 attrs=
SET:: 1
        URI:: sip:10.2.45.98:5060 flags=IP priority=1 attrs=

Why the .... are they in different sets ?!?!?!?!

I really can't understand this one...
Anyone ... help ?

Thanks

On 28 November 2012 19:31, SamyGo <govoiper at gmail.com> wrote:
> 1 - Why do you get two different SET Ids for two asterisk servers ? Is it
> intentional ?
> 2 - Please ensure that after failing back to primary the linux routes are
> working and there is no issue with network layer connectivity.
> Also how are your calls failing ? What do Kamailio complain ? Enable SIP
> debug on your asterisk server and get a tcpdump on your kamailio server when
> you get this issue.
> Im pretty sure tcpdump will tell you whats happening.
>
> On Nov 28, 2012 10:07 PM, "Rumen Mihailov" <zealas1662 at gmail.com> wrote:
>>
>> The two configuration files are 100% identical.
>>
>> On 28 November 2012 19:01, Rumen Mihailov <zealas1662 at gmail.com> wrote:
>> > Hi again and thank you for your help,
>> >
>> > This is what happened when I changed the flags to 8 and restarted both
>> > kamailios
>> > ACTIVE KAMAILIO
>> > SET_NO:: 2
>> > SET:: 2
>> >         URI:: sip:10.2.45.103:5060 flags=AP priority=1 attrs=
>> > SET:: 1
>> >         URI:: sip:10.2.45.98:5060 flags=AP priority=1 attrs=
>> >
>> > PASSIVE KAMAILIO
>> > SET_NO:: 1
>> > SET:: 1
>> >         URI:: sip:10.2.45.103:5060 flags=IP priority=1 attrs=
>> >         URI:: sip:10.2.45.98:5060 flags=IP priority=1 attrs=
>> >
>> > When I stop kamailio 1 kamailio two takes the Virtual IP and
>> > everything works like a charm, when I start kamailio 1 again the same
>> > issue appears calls are only routed to the 10.2.45.103 asterisk....
>> >
>> > What might be the problem that they are in different set ?
>> >
>> >
>> > On 28 November 2012 18:37, SamyGo <govoiper at gmail.com> wrote:
>> >>
>> >> Well these are two different dispatcher groups, one is SET:1 10.2.45.98
>> >> where the calls are routed - the other one is SET:2 which you are
>> >> definitely
>> >> not calling in your ds_select() function.
>> >>
>> >> Also the flags=IP are, I think, saying that asterisk servers are
>> >> inactive
>> >> and kamailio is probing them, not sure about it. mine always show me
>> >> flags=AP for active servers.
>> >>
>> >> Also how have you defined the
>> >>
>> >> ds_ping_reply_codes
>> >>
>> >> http://www.kamailio.net/docs/modules/3.2.x/modules_k/dispatcher.html#id2495999
>> >>
>> >> Parameter such that if asterisk responds with a 484 or 404 or anyother
>> >> negative response to the dispatcher OPTIONS SIP ping then consider it
>> >> active.
>> >>
>> >> Hope this will get your issue resolved.
>> >>
>> >> The thing is the dispatcher in kamailio or load-balancer in OpenSIPS
>> >> both
>> >> set the Initial flags of all the servers in the table to Active/Enabled
>> >> !
>> >> that means if I have a server which is down and I reload the dispatcher
>> >> module it will mark that down server to UP and my calls will timeout
>> >> trying
>> >> to send calls to that instance !
>> >>
>> >> Thanks,
>> >> Sammy
>> >>
>> >>
>> >>
>> >>
>> >> On Wed, Nov 28, 2012 at 9:25 PM, Rumen Mihailov <zealas1662 at gmail.com>
>> >> wrote:
>> >>>
>> >>> Hello Samy,
>> >>>
>> >>> this is what I got:
>> >>>
>> >>>
>> >>> SET_NO:: 2
>> >>> SET:: 2
>> >>>         URI:: sip:10.2.45.103:5060 flags=IP priority=1 attrs=
>> >>> SET:: 1
>> >>>         URI:: sip:10.2.45.98:5060 flags=IP priority=1 attrs=
>> >>>
>> >>>
>> >>> on both machines. Moreover now without any changes dispatcher is not
>> >>> working at all. Only sending calls to the asterisk-1 (10.2.45.98)
>> >>>
>> >>> On 28 November 2012 18:20, SamyGo <govoiper at gmail.com> wrote:
>> >>> > Hi again,
>> >>> >
>> >>> > I think instead of dispatcher show use "kamctl dispatcher dump" That
>> >>> > will
>> >>> > show you the kamailio status of these servers.  The flag 0, I'm not
>> >>> > sure
>> >>> > about that I always use 8 to re-activate the server if the ping gets
>> >>> > back.
>> >>> >
>> >>> > Hope to hear from you
>> >>> > --
>> >>> > Sammy
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> > On Wed, Nov 28, 2012 at 8:57 PM, Rumen Mihailov
>> >>> > <zealas1662 at gmail.com>
>> >>> > wrote:
>> >>> >>
>> >>> >> Hello again,
>> >>> >>
>> >>> >> I was able to perform tests and this is the output:
>> >>> >> Kamailio-1: 10.2.45.106
>> >>> >> Kamailio-2: 10.2.45.109
>> >>> >> Asterisk-1: 10.2.45.98
>> >>> >> Asterisk-2: 10.2.45.103
>> >>> >>
>> >>> >> I can ping both asterisks from both kamailios
>> >>> >> here are stats:
>> >>> >> FROM KAMAILIO-1
>> >>> >> [root at kamailio-1 ~]# ping 10.2.45.98
>> >>> >> PING 10.2.45.98 (10.2.45.98) 56(84) bytes of data.
>> >>> >> 64 bytes from 10.2.45.98: icmp_seq=1 ttl=64 time=0.315 ms
>> >>> >> ^C
>> >>> >> --- 10.2.45.98 ping statistics ---
>> >>> >> 1 packets transmitted, 1 received, 0% packet loss, time 773ms
>> >>> >> rtt min/avg/max/mdev = 0.315/0.315/0.315/0.000 ms
>> >>> >> [root at kamailio-1 ~]# ping 10.2.45.103
>> >>> >> PING 10.2.45.103 (10.2.45.103) 56(84) bytes of data.
>> >>> >> 64 bytes from 10.2.45.103: icmp_seq=1 ttl=64 time=0.489 ms
>> >>> >> 64 bytes from 10.2.45.103: icmp_seq=2 ttl=64 time=0.268 ms
>> >>> >>
>> >>> >> FROM KAMAILIO-2
>> >>> >> [root at kamailio-2 ~]# ping 10.2.45.98
>> >>> >> PING 10.2.45.98 (10.2.45.98) 56(84) bytes of data.
>> >>> >> 64 bytes from 10.2.45.98: icmp_seq=1 ttl=64 time=1.46 ms
>> >>> >> 64 bytes from 10.2.45.98: icmp_seq=2 ttl=64 time=0.324 ms
>> >>> >> ^C
>> >>> >> --- 10.2.45.98 ping statistics ---
>> >>> >> 2 packets transmitted, 2 received, 0% packet loss, time 1036ms
>> >>> >> rtt min/avg/max/mdev = 0.324/0.893/1.462/0.569 ms
>> >>> >> [root at kamailio-2 ~]# ping 10.2.45.103
>> >>> >> PING 10.2.45.103 (10.2.45.103) 56(84) bytes of data.
>> >>> >> 64 bytes from 10.2.45.103: icmp_seq=1 ttl=64 time=2.09 ms
>> >>> >> 64 bytes from 10.2.45.103: icmp_seq=2 ttl=64 time=0.350 ms
>> >>> >> ^C
>> >>> >>
>> >>> >> Those are the 'kamctl dispatcher show' outputs:
>> >>> >> KAMAILIO 1
>> >>> >> [root at kamailio-1 ~]# kamctl dispatcher show
>> >>> >> dispatcher gateways
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> +----+-------+----------------------+-------+----------+-------+-------------------+
>> >>> >> | id | setid | destination          | flags | priority | attrs |
>> >>> >> description       |
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> +----+-------+----------------------+-------+----------+-------+-------------------+
>> >>> >> |  1 |     1 | sip:10.2.45.98:5060  |     0 |        1 |       |
>> >>> >> asterisk-1 |
>> >>> >> |  2 |     1 | sip:10.2.45.103:5060 |     0 |        1 |       |
>> >>> >> asterisk-2 |
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> +----+-------+----------------------+-------+----------+-------+-------------------+
>> >>> >>
>> >>> >> KAMAILIO 2
>> >>> >> [root at kamailio-2 ~]# kamctl dispatcher show
>> >>> >> dispatcher gateways
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> +----+-------+----------------------+-------+----------+-------+-------------------+
>> >>> >> | id | setid | destination          | flags | priority | attrs |
>> >>> >> description       |
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> +----+-------+----------------------+-------+----------+-------+-------------------+
>> >>> >> |  1 |     1 | sip:10.2.45.98:5060  |     0 |        1 |       |
>> >>> >> asterisk-1 |
>> >>> >> |  2 |     1 | sip:10.2.45.103:5060 |     0 |        1 |       |
>> >>> >> asterisk-2 |
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> +----+-------+----------------------+-------+----------+-------+-------------------+
>> >>> >>
>> >>> >> Both asterisks can also ping both kamailios
>> >>> >>
>> >>> >> ds_select_dst("1","4");
>> >>> >>
>> >>> >> this is what I have in my route[TOASTERISK]
>> >>> >>
>> >>> >> Any thought guys ?
>> >>> >>
>> >>> >> Best regards,
>> >>> >> Rumen
>> >>> >>
>> >>> >> On 28 November 2012 09:55, Rumen Mihailov <zealas1662 at gmail.com>
>> >>> >> wrote:
>> >>> >> > Hello Samy,
>> >>> >> >
>> >>> >> > Thank you for the hint, I will test later today and let you know
>> >>> >> > the
>> >>> >> > results.
>> >>> >> >
>> >>> >> > Best regards,
>> >>> >> > Rumen
>> >>> >> >
>> >>> >> > On 28 November 2012 07:00, SamyGo <govoiper at gmail.com> wrote:
>> >>> >> >> Hi,
>> >>> >> >>
>> >>> >> >> Just few quick questions , can you ping the second asterisk from
>> >>> >> >> secondary
>> >>> >> >> Kamailio ? what is the routing set for that. Does your second
>> >>> >> >> asterisk
>> >>> >> >> box
>> >>> >> >> gets inactive in dispatcher show command after 30 seconds ?
>> >>> >> >> Mine worked fine, the key is the linux routing table.
>> >>> >> >>
>> >>> >> >> BR
>> >>> >> >> Sammy
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> On Tue, Nov 27, 2012 at 7:29 PM, Rumen Mihailov
>> >>> >> >> <zealas1662 at gmail.com>
>> >>> >> >> wrote:
>> >>> >> >>>
>> >>> >> >>> .s. Thank you for creating such a wonderful product. Thank you
>> >>> >> >>> !!!
>> >>> >> >>
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> _______________________________________________
>> >>> >> >> 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
>> >>
>>
>> _______________________________________________
>> 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
>



More information about the sr-users mailing list