OS as L.Balancer of 3 OpensSips

  • Zeux

    Zeux - 2013-03-29

    first of all I'm very sorry for my English…

    I have to project a Voip provider and I would put 2 Opensips in H.A. (Active/Passive with heartbeat) as Load Balancer of 2
    or more Opensips servers that work as SIP Proxy (Registrar, Authentication, Accounting, dynamic routing, LCR and so on…).
    There will be also 2 or more RTP Proxy (each one with 2 public IPs) to resolve NAT problems, 1 Mysql DB for Users, location,registration) and 1 for CDR. Finally 2 ore more gateways.

    H.B.: Heartbeat
    OS.LB.: OpenSIPS Load Balancer
    OS.P.: OpenSIPS Proxy
    FW: Firewall
    Pr.IP: Private IP
    Pub.IP: Public IP
    RTP: RTP Proxy Server
    G.W.: Gateway
    MySQL_U: Mysql Server for users
    MySQL_C: Mysql Server for CDR

    -----------      -------------      -----------------                  -----------------
    -UAC(Pr.IP)- -- -FW(Pub.IP1)- -- -OS.LB1(Pub.IP2)- --H.B.-- -OS.LB2(Pub.IP2)-
    -----------      -------------      -----------------        |         -----------------
                    |                               |                       |               |                   |                |                       |                                |
    ---------------   ---------------   ----------------    ----------------   ---------------    ----------------
    -OS.P.(Pub.IP3)-   -OS.P.(Pub.IP4)-   -RTP(Pub.IP5+6)-   -RTP(Pub.IP7+8)-    -G.W.1(Pub.IP9)-   -G.W.1(Pub.IP10)-
    ---------------   ---------------   ----------------   -----------------   ---------------    ----------------
            |                |
            |                                               |
    -----------------   -----------------
    -MySQL_U(Pr.IP1)-   -MySQL_C(Pr.IP2)-
    -----------------   -----------------

    Now I have some questions…

    1. UAC contacts OS.LB. active (Pub.IP2) and it forwards the call to one of OS.P. (e.g. Pub.IP3). At this point OS.P. contacts
    directly (without passing throw OS.L.B.) UAC and starts SIP call. The questions are: the FW of the UAC lets pass only packets that have Pub.IP2 and not Pub.IP3, how can I solve this problem? And the UAC expects a response from Pub.IP2 and not Pub.IP3…

    2. Can I share (between OS.P.) registered users using MySQL_U?

    3. How can I share call status between OS.P.?

    Thanks a lot…

  • Bogdan-Andrei Iancu


    Your diagram is really not readable because of alignment :( .

    1) FW issue cannot be solved; neither the UAC issue - I suggest keeping the LB in the path for the rest of the call.

    2) you can use the db_mode - DB ONLY for the usrloc module.

    3) you cannot share calls between 2 opensips instances.


  • Zeux

    Zeux - 2013-04-02

    Thank you very much Bogdan…
    How can I have a preview of my post before posting it or how can I modify it?

    Back to opensips…

    1) Can I keep the LB in the path using "path module"? And how it affects the performance of the LB?

    3) My goal is: if one of the OS.P. goes down the calls that it was managing continue to work throws the other OS.P. Is possible to do it using memcache or redis module?

    Another question: if LB selects (for the first INVITE)  the OS.P.1, the other requests/messages (INVITE, OPTION, BYE, CANCEL as so on…) of the same call will be routed always to OS.P.1? if not, how the others OS.P. manages that call?


  • Bogdan-Andrei Iancu


    I think you cannot change old posts :(

    1) not PATH (which is for REGISTER), but do Record-Route at INVITE time, so the whole dialog (as signaling) will stay through the LB

    3) in order to move a call from on opensips server to another one, you have to (2) be sure the 2 opensips instances use the same IP (as the dialog is bound to an IP) and (2) use the dlg_db_sync MI command to force the second opensips to load the dialogs from DB (considering that it may found there the dialogs created by first opensips).

    4) yes, LB (if using Load-Balance module) works at dialog level, so the whole dialog will be pushed to a certain destination.