#!/usr/bin/perl use IO::Socket::INET; use Net::SIP::Leg; use Net::SIP::Simple; use Net::SIP::Simple::Call; use Net::SIP::Simple::RTP; use Net::SIP::Debug qw( Net::SIP*=2 Registrar=1 ); Net::SIP::Debug->level(2); $| = 1; my $ip_me = 'xxx.xxx.xx.xx'; #server executing the code my $ip_pbx = 'yyy.yyy.yy.yy'; #asterisk my $ip_to = 'zzz.zzz.zz.zzz'; #phone where I'm calling to # create new socket and leg print 'CREATING SOCKET AND LEG... '; my $sock_tel_1 = IO::Socket::INET->new(LocalAddr => $ip_me, PeerAddr = +> $ip_pbx, PeerPort => '5060', Proto => 'udp') or die "Can't bind : $ +@\n"; my $leg_tel_1 = Net::SIP::Leg->new( sock => $sock_tel_1); print 'OK'.$/; # create new rtp print 'CREATING RTP... '; my $echo_10 = Net::SIP::Simple->rtp( 'media_recv_echo', 'output.pcmu-8 +000' ); print 'OK'.$/; # create new agent print 'CREATING AGENT... '; my $ua = Net::SIP::Simple->new( registrar => $ip_pbx, #domain => 'netpro.cl', domain => $ip_pbx, from => 'devel', leg => $leg_tel_1, auth => ['user','password'] #user and password provided in the ast +erisk server ); print $ua->error.' '; print 'OK'.$/; # Register agent my $err = ''; print 'TRY TO REGISTER... '.$/; $ua->register(); $err = $ua->error; if ($err ne ''){ print $err.$/; } print 'OK'.$/; # Invite other party, send anncouncement once connected print 'SEND INVITE... '.$/; $ua->invite( $ip_to, init_media => $echo_10); $err = $ua->error; if ($err ne ''){ print $err.$/; } print 'OK'.$/; $ua->loop;
CREATING SOCKET AND LEG... OK CREATING RTP... OK CREATING AGENT... OK TRY TO REGISTER... 1285608699.1157 DEBUG:<2> Net::SIP::Leg::deliver[330]: delivery from x +xx.xxx.xx.xx:43289 to udp:yyy.yyy.yy.yy:5060 OK: 1285608699.1157 DEBUG:<2> REQ REGISTER sip:yyy.yyy.yy.yy 1285608699.1178 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608699.1178 DEBUG:<2> RESP 100 'Trying' 1285608699.1202 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608699.1202 DEBUG:<2> RESP 401 'Unauthorized' 1285608699.1228 DEBUG:<2> Net::SIP::Leg::deliver[330]: delivery from x +xx.xxx.xx.xx:43289 to udp:yyy.yyy.yy.yy:5060 OK: 1285608699.1228 DEBUG:<2> REQ REGISTER sip:yyy.yyy.yy.yy 1285608699.1247 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608699.1247 DEBUG:<2> RESP 100 'Trying' 1285608699.1281 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608699.1281 DEBUG:<2> REQ OPTIONS sip:user@xxx.xxx.xx.xx:43 +289 1285608699.1310 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608699.1310 DEBUG:<2> RESP 200 'OK' OK SEND INVITE... 1285608699.1355 DEBUG:<2> Net::SIP::Leg::deliver[330]: delivery from x +xx.xxx.xx.xx:43289 to udp:yyy.yyy.yy.yy:5060 OK: 1285608699.1355 DEBUG:<2> REQ INVITE sip:zzz.zzz.zz.zzz@yyy.yyy +.yy.yy with body 1285608699.1377 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608699.1377 DEBUG:<2> RESP 407 'Proxy Authentication Require +d' 1285608699.1397 DEBUG:<2> Net::SIP::Leg::deliver[330]: delivery from x +xx.xxx.xx.xx:43289 to yyy.yyy.yy.yy:5060 OK: 1285608699.1397 DEBUG:<2> REQ ACK sip:zzz.zzz.zz.zzz@yyy.yyy.yy +.yy 1285608699.1423 DEBUG:<2> Net::SIP::Leg::deliver[330]: delivery from x +xx.xxx.xx.xx:43289 to udp:yyy.yyy.yy.yy:5060 OK: 1285608699.1423 DEBUG:<2> REQ INVITE sip:zzz.zzz.zz.zzz@yyy.yyy +.yy.yy with body 1285608699.1446 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608699.1446 DEBUG:<2> RESP 488 'Not acceptable here' 1285608699.1466 DEBUG:<2> Net::SIP::Leg::deliver[330]: delivery from x +xx.xxx.xx.xx:43289 to yyy.yyy.yy.yy:5060 OK: 1285608699.1466 DEBUG:<2> REQ ACK sip:zzz.zzz.zz.zzz@yyy.yyy.yy +.yy OK 1285608700.1278 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608700.1278 DEBUG:<2> REQ OPTIONS sip:user@xxx.xxx.xx.xx:43 +289 1285608701.1286 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608701.1286 DEBUG:<2> REQ OPTIONS sip:user@xxx.xxx.xx.xx:43 +289 1285608702.1284 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608702.1284 DEBUG:<2> REQ OPTIONS sip:user@xxx.xxx.xx.xx:43 +289 1285608703.1282 DEBUG:<2> Net::SIP::Leg::receive[421]: received on xxx +.xxx.xx.xx:43289 from yyy.yyy.yy.yy:5060 packet 1285608703.1282 DEBUG:<2> REQ OPTIONS sip:user@xxx.xxx.xx.xx:43 +289
In reply to Getting error '488' using Net::SIP::Simple by Skaraluk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |