[asterisk-users] Problem connecting to 4569/UDP

Danny Nicholas danny at debsinc.com
Fri Jan 6 10:16:17 CST 2012


I "found" this on another post and "cleaned it up" - might help
#!/usr/local/bin/perl
use strict;
use IO::Socket;

my $target = shift; #"192.168.0.255";
my $target_port = 4569;

socket(PING, PF_INET, SOCK_DGRAM, getprotobyname("udp"));

#   Build Packet ...
#   Names from ethereal filter of registration packet


my $src_call = "8000"; #8000 most siginificant bit is IAX packet type full
... r
equired for a poke etc...
my $dst_call = "0000";
my $timestamp = "00000000";
my $outbound_seq = "00";
my $inbound_seq = "00";
my $type = "06"; #IAX_Control
my $iax_type = "1e"; #POKE
my $msg = pack "H24", $src_call . $dst_call . $timestamp . $outbound_seq .
$inbo
und_seq . $type . $iax_type;

#   Send UDP packet


my $ipaddr = inet_aton($target);
my $sendto = sockaddr_in($target_port,$ipaddr);

send(PING, $msg, 0, $sendto) == length($msg) or die "cannot send to $target
: $t
arget_port : $!\n";

#   Listen for responses... listen for TIMEOUT seconds and report all
responders
(works for broadcast pings)


my $MAXLEN = 1024;
my $TIMEOUT = 5;

eval {
   local $SIG{ALRM} = sub { die "alarm time out"; };
   alarm $TIMEOUT;
   while (1) {
      my $recvfrom = recv(PING, $msg, $MAXLEN, 0) or die "recv: $!";
      my ($port, $ipaddr) = sockaddr_in($recvfrom);
      my $respaddr = inet_ntoa($ipaddr);
      print "Response from $respaddr : $port\n";
      exit;
      }
   };
print "timed out $target\n";

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of kazabe
Sent: Friday, January 06, 2012 10:12 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Problem connecting to 4569/UDP

El día 6 de enero de 2012 06:00, Roland <asterisk at rolandow.com> escribió:
> iptables -L -n | grep icmp gives you the same on both machines?

Yes.

ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0

>
> Is it possible that the other public IP is behind a "main" firewall,

the ISP say to dont have any firewall.  And the port is displayed opened.

PORT     STATE SERVICE VERSION
4569/udp open  iax2

What another test can i do to obtain any clue about the connection problem?

thanks in advance

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to
Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list