Hi friends,

I am having problems setting up seamless openser registrar failover. I am trying to setup OpenSER registrar HA using 2 openser registrars v1.3.0 behind a Netscaler citrix Load balancer and I cant get the failover scenario to work without re-registration of the remote sip client.

I am desperately looking for tips to make this configuration work or any other ideas to achieve SIP registrar HA using OpenSER. Thanks.



The setup is configured as active-passive and the 2nd OpenSER becomes active only after a Openser_1 fails and the LB fails-over to the 2nd. The 2 openser servers are SIP registrars for my voice network.

REGISTRATION:
remote SIP UA ---> remote firewall ---> internet ---> my firewall ---> citrix NA loadbalancer (VIP) ----> openSER_1
                                                                                                                                         \---> openSER_2

1.   Remote SIP client configures the LB VIP as the SIP proxy and registers
2.   the citrix LB gets the registrations and forwards to the active openser (say, openser_1)
3.   openser_1 stores the contact as MIP:port in the mysql database
4.   openser_1 replicates the registration to openser_2 (t_replicate)

OUT-GOING CALL - before fail-over
remote SIP UA <--- remote firewall <--- internet <--- my firewall <--- citrix NA loadbalancer (VIP) <----> openSER_1
                                                                                                                      ^                          openSER_2
                                                                                                                      |
                                                                                                                Asterisk

1.   call (INVITE) is generated from asterisk and sent to LB VIP
2.   the citrix LB gets the INVITE and forwards to the active openser (say, openser_1)
3.   openser_1 looks-up the URI in the MySQL database, finds the MIP:port that the registration was received from the LB and forwards the INVITE to that destination.
4.   the LB receives the INVITE and forwards it to the remote SIP client


OUT-GOING CALL - after fail-over
remote SIP UA ---x remote firewall ---x internet   ---x my firewall ---x citrix NA loadbalancer (VIP) ----x  openSER_1
                                                                                                                      ^               \-----<   openSER_2
                                                                                                                      |
                                                                                                                Asterisk

1.   call (INVITE) is generated from asterisk and sent to LB VIP
2.   the citrix LB gets the INVITE and forwards to the openser now active (openser_2)
3.   openser_2 looks-up the URI in the MySQL database, finds the same MIP:port of the LB that was replicated from openser_1 and forwards the INVITE to that destination.
4.   the LB receives the INVITE and drops the packet without forwarding it out to the remote SIP client



For the outgoing call to work: the remote sip client either has to re-register, so the registration gets passed to openser_2. OR, openser_1 is made active again.


Configuration of OpenSER:

REGISTRATION:
                # If this is a registration from the public UA,
                # then we store it
                fix_nated_contact(); # use ip address of the packet instead of the sip message
                force_rport(); # append rport. might not be necessary

                # save Registration in location table
                save("location");
                xlog("L_DBG", "SipMsgId[$mi] Save Registration: To[$tu] Contact[$ct]\n");
    append_hf("CtlRegFwd: \r\n");
                # replicate the register message to the backup registrar
    # if I am the backup, ignore the message
                if(!t_replicate("sip:openser_2:5060")) {
                    xlog("L_WARN", "SipMsgId[$mi] Fail to replicate Contact[$ct] to fail over registrar\n");

OUTGOING CALL:

            # Do lookup so it gets to the correct NATed destination
            if (!lookup("location"))
            {
                # this user has not REGISTERed or registration has expired
                xlog("L_INFO", "SipMsgId[$mi] Send 404-Not Found (Msg rejected because user not found)\n");
                sl_send_reply("404", "Not Found");
                exit;
            };

    # keep track of reply
    t_on_reply("11");
    if (!t_relay())
    {
        xlog("L_DBG", "SipMsgId[$mi] Failed t_relay. Do sl_reply_error.\n");
        sl_reply_error();
    };



Thank you for your anticipated help.

Regards,

Buki A