Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

OpenSIPs load balancer and server replication

2010-08-19
2013-05-09
  • Dan Colavito
    Dan Colavito
    2010-08-19

    Can OpenSIPS support load balancing with server replication? In other words if OpenSIPS is load balancing across 2 different servers that both replicate all open sessions can OpenSIPS support switching the SIP dialog session to the other server in the middle of a SIP call if one of the servers goes down?

    Here's an example scenario:

    1. SIP call #1 goes through OpenSIPs and it routes the call to Server #1 using the load balancer
    2. SIP call #2 goes through OpenSIPs and it routes the call to Server #2 using the load balancer
    3. Both calls have established SIP dialogs after INVITE, 200OK and ACK
    4. Server #2 goes down and Server #1 takes over Sip call #2 from Server #2
    5. Server #1 sends a BYE to OpenSIPS that should be routed to the SIP call #2 that originally called into Server #2

    Will OpenSIPs know to route the BYE to the proper SIP client even through the BYE came from a different server? If so, does it work based on Record-Route and Route or some other way?

    Thanks.

     
  • Dan Colavito
    Dan Colavito
    2010-08-19

    Nevermind, it does work. I got it working sooner than I thought I would.

     
  • Abi
    Abi
    2010-09-02

    Hi dcola,
    I'm interested lately to implement load balancing between two Asterisk boxes. I have setup the Asterisk boxes successfully but i can't understand how i can get OpenSIps to do load balancing.
    Following the tutorial "GetingStarted" for OpenSER, i couldn't even register a simple SIP client to OpenSIPS.  I receive allways the error: 403, no relay.

    I used OPenSips VM since i had problems installing it in Ubuntu.
    If appreciate any idea you or any other have.

     
  • mariana
    mariana
    2012-02-03

    Hi dcola,

    I have a similar issue. We are using an OpenSIPS as the load balancer and another 2 OpenSIPS as proxies. We want to make sure that if the load balancer chooses proxy #1 as the destination for a new call and the proxy #1 goes down, load balancer would redirect the BYE to proxy #2 and proxy #2 would be able to handle it, as both proxies are using the same database for dialog information and we have set the db_mode dialog parameter to 1 (REALTIME - any dialog information changes will be reflected into the database immediately) on both proxies. Instead, what happened is proxy #2 was not aware of the dialog and gave us a 500 Server error occurred message. Here are the log errors:

    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: New request: BYE
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: CONNECT R3: Message from Lync to PSTN
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: Message from LYNC to PSTN
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: The request has TO tag
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: ***************** cannot match request to a dialog
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: ***************** in-dialog valid request - <null> !
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: loose_route() performed, rr headers were decoded
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: ERROR:core:parse_uri: uri too short: <0> (1)
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: ERROR:core:parse_sip_msg_uri: bad uri <0>
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: ERROR:tm:new_t: uri invalid
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: ERROR:tm:t_newtran: new_t failed
    Feb  3 10:55:57 brdl64vm01 /usr/local/sbin/opensips: Could not execute t_relay()

    Interesting test we have done is:

    UAC sends an INVITE to LB
    LB redirects the call to proxy #1
    Proxy #1 does not write every dialog information to the DB immediately
    Proxy #1 is restarted and the dialog information is now in the DB
    UAC sends the BYE to LB
    LB redirects the BYE to proxy #2
    Now proxy #2 knows everything about this dialog and the call is finished successfully

    Why is the dialog module not saving all dialogs information to the database right away?

    Thanks in advance.
    Mariana.