The IP: 192.168.2.102 corresponds to address in LAN A, 10.8.0.1 is the VPN address of the same machine in the A network. Switching from one to another still results in Perl script working and Kamailio not working.

On Thu, Aug 5, 2010 at 7:48 PM, Carlos Ruiz Diaz <carlos.ruizdiaz@gmail.com> wrote:
Hi,

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(is_method("MESSAGE"))
 {        
            if($rU == "1004") 
             {
                        xlog("L_INFO","En 1004");

                        rewritehost("10.8.0.1");

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


The perl script that WORKS:

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

+595981[protected]
hello from kamailio
';

use IO::Socket;

my $sock = IO::Socket::INET->new( Proto=>'udp',
                                  PeerHost=>'192.168.2.102',
                                  PeerPort=>'5060');

print "Sending msg $msg\n";

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

Please help!

Thanks in advance.

Carlos.