I have two SIP servers, A and B, connected each other though a OPENVPN tunnel. The server B needs to t_relay() every SIP message containing the method MESSAGE to the server A but these messages never reach destination.

I have tested the tunnel connectivity and works fine. I wrote a Perl script  (located in B) that sends SIP MESSAGES to Kamailio (located in A) trying to figure out what is happening but these messages are received by A and processed correctly but when B does the same from Kamailio, it is never received.

Here is the route part of kamailio.cfg in B:

Observation: ($rU == "1004") result is true

            if($rU == "1004") 
                        xlog("L_INFO","En 1004");


                        if (!t_relay())
                                xlog("L_INFO","MIO Error en t_relay");
                        t_reply("200", "Ok");
                        xlog("L_INFO","MIO despues rewrite");

The perl script that WORKS:

$msg = 'MESSAGE sip:1004@ SIP/2.0
Via: SIP/2.0/UDP
From: "2002" <sip:2002@>;tag=1837944796
To: <sip:1004@>
Call-ID: 19722852989@
CSeq: 15773 MESSAGE
Contact: <sip:2002@
Max-Forwards: 29
User-Agent: DBL
Content-Type: text/plain
Content-Length:    34

hello from kamailio

use IO::Socket;

my $sock = IO::Socket::INET->new( Proto=>'udp',

print "Sending msg $msg\n";

$sock->send($msg) or die "error sending $!\n";

Please help!

Thanks in advance.