Skip Menu |

This queue is for tickets about the Net-SIP CPAN distribution.

Report information
The Basics
Id: 125054
Status: resolved
Priority: 0/
Queue: Net-SIP

People
Owner: Nobody in particular
Requestors: richard.carver [...] cloudmont.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net::SIP::Simple invite callbacks not working
Date: Mon, 9 Apr 2018 15:18:54 +0000
To: "bug-Net-SIP [...] rt.cpan.org" <bug-Net-SIP [...] rt.cpan.org>
From: Richard Carver <richard.carver [...] cloudmont.co.uk>
#!/usr/bin/perl -w use strict; use Net::SIP; Net::SIP::Debug->level(50); # create new agent my $ua = Net::SIP::Simple->new( outgoing_proxy => 'sip:proxy.ip.addr:5060', from => '+445000000@test.caller.local', ); # Invite other party $ua->invite( 'sip:username@domainname:5060', cb_preliminary => sub { print STDERR 'cb_prelim'; }, cb_final => sub { print STDERR 'cb_final'; }, ); # Mainloop $ua->loop; This does not call either of the two callbacks. The reason is that in Net::SIP::Simple::Call / reinvite the first argument to $cb is undef. This is presumably because $self is weakened when it sets up the callback and it then goes out of scope. If I change my script to assign the result of $ua->invite to a variable then the callbacks work. You could just update the example code in the Net::SIP::Simple documentation to say that it must be referenced for callbacks to work.
Show quoted text
> You could just update the example code in the Net::SIP::Simple > documentation to say that it must be referenced for callbacks to work.
Thanks for reporting the issue. I've updated the documentation of invite and the example in commit a4105cc.