Commit 28027afc authored by gregor herrmann's avatar gregor herrmann

Update upstream source from tag 'upstream/0.815'

Update to upstream version '0.815'
with Debian dir e6a95caa225c97a72e8df1fefaa283b9f01caebc
parents d1e7624a 511b3cbf
Revision history for Net::SIP
0.815 2018-06-15
- StatelessProxy: make sure that idfrom/idto in NAT helper are based on
normalized URL, so that different writing (with comment, with <..>..) do
not affect the value. This is needed if peers use a different syntax for
the same URI during the dialog.
- use range of 2 for all RTP/ types, not only for RTP/AVP (i.e. also for
RTP/SAVP, RTP/AVPF..)
- fix/enhance documentation
https://rt.cpan.org/Ticket/Display.html?id=125142
https://rt.cpan.org/Ticket/Display.html?id=125054
0.814 2018-02-24
- fix t/20_channel_on_hold.t of IPv6 or TLS are not supported (wrong number
of skipped tests).
......
......@@ -49,5 +49,5 @@
"url" : "https://github.com/noxxi/p5-net-sip"
}
},
"version" : "0.814"
"version" : "0.815"
}
......@@ -24,4 +24,4 @@ resources:
homepage: https://github.com/noxxi/p5-net-sip
license: http://dev.perl.org/licenses/
repository: https://github.com/noxxi/p5-net-sip
version: '0.814'
version: '0.815'
......@@ -3,7 +3,7 @@ use warnings;
use 5.010;
package Net::SIP;
our $VERSION = '0.814';
our $VERSION = '0.815';
# this includes nearly everything else
use Net::SIP::Simple ();
......
......@@ -117,7 +117,7 @@ sub new_from_parts {
|| die "no $_ in media description";
}
$m_self{range} = delete($m{range})
|| ( $m_self{proto} eq 'RTP/AVP' ? 2:1 );
|| ( $m_self{proto} =~m{^RTP/} ? 2:1 );
defined( my $fmt = $m_self{fmt} = delete $m{fmt} )
|| die "no fmt in media description";
my $mline = _join_m( @m_self{qw(media port range proto)},$fmt );
......@@ -490,14 +490,14 @@ sub _split_m {
$mline =~m{^(\w+)\s+(\d+)(?:/(\d+))?\s+(\S+)((?:\s+\S+)+)}
or die "bad [m]edia: '$mline'";
$range ||= 1;
$range *=2 if $proto eq 'RTP/AVP'; # RTP+RTCP
$range *=2 if $proto =~m{^RTP/}; # RTP+RTCP
return ($media,$port,$range,$proto, [ split( ' ',$fmt) ]);
}
sub _join_m {
my ($media,$port,$range,$proto,@fmt) = @_;
@fmt = @{$fmt[0]} if @fmt == 1 && ref($fmt[0]);
$range /= 2 if $proto eq 'RTP/AVP';
$range /= 2 if $proto =~m{^RTP/};
$port .= "/$range" if $range>1;
return join( ' ',$media,$port,$proto,@fmt );
}
......
......@@ -19,8 +19,8 @@ Net::SIP::Simple - Simple interface for using Net::SIP
# Register agent
$ua->register;
# Invite other party, send anncouncement once connected
$ua->invite( 'you',
# Invite other party, send announcement once connected
my $call = $ua->invite( 'you',
init_media => $ua->rtp( 'send_recv', 'announcement.pcmu-8000' ),
asymetric_rtp => 1,
);
......@@ -199,6 +199,9 @@ CTX can be address of peer or context hash containing the address.
Returns with the newly created L<Net::SIP::Simple::Call> object,
which can later be used for reINVITEs or BYE etc.
Note that in order to have any callbacks triggered by the invite working
one needs to keep the returned caller object.
=item listen ( %ARGS )
Sets up waiting on all legs in C<$self> for incoming calls, e.g. new INVITE
......
......@@ -659,21 +659,17 @@ sub do_nat {
# Leg, delimited by "\0"
my ($idfrom,$idto);
if ( my $from = $packet->get_header( 'from' ) ) {
my ($data,$param) = sip_hdrval2parts( from => $from );
my $tag = $param->{tag} || '';
$idfrom = "$data\0$tag";
} else {
return [ 0,'no FROM header in packet' ]
for([from => \$idfrom], [to => \$idto]) {
my ($k,$idref) = @$_;
if (my $v = $packet->get_header($k) ) {
my ($uri,$param) = sip_hdrval2parts(from => $v);
my ($dom,$user,$proto) = sip_uri2parts($uri);
$$idref = "$proto:$user\@$dom\0".($param->{tag} || '');
} else {
return [ 0,'no '.uc($k).' header in packet' ]
}
}
if ( my $to = $packet->get_header( 'to' ) ) {
my ($data,$param) = sip_hdrval2parts( from => $to );
my $tag = $param->{tag} || '';
$idto = "$data\0$tag";
} else {
return [ 0,'no TO header in packet' ]
}
# side is either 0 (request) or 1 (response)
# If a request comes in 'from' points to the incoming_leg while
......
......@@ -146,7 +146,7 @@ Example for key 'www-authenticate':
Inverse function to B<sip_hdrval2parts>, e.g constructs header value for KEY from
PREFIX and %PARAMETER and returns value.
=item sip_uri2parts(URI) -> (DOMAIN, USER, PROTO, DATA, PARAM) | DOMAIN
=item sip_uri2parts(URI) -> (DOMAIN, USER, PROTO, PARAM, DATA) | DOMAIN
Returns parts from URI. If called in scalar context it returns only the domain
part. In array context it returns an array with the following values:
......@@ -167,16 +167,16 @@ The optional user part of the SIP address.
The protocol, e.g. C<sip> or C<sips>.
If not explicitly given it will default to C<sip>.
=item DATA
The original full part before any parameter, i.e. the part containing the
domain, optional user and optional proto.
=item PARAM
A hash reference to any parameters following C<data> as returned by
B<sip_hdrval2parts>.
=item DATA
The original full part before any parameter, i.e. the part containing the
domain, optional user and optional proto.
=back
=item sip_parts2uri(DOMAIN, USER, PROTO, PARAM) -> URI
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment