[OpenSIPS-Users] Running OpenSIPS on same box as Asterisk/FreeSwitch

Ben Newlin Ben.Newlin at genesys.com
Tue May 19 13:36:57 EST 2020


John,

This is occurring because the local OpenSIPS is seeing its own local URI in the R-URI and is (correctly) assuming the message is meant for it. At that point there is some ambiguity in the situation as even though the Route headers indicate loose routing, OpenSIPS cannot leave the R-URI as is, because it will just loop back to itself. So it is instead assuming that strict-routing is being used and following that model.

We also run with different servers sharing IPs and we ran into this too. You say the two servers are using different ports, but I am guessing that the R-URI doesn't actually contain the port. That is why there is confusion. The only fix I know is to ensure that every server sharing an IP always includes its local port in the Contact header. This will cause all sequential requests to also contain the port in their R-URI. This differentiates the R-URI so that OpenSIPS will no longer believe the message is directed to it and will follow normal loose routing procedures.

I'm not really sure whether there could be any improvement in OpenSIPS that could handle this, since the situation is inherently ambiguous.

Ben Newlin 

On 5/19/20, 3:56 AM, "Users on behalf of John Quick" <users-bounces at lists.opensips.org on behalf of john.quick at smartvox.co.uk> wrote:

    Hi James and others,

    James, I have provided some explanation and guidance specific to you at the end of this post. First, I need to retract some of the explanation I gave in my original post because it was wrong. The basic problem is as described - handling of loose routed sequential requests goes wrong when OpenSIPS is running on the same host server as Asterisk or FreeSwitch, using the same IP but different ports.

    I think the correct explanation for what is happening is this: 
    Where the address in the R-URI is the same as its local address, OpenSIPS copies the URI (and parameters) from a Route header to the R-URI which, in this use-case, causes the request to loop back to itself. It should instead delete the two Route headers and leave the original R-URI value unchanged.

    James, what you describe is not identical to my issue, although you may have my issue plus another.
    It should be fairly easy for you to fix the problem of private LAN addresses being used where you want external IP's to be used.
    OpenSIPS handles this issue through the "advertised address". This allows it to listen on one interface, but to populate SIP headers such as Via and Record-Route with another.
    Various mechanisms are available to add to your script including the following:
    1) Define it for each interface in the listen statement: e.g.  listen = tls:10.x.x.x:5091 as <External IP>:5091
    2) Global settings at the top of your script:  advertised_address and advertised_port
    3) Within the main body of your script, e.g. just before the call to record_route(), insert a line like: set_advertised_address(<External IP>);
    4) Instead of calling record_route(), call record_route_preset(<address1:port>,<address2:port>); 
    The first two are described in the section called 'Global Parameters' in the documentation
    The third one is described in 'Core Functions' (In v2.4, they are items 45 and 46)
    The fourth is documented in the RR module notes

    John Quick
    Smartvox Limited


    > From: James Hogbin <james at ip-sentinel.com> 
    > Sent: 18 May 2020 17:24
    > To: john quick <john.quick at smartvox.co.uk>; OpenSIPS users mailling list <users at lists.opensips.org>
    > Subject: Re: [OpenSIPS-Users] Running OpenSIPS on same box as Asterisk/FreeSwitch
    >
    > I thought I had just done some bad config. I have almost exactly the same thing.
    >
    > I have Freeswitch And Opensips on Azure VM’s
    >
    > Freeswitch = 10.0.0.4 + External IP
    > Opensips = 10.0.0.5 + External IP
    >
    > Both are configured to use the external addresses
    >
    > Freeswitch will start the conversation on its external Gateway IP address with the Opensips external IP address
    >
    > However the moment I put the Record_Route in the message to Teams Freeswitch starts using the local 10.x.x.x. address on opensips rather than the external address for ACK and BYE which rogers the whole thing up.
    >
    > I’m sure there is probably some way to fix it in the opensips plan as the dialog/transaction ID’s are still there but it’s beyond me.
    >
    > James
    > James Hogbin 
    > Director 


    _______________________________________________
    Users mailing list
    Users at lists.opensips.org
    http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list