[OpenSIPS-Users] Load balancing to Asterisk

Stephen Vigus svigus at gmail.com
Fri Jun 28 08:36:42 CEST 2013


Hi guys

First time posting to the list.

I am investigating the use of Opensips to load balance between Asterisk
boxes. I have a running testing environment, where Opensips successfully
load balances between the Asterisk boxes. However, after a few days of
reading and struggling, I came to a dead end with a specific test.

I have my extensions registered to Opensips and want them to be able to
phone each other, but I cannot seem to get this working. Every time I
attempt to dial another extension, I see the dialplan triggered on one of
the Asterisk boxes and then it fails.
Calls coming in over a trunk are load balanced fine and reaches an IVR I
configured on both Asterisk boxes.

What am I missing or doing wrong?

Below are my routing in opensips.cfg:
route{

        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        }

        if (!has_totag()) {
                # initial request
                record_route();
        }
        else {
                # sequential request - obey the indicated route
                lookup("location");
                loose_route();
                t_relay();
                exit;
        }

        # handle cancel and re-transmissions
        if ( is_method("CANCEL") ) {
                if ( t_check_trans() )
                        t_relay();
                exit;
        }

       # record routing
        if (!is_method("REGISTER|MESSAGE"))
                record_route();

       if (is_method("REGISTER"))
        {
                if (!save("location"))
                        sl_reply_error();
                exit;
        }


        # from now on we have only the initial requests

        # select the node that'll handle the call (load balanced)
        # the method used is different for invite/register requests
        # unknown methods are rejected here
        if (is_method("INVITE")) {
                if (!load_balance("1","pstn","1")) {
                        send_reply("503","Service Unavailable");
                        exit;
                }
        }

        else {
                send_reply("405","Method Not Allowed");
                exit;
        }

        # route the request
        if (!t_relay()) {
                sl_reply_error();
        }
}


Please excuse me if this comes off as daft, this week was my first look
into Opensips.

Regards
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130628/eea8c64e/attachment-0001.htm>


More information about the Users mailing list