r7542 - in /trunk/libnet-sip-perl: Changes META.yml THANKS debian/changelog lib/Net/SIP.pm lib/Net/SIP/Endpoint.pm lib/Net/SIP/Endpoint.pod lib/Net/SIP/Endpoint/Context.pm lib/Net/SIP/Endpoint/Context.pod lib/Net/SIP/StatelessProxy.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Thu Sep 13 14:02:19 UTC 2007


Author: dmn
Date: Thu Sep 13 14:02:19 2007
New Revision: 7542

URL: http://svn.debian.org/wsvn/?sc=1&rev=7542
Log:
* New upstream release
  + fix rt#29153 in StatelessProxy.pm ($1 from prev regex
    used after call of user function, which could change it)
  + Endpoint::new_response - make sure that 2xx responses to
    INVITE carry a contact header

Modified:
    trunk/libnet-sip-perl/Changes
    trunk/libnet-sip-perl/META.yml
    trunk/libnet-sip-perl/THANKS
    trunk/libnet-sip-perl/debian/changelog
    trunk/libnet-sip-perl/lib/Net/SIP.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod
    trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod
    trunk/libnet-sip-perl/lib/Net/SIP/StatelessProxy.pm

Modified: trunk/libnet-sip-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/Changes?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/Changes (original)
+++ trunk/libnet-sip-perl/Changes Thu Sep 13 14:02:19 2007
@@ -1,4 +1,10 @@
 Revision history for Net::SIP
+
+0.33
+  - fix rt#29153 in StatelessProxy.pm ($1 from prev regex
+    used after call of user function, which could change it)
+  - Endpoint::new_response - make sure that 2xx responses to
+    INVITE carry a contact header
 
 0.32
   - Net::SIP::Registrar checks on non-REGISTER requests if the

Modified: trunk/libnet-sip-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/META.yml?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/META.yml (original)
+++ trunk/libnet-sip-perl/META.yml Thu Sep 13 14:02:19 2007
@@ -1,7 +1,7 @@
 # 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.32
+version:      0.33
 version_from: lib/Net/SIP.pm
 installdirs:  site
 requires:

Modified: trunk/libnet-sip-perl/THANKS
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/THANKS?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/THANKS (original)
+++ trunk/libnet-sip-perl/THANKS Thu Sep 13 14:02:19 2007
@@ -1,6 +1,8 @@
 Thanks to GeNUA mbh www.genua.de to let me work on this code and release
 it to the public.
 
-Thanks for bugreports from:
+Thanks for bugreports and fixes from:
 <mtve1927[AT]gmail[DOT]com>
+cpan:POLETTIX
+<karme[AT]berlios[DOT]de>
 

Modified: trunk/libnet-sip-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/debian/changelog?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/debian/changelog (original)
+++ trunk/libnet-sip-perl/debian/changelog Thu Sep 13 14:02:19 2007
@@ -1,3 +1,13 @@
+libnet-sip-perl (0.33-1) UNRELEASED; urgency=low
+
+  * New upstream release
+    + fix rt#29153 in StatelessProxy.pm ($1 from prev regex
+      used after call of user function, which could change it)
+    + Endpoint::new_response - make sure that 2xx responses to
+      INVITE carry a contact header
+
+ -- Damyan Ivanov <dmn at debian.org>  Thu, 13 Sep 2007 17:01:51 +0300
+
 libnet-sip-perl (0.32-1) unstable; urgency=low
 
   [ Rene Mayorga ]

Modified: trunk/libnet-sip-perl/lib/Net/SIP.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP.pm?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP.pm Thu Sep 13 14:02:19 2007
@@ -4,7 +4,7 @@
 require 5.008;
 
 package Net::SIP;
-our $VERSION = '0.32';
+our $VERSION = '0.33';
 
 # this includes nearly everything else
 use Net::SIP::Simple ();

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm Thu Sep 13 14:02:19 2007
@@ -326,6 +326,13 @@
 	my ($ctx,$response,$leg,$addr) = @_;
 
 	$self->{ctx}{ $ctx->callid } = $ctx if $ctx; # keep context
+	if ( $ctx && ! $response->get_header( 'contact' ) && $response->method eq 'INVITE' ) {
+		my $code = $response->code;
+		if ( $code>=200 && $code<300 ) {
+			# 2xx response requires contact header
+			$response->set_header( contact => $ctx->contact );
+		}
+	}
 	$self->{dispatcher}->deliver( $response,
 		leg      => $leg,
 		dst_addr => $addr,

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod Thu Sep 13 14:02:19 2007
@@ -226,4 +226,7 @@
 
 CTX is the context from the call, where the associated request came in.
 
-=back
+If the response is a 2xx response to a INVITE and no C<contact> header 
+is given as required from the RFC it will add one based on the CTX.
+
+=back

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm Thu Sep 13 14:02:19 2007
@@ -96,6 +96,24 @@
 sub callid {
 	my Net::SIP::Endpoint::Context $self = shift;
 	return $self->{callid};
+}
+
+############################################################################
+# gets contact, either from contact info on context (only for outgoing)
+# or from 'from'/'to'
+# Args: $self
+# Returns: $contact
+############################################################################
+sub contact {
+	my Net::SIP::Endpoint::Context $self = shift;
+	if ( $self->{incoming} ) {
+		my ($data) = sip_hdrval2parts( to => $self->{to} );
+		return $data;
+	} else {
+		return $self->{contact} if $self->{contact};
+		my ($data) = sip_hdrval2parts( from => $self->{from} );
+		return $data;
+	}
 }
 
 ############################################################################

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod Thu Sep 13 14:02:19 2007
@@ -87,6 +87,12 @@
 =item callid
 
 Returns callid of current call.
+
+=item contact
+
+Returns contact of current call.
+For outgoing calls this is the C<contact> given in the constructor or
+if not given C<from>. For incoming calls this is C<to>.
 
 =item peer
 

Modified: trunk/libnet-sip-perl/lib/Net/SIP/StatelessProxy.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/StatelessProxy.pm?rev=7542&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/StatelessProxy.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/StatelessProxy.pm Thu Sep 13 14:02:19 2007
@@ -122,9 +122,9 @@
 
 		my ($to) = sip_hdrval2parts( uri => $packet->uri );
 		$to = $1 if $to =~m{<(\w+:\S+)>};
-		if ( $to =~m{^(.*?)(\w+)(\@.*)}
-			&& ( my $back = invoke_callback( $rewrite_contact,$2 ) )) {
-			$to = $1.$back;
+		my ($pre,$name) = $to =~m{^(.*?)(\w+)\@};
+		if ( $name && ( my $back = invoke_callback( $rewrite_contact,$name ) )) {
+			$to = $pre.$back;
 			DEBUG( 10,"rewrote URI from '%s' to '%s'", $packet->uri, $to );
 			$packet->set_uri( $to )
 		}




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