[OpenSIPS-Users] TCP to UDP proxy

Simon Quigley squigley at versature.com
Fri Oct 25 18:42:09 CEST 2013


I'm trying to use OpenSIPS as a TCP to UDP proxy, (with the registrar
module disabled) connecting all sorts of devices from different IP
addresses over TCP to a UDP switch.

So far I've managed to get OpenSIPS configured to change the contact
header, and the SDP, append the transport, and forward the packets
correctly, for making an outbound call (from TCP device to UDP switch).

I've got incoming to work somewhat (from UDP switch to TCP device), the
INVITE will pass, and the TRYING/RINGING gets back to the switch, however
the issue I'm having is that the OK packet from the TCP device is sent to
the switch, which responds with the ACK, however the contact header is
wrong, and OpenSIPS is trying to sent the ACK to the internal non routable
IP of the device.

As a result the call comes up, but the device has an ACK timeout and drops
the call.

I'm having difficulties working out how to get the contact header mangled
sufficiently for the OK/ACK to contain the routable IP of the TCP device,
rather than it's internal/behind NAT IP.

I've tried removing the header, using loose_route, using t_relay, and (am
currently attempting) to use route(relay).

Also of relevance, is the fact that I'm running OpenSIPS on a Google
Compute VM, so it's behind 1 to 1 NAT, with a non routable IP on the VM,
but I have assigned a static routable IP to the 1 to 1 NAT, and I have DNS
pointing to this routable IP.

Here's my config file, excluding default values/routes etc:

listen=udp:[internal VM IP]:5060
listen=tcp:[internal VM IP]:5060


advertised_address="[DNS name]"
alias="[DNS name]"

    if (src_ip != "[switch ip]"){
        # from device
        if (is_method("INVITE")) {
        else if (is_method("OPTIONS")){

        forward ("udp:[switch ip]:5060");

    else if (src_ip == "[switch ip]"){
        # from switch
        if (is_method("INVITE")) {
        else if (is_method("ACK")) {

        # mangle to TCP
        $du = $ru + ";transport=tcp";



Is the issue perhaps related to the fact I'm not recording a route, so it
doesn't know how to correctly route the response, or am I just missing
something obvious?


Simon Quigley, Systems Engineer
Versature Corp.  |  877-498-3772 x128

Follow us on Twitter - http://twitter.com/Versature
Check out the Versature Blog - http://inside.versature.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20131025/792b1bb1/attachment.htm>

More information about the Users mailing list