Using Net::SIP::Simple I'm able to get a basic of basic example going:
my $sock_from = IO::Socket::INET->new(
Proto => 'tcp',
LocalPort => '5070',
LocalAddr => '0.0.0.0',
);
my $sock_to = IO::Socket::INET->new(
Proto => 'tcp',
PeerAddr => 'somesortofsomething',
PeerPort => '5060',
);
my $leg_from = Net::SIP::Leg->new( sock => $sock_from );
my $leg_to = Net::SIP::Leg->new( sock => $sock_to );
my $ua = Net::SIP::Simple->new(
legs => [$leg_from, $leg_to],
from => $from,
outgoing_proxy => 'something',
domain => 'something',
);
my $timeout = 5;
my $stopvar;
$ua->add_timer($timeout , \$stopvar );
my $invite = $ua->invite($to);
print Dumper($invite);
-------------------
Success! ...kind-of
-> INVITE
<- 401 Unauthorized
I see my whole INVITE conversation in the $invite Dumper.... I've spent some time poking around in the documentation but I can't make heads or tails out of actually how to interact with the sip-server on the other end or what the proper function call would be to get the response (in this case 401)
And in sngrep/tcpdump/etc I'm not seeing an ACK go out
Goal:
What I do want:
- Be able to do a very very basic query of: What was the result of my INVITE... was it a 401? Was it a 200 OK? Was it a 302 Redirect?
- And then... for instance I get a 302 Redirect... read the Contact: header that I've been redirected to.
- Wait a reasonable amount of time (say 5 seconds, and then bail completely if there was no answer)
What I don't want:
- A blocking event-loop
- Don't need to handle RTP
Thanks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.