Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: cj.fooser [...] gmail.com
Cc:
AdminCc:

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



Subject: Bug in Leg.pm, found workaround
Date: Mon, 9 Sep 2019 09:45:01 +0300
To: bug-Net-SIP [...] rt.cpan.org
From: cjayho <cj.fooser [...] gmail.com>
Hello. Found a bug in Net::Sip::Simple when using such script (see attachment), got an error when calling ./call.pl <number> <filename>: Expected 'PeerService' at /usr/share/perl5/Net/SIP/Util.pm line 40. So I found myself a workaround to fix that error: in /usr/share/perl5/Net/SIP/Leg.pm line 150 replace from this: last if $sock = INETSOCK(%sockargs, LocalPort => $port); to this last if $sock = INETSOCK(%sockargs, LocalPort => $port, PeerService => $port); Please include this fix in the future release. Thank you.

Message body is not shown because sender requested not to inline it.

Hi, Unfortunately the fix you propose is wrong since it simply sets the destination port to the source port in all cases, even overriding any destination port which was explicitly given. Please try instead this patch and let me know if this helps: diff --git a/lib/Net/SIP/Leg.pm b/lib/Net/SIP/Leg.pm index c5ec755..0fab7d5 100644 --- a/lib/Net/SIP/Leg.pm +++ b/lib/Net/SIP/Leg.pm @@ -96,7 +96,7 @@ sub new { $dst = lock_ref_keys({ host => $ip, addr => $ip, - port => $port, + port => $port || $default_port, family => $family, }); }
On Mon Sep 09 07:22:33 2019, SULLR wrote: Show quoted text
> Hi, > > Unfortunately the fix you propose is wrong since it simply sets the > destination port to the source port in all cases, even overriding any > destination port which was explicitly given. > Please try instead this patch and let me know if this helps: > > diff --git a/lib/Net/SIP/Leg.pm b/lib/Net/SIP/Leg.pm > index c5ec755..0fab7d5 100644 > --- a/lib/Net/SIP/Leg.pm > +++ b/lib/Net/SIP/Leg.pm > @@ -96,7 +96,7 @@ sub new { > $dst = lock_ref_keys({ > host => $ip, > addr => $ip, > - port => $port, > + port => $port || $default_port, > family => $family, > }); > }
got same error: Expected 'PeerService' at /usr/share/perl5/Net/SIP/Util.pm line 40.
Show quoted text
> got same error: > > Expected 'PeerService' at /usr/share/perl5/Net/SIP/Util.pm line 40.
Next try. This works for me: diff --git a/lib/Net/SIP/Leg.pm b/lib/Net/SIP/Leg.pm index c5ec755..72cf712 100644 --- a/lib/Net/SIP/Leg.pm +++ b/lib/Net/SIP/Leg.pm @@ -138,7 +138,7 @@ sub new { } elsif ($dst) { # with UDP we can create a connected socket if dst is given $sockargs{PeerAddr} = $dst->{addr}; - $sockargs{PeerPort} = $dst->{port}; + $sockargs{PeerPort} = $dst->{port} ||= $default_port; $sockpeer = $dst; }
On Mon Sep 09 07:58:43 2019, SULLR wrote: Show quoted text
>
> > got same error: > > > > Expected 'PeerService' at /usr/share/perl5/Net/SIP/Util.pm line 40.
> > Next try. This works for me: > > diff --git a/lib/Net/SIP/Leg.pm b/lib/Net/SIP/Leg.pm > index c5ec755..72cf712 100644 > --- a/lib/Net/SIP/Leg.pm > +++ b/lib/Net/SIP/Leg.pm > @@ -138,7 +138,7 @@ sub new { > } elsif ($dst) { > # with UDP we can create a connected socket if dst is given > $sockargs{PeerAddr} = $dst->{addr}; > - $sockargs{PeerPort} = $dst->{port}; > + $sockargs{PeerPort} = $dst->{port} ||= $default_port; > $sockpeer = $dst; > } >
This works for me too. Thank you :)