r17705 - in /branches/upstream/libnet-sip-perl/current: Changes META.yml lib/Net/SIP.pm lib/Net/SIP/Endpoint.pm lib/Net/SIP/Leg.pm lib/Net/SIP/Packet.pm lib/Net/SIP/Simple/Call.pm t/05_call_with_stateless_proxy.t t/09_fdleak.t t/10_fdleak.t

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Mon Mar 17 02:34:01 UTC 2008


Author: tincho-guest
Date: Mon Mar 17 02:34:00 2008
New Revision: 17705

URL: http://svn.debian.org/wsvn/?sc=1&rev=17705
Log:
[svn-upgrade] Integrating new upstream version, libnet-sip-perl (0.44_1)

Modified:
    branches/upstream/libnet-sip-perl/current/Changes
    branches/upstream/libnet-sip-perl/current/META.yml
    branches/upstream/libnet-sip-perl/current/lib/Net/SIP.pm
    branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Endpoint.pm
    branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Leg.pm
    branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Packet.pm
    branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple/Call.pm
    branches/upstream/libnet-sip-perl/current/t/05_call_with_stateless_proxy.t
    branches/upstream/libnet-sip-perl/current/t/09_fdleak.t
    branches/upstream/libnet-sip-perl/current/t/10_fdleak.t

Modified: branches/upstream/libnet-sip-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/Changes?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/Changes (original)
+++ branches/upstream/libnet-sip-perl/current/Changes Mon Mar 17 02:34:00 2008
@@ -1,4 +1,27 @@
 Revision history for Net::SIP
+
+0.44_1
+   - Net::SIP::Packet::sdp_body - content type is case insensitive,
+     accept application/SDP etc
+
+0.44
+   - Net::SIP::Packet::get_header: if called in scalar to get the only
+     one value and we have multiple values try if they are all the same
+     and in this case return the uniq value instead of croaking
+     Works around bug in proxy which issued two content-length headers
+     with the same length as reported in
+     http://rt.cpan.org/Ticket/Display.html?id=33592
+   - fix test skip in t/*fdleak.t 
+
+0.43
+   - enforce codec 0 PCMU/8000 in outgoing SDP generated based on
+     incoming SDP, don't just accept all codecs the other party offers
+     because Net::SIP::Simple can only PCMU/8000
+   - make header names per default ucfirst (Via not via)
+   - add default allow and supported headers to INVITE requests and
+     2xx responses if none where given
+   - fix bug indroduced in 0.42, where contact from incoming INVITE
+     was not used as URI for outgoing BYE for the call
 
 0.42
    - on 2xx responses set the URI of the dialog to the contact given

Modified: branches/upstream/libnet-sip-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/META.yml?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/META.yml (original)
+++ branches/upstream/libnet-sip-perl/current/META.yml Mon Mar 17 02:34:00 2008
@@ -1,11 +1,11 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Net-SIP
-version:      0.42
+version:      0.44_1
 version_from: lib/Net/SIP.pm
 installdirs:  site
 requires:
     Net::DNS:                      0.56
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+generated_by: ExtUtils::MakeMaker version 6.17

Modified: branches/upstream/libnet-sip-perl/current/lib/Net/SIP.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/lib/Net/SIP.pm?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP.pm (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP.pm Mon Mar 17 02:34:00 2008
@@ -4,7 +4,7 @@
 require 5.008;
 
 package Net::SIP;
-our $VERSION = '0.42';
+our $VERSION = '0.44_1';
 
 # this includes nearly everything else
 use Net::SIP::Simple ();

Modified: branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Endpoint.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Endpoint.pm?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Endpoint.pm (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Endpoint.pm Mon Mar 17 02:34:00 2008
@@ -296,6 +296,7 @@
 			incoming => 1,
 			from => scalar( $request->get_header( 'from' )),
 			to   => scalar( $request->get_header( 'to' )),
+			contact => scalar( $request->get_header( 'contact' )),
 			callid => scalar( $request->get_header( 'call-id' )),
 			via  => [ $request->get_header( 'via' ) ],
 		);

Modified: branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Leg.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Leg.pm?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Leg.pm (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Leg.pm Mon Mar 17 02:34:00 2008
@@ -277,19 +277,32 @@
 		$packet->insert_header( via => $via );
 	}
 
-	# 2xx responses and INVITE requests need contact header
-	if (( $packet->method eq 'INVITE' and $isrq or !$isrq and $packet->code =~m{^2} ) 
-		and ! $packet->get_header( 'contact' )) {
-		# needs contact header, create from this leg and user part of from/to
-		my ($user) = sip_hdrval2parts( $isrq 
-			? ( from => scalar($packet->get_header('from')) )
-			: ( to   => scalar($packet->get_header('to')) )
-		);
-		my $contact = ( $user =~m{([^<>\@\s]+)\@} ? $1 : $user ). 
-			"\@$self->{addr}:$self->{port}";
-		$contact = 'sip:'.$contact if $contact  !~m{^\w+:};
-		$packet->insert_header( contact => $contact );
-	}
+	# 2xx responses and INVITE requests must have a contact header
+	# They should have an Allow header too und Supported would be good to
+	if ( $isrq and $packet->method eq 'INVITE' or !$isrq and $packet->code =~m{^2} ) {
+		if ( ! $packet->get_header( 'contact' )) {
+			# needs contact header, create from this leg and user part of from/to
+			my ($user) = sip_hdrval2parts( $isrq 
+				? ( from => scalar($packet->get_header('from')) )
+				: ( to   => scalar($packet->get_header('to')) )
+			);
+			my $contact = ( $user =~m{([^<>\@\s]+)\@} ? $1 : $user ). 
+				"\@$self->{addr}:$self->{port}";
+			$contact = 'sip:'.$contact if $contact  !~m{^\w+:};
+			$packet->insert_header( contact => $contact );
+		}
+		# allow and supported can be multiple so enforce array context
+		unless ( my @a =  $packet->get_header( 'allow' )) {
+			# add the default set
+			$packet->insert_header( allow => 'INVITE, ACK, OPTIONS, CANCEL, BYE' );
+		}
+		unless ( my @a = $packet->get_header( 'supported' )) {
+			# set as empty
+			$packet->insert_header( supported => '' );
+		}
+	}
+
+
 
 	my ($proto,$host,$port) =
 		$addr =~m{^(?:(\w+):)?([\w\-\.]+)(?::(\d+))?$};

Modified: branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Packet.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Packet.pm?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Packet.pm (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Packet.pm Mon Mar 17 02:34:00 2008
@@ -215,7 +215,14 @@
 			push @v,$h->{value} if $h->{key} eq $key;
 		}
 		return @v if wantarray;
-		croak( "multiple values for $key" ) if @v>1;
+		if (@v>1) {
+			# looks like we have multiple headers but expect only
+			# one. Because we've seen bad client which issue multiple
+			# content-length header we try if all in @v are the same
+			my %v = map { $_ => 1 } @v;
+			return $v[0] if keys(%v) == 1; # ok, only one
+			croak( "multiple values for $key" );
+		}
 		return $v[0];
 	} else {
 		my %result;
@@ -430,7 +437,7 @@
 
 		my $v = $header->[$hi]{value};
 		$v =~s{\r?\n\s*}{\r\n }g; # \r?\n\s* -> \r\n + space for continuation lines
-		$result[$hi] = $header->[$hi]{key}.": ".$v;
+		$result[$hi] = ucfirst($header->[$hi]{key}).": ".$v;
 	}
 
 	# (re)build packet
@@ -633,7 +640,7 @@
 sub sdp_body {
 	my Net::SIP::Packet $self = shift;
 	my $ct = $self->get_header( 'content-type' );
-	return if $ct && $ct ne 'application/sdp';
+	return if $ct && lc($ct) ne 'application/sdp';
 	my $body = ($self->as_parts)[3] || return;
 	return Net::SIP::SDP->new( $body );
 }

Modified: branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple/Call.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple/Call.pm?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple/Call.pm (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple/Call.pm Mon Mar 17 02:34:00 2008
@@ -432,6 +432,10 @@
 					$self->error( "only RTP/AVP supported" );
 					return;
 				}
+				if ( $m->{media} eq 'audio' ) {
+					# enforce PCMU/8000 for now
+					$m = { %$m, fmt => '0' }
+				}
 				push @media, {
 					media => $m->{media},
 					proto => $m->{proto},

Modified: branches/upstream/libnet-sip-perl/current/t/05_call_with_stateless_proxy.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/t/05_call_with_stateless_proxy.t?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/t/05_call_with_stateless_proxy.t (original)
+++ branches/upstream/libnet-sip-perl/current/t/05_call_with_stateless_proxy.t Mon Mar 17 02:34:00 2008
@@ -96,8 +96,8 @@
 	# top via must be from lproxy[1], next via from UAC
 	# this is to show that the request went through the proxy
 	fd_grep_ok( 'call created',10,$uas );
-	fd_grep_ok( "via: SIP/2.0/UDP $lproxy[1]{addr};",1,$uas );
-	fd_grep_ok( "via: SIP/2.0/UDP $luac->{addr};",1,$uas );
+	fd_grep_ok( qr{\Qvia: SIP/2.0/UDP $lproxy[1]{addr};}i,1,$uas );
+	fd_grep_ok( qr{\Qvia: SIP/2.0/UDP $luac->{addr};}i,1,$uas );
 
 	# done
 	fd_grep_ok( 'RTP done',10,$uac );

Modified: branches/upstream/libnet-sip-perl/current/t/09_fdleak.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/t/09_fdleak.t?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/t/09_fdleak.t (original)
+++ branches/upstream/libnet-sip-perl/current/t/09_fdleak.t Mon Mar 17 02:34:00 2008
@@ -13,8 +13,8 @@
 my ($ssock,$saddr) = create_socket();
 my $tfn = fileno( newfd() );
 if ( fileno($ssock) != $tfn-1 ) {
-	warn "Platform does not give fds in order fn,fn+1,fn+2...\n";
-	print "1..0\n";
+	print "1..0 # Platform does not give fds in order fn,fn+1,fn+2...\n";
+	exit;
 } else {
 	print "1..7\n";
 }

Modified: branches/upstream/libnet-sip-perl/current/t/10_fdleak.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/t/10_fdleak.t?rev=17705&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/t/10_fdleak.t (original)
+++ branches/upstream/libnet-sip-perl/current/t/10_fdleak.t Mon Mar 17 02:34:00 2008
@@ -13,8 +13,8 @@
 my ($ssock,$saddr) = create_socket();
 my $tfn = fileno( newfd() );
 if ( fileno($ssock) != $tfn-1 ) {
-	warn "Platform does not give fds in order fn,fn+1,fn+2...\n";
-	print "1..0\n";
+	print "1..0 # Platform does not give fds in order fn,fn+1,fn+2...\n";
+	exit;
 } else {
 	print "1..10\n";
 }




More information about the Pkg-perl-cvs-commits mailing list