How to Load Balance the SIP REGISTER

Avestan
2010-10-11
2013-05-09
  • Avestan

    Avestan - 2010-10-11

    Hello,

    Can someone explain how the following code can be used in the Load-Balancing scenario to detect resources and carry the LB?

            # detect resources and do balancing
            if ($rU=~"^1") {
                    # looks like a Conference call
                    load_balance("1","conf");
            } else if ($rU=~"^2") {
                    # looks like a VoiceMail call
                    load_balance("1","vm");
            } else {
                    # PSTN call, but the GWs supports only G711
                    # for calls without G711, transcoding will be used on the GW
                    if ( !search_body("G711") ) {
                           load_balance("1","transc;pstn");
                    } else {
                           load_balance("1","pstn");
                    }
            }
    I don't understand how $rU=~"^1" means the call is a conference call and the same goes for $rU=~"^2"

    I have spent a decent time reading the OpenSER book by Flavio E. Goncalves and been searching online but I am unable to find any information.

    I am trying to use Asterisk Realtime for the SIP Registration while the OpenSIPS is used only for the load balancing.

    I think I need something similar to the following:

            if (is_method("REGISTER")) {
                    xlog(“Register process starts here! \n”);
                    load_balance(“1”, “reg”)
                    exit;
            }

    While the information in the database is as follow:

    +---+-------+----------------+---------------------------------+
    | id | group_id | dst_uri                | resources                                                   |
    +---+-------+----------------+---------------------------------+
    |  1 |        1 | sip:yate1.mycluset.net | reg=30; pstn=32                                  |
    |  2 |        1 | sip:yate2.mycluset.net | reg=100; transc=10                            |
    |  3 |        1 | sip:yate3.mycluset.net | vm=50; conf=300                                 |
    |  4 |        1 | sip:yate4.mycluset.net | vm=10;conf=10;transc=10;pstn=32 |
    +---+-------+----------------+----------------------+

    Thank you very much for your help.

    Khoramdin

     
  • Avestan

    Avestan - 2010-10-28

    Hello,
    I wish to use a combination of the OpenSIPS and Asterisk Boxes for SIP registration.  In this scenario I wish the Asterisk to act as the Registrar while the OpenSIPS is operating as a Load Balancer of the SIP registration.  In this scenario, I have the Two Asterisk Boxes for the High-Availability in addition that the SIP registration is load balanced between the Two Asterisk Boxes.
    This is the setting I would like to have:
    UAC ---> OpenSIPS  ---> Asterisk 1 and 2 ---> Location Server
    Initially, I tried the following which uses the variable $du to set the dst URI and send the Registration request to the Asterisk Box.
            if (is_method("REGISTER"))   {

                    $du = "sip:XXX.XXX.XXX.XXX:5060";
                    t_relay();
                    exit;
            }

    In this scenario if the Asterisk Box goes down, no UAC would be able to make a SIP Registration. Therefore, I decided to add the second Asterisk Box and use the OpenSIPS to load balance the SIP Registration between the two asterisk boxes. In this case if one Asterisk box goes down, there would be the second Asterisk Box to deal with the SIP registration.

    I tried the load_balance module for doing this as follow:

            if (is_method("REGISTER"))   {

                    #load_balance("1","reg");
                    t_relay();
                    exit;
            }

    While I have added the resource “reg” to the table “load_balancer” under the “opensips” database, as shown here”

    mysql> SELECT * FROM load_balancer;
    +---+-------+--------------+--------------------------+--------+---------+
    | id | group_id | dst_uri             | resources                             | probe_mode | description |
    +---+-------+--------------+--------------------------+--------+---------+
    |  1 |        1 | sip:xxx.xxx.xxx.xxx | transc=5; pstn=5; vm=5; conf=5        |          2 |             |
    |  2 |        1 | sip:xxx.xxx.xxx.xxx | transc=5; pstn=5; vm=5; conf=5; reg=5 |          2 |             |
    |  3 |        1 | sip:xxx.xxx.xxx.xxx | transc=5; pstn=5; vm=5; conf=5; reg=5 |          2 |             |
    +---+-------+--------------+--------------------------+--------+---------+
    3 rows in set (0.00 sec)

    Even though I don’t think this is a right way to do this, but I can get this working for few Registered/ Unregistered of a SIP UAC.

    The reason for the load_balance module not being the right module is evidenced under table “dialog”.

    Can someone tell me if the OpenSIPS is equipped with such a module for load balancing SIP Registration for the High Availability configuration?

    I am aware the I can have the second Asterisk Box with floating IP address and Heartbeat and mon  or similar software for server and service High Availability.  But I wish to do this as I explained at the start.

    Can someone point me to the right module?

    Thanks,

    Babak

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks