[OpenSIPS-Users] OpenSips as an inbound loadbalancer and outbound proxy - issue with routing BYES

Matt Stockton mstockton at harqen.com
Fri Nov 11 01:46:27 CET 2011


Hi all,

I am currently using OpenSips as an inbound loadbalancer and an outbound
proxy. It does the following for me:
- Receives calls from my provider and balances them across several
Freeswitch nodes.
- Accepts calls from the several Freeswitch nodes, and dispatches them to
various providers

Note that I do not have to support any registration, just invites as
mentioned above.
I am using the load_balancer module to balance the inbound calls to
OpenSips, and I am using the drouting module to route the calls initiated
at the Freeswitches and sent through OpenSips.

Most things seem to be working smoothly, except for one issue. When I make
calls out of the Freeswitch -> OpenSips -> Provider -> PSTN, sometimes the
OpenSips is not properly routing the BYE message when the call is hung up.

I can see the BYE message coming in from the provider, but it looks like
sometimes they have changed the BYE header.

When it comes into me like the following, it is working fine for me,
OpenSips forwards the BYE on to the correct Freeswitch node, which is
located at .223
BYE sip:gw+opensips_0 at 10.10.10.223;transport=udp;gw=opensips_0 SIP/2.0

However, sometimes it comes in like this:
BYE sip:gw+opensips_0 at PUBLIC_IP_OF_OPENSIPS:47013;transport=udp;gw=opensips_0
SIP/2.0

When this occurs, OpenSips seems to try to forward the BYE back to itself,
using the PUBLIC_IP_OF_OPENSIPS.

I understand that I must be doing something wrong if I am exposing the
private IPs of my systems externally, but I'm not understanding why the BYE
message is sent differently by the provider without any changes and it is
intermittently happening.

Any advice here? I am a newbie to OpenSips, so apologies if these are real
basic questions.

Here is my route block, FYI:

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
                loose_route();
                t_relay();
                exit;
        }

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

        if (is_method("INVITE")) {
                # This is the outgoing route to the pstn if it is coming
from internal
                if(src_ip =~ "^10\.10\..*"){
                        setflag(1); # do accounting
                        route(pstn_outgoing); # Call our dynamic route.
                } else {
                        # This is loadbalancing the incoming calls from the
pstn
                        setflag(1);
                        route(lb_incoming);
                }
        }else {
                send_reply("405","Method Not Allowed");
                exit;
        }

        # route the request
        if (!t_relay()) {
                sl_reply_error();
        }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20111110/59de1f2e/attachment-0001.htm>


More information about the Users mailing list