r15170 - in /trunk/libnet-sip-perl: Changes META.yml THANKS debian/changelog lib/Net/SIP.pm lib/Net/SIP/Endpoint.pm lib/Net/SIP/Endpoint/Context.pm lib/Net/SIP/Endpoint/Context.pod lib/Net/SIP/Leg.pm lib/Net/SIP/Simple.pm
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Tue Feb 19 16:14:28 UTC 2008
Author: gregoa-guest
Date: Tue Feb 19 16:14:27 2008
New Revision: 15170
URL: http://svn.debian.org/wsvn/?sc=1&rev=15170
Log:
New upstream release.
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/Context.pm
trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod
trunk/libnet-sip-perl/lib/Net/SIP/Leg.pm
trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm
Modified: trunk/libnet-sip-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/Changes?rev=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/Changes (original)
+++ trunk/libnet-sip-perl/Changes Tue Feb 19 16:14:27 2008
@@ -1,4 +1,16 @@
Revision history for Net::SIP
+
+0.42
+ - on 2xx responses set the URI of the dialog to the contact given
+ in the response. For 302 retry the request with the URI set to
+ the contact given in the 302 response.
+ - make sure that the right contact header is set. for outgoing
+ invites and 2xx responses to invite combine the user part from the
+ sender ('from' for requests, 'to' for responses) with addr and port
+ from the outgoing leg - unless the contact was explicitly set.
+ - if a contact header was given in Net::SIP::Simple which had a
+ port specification the port would be duplicated, e.g.
+ user at ip:port:port
0.41
- give 'contact' header to Net::SIP::Simple which is then used for
Modified: trunk/libnet-sip-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/META.yml?rev=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/META.yml (original)
+++ trunk/libnet-sip-perl/META.yml Tue Feb 19 16:14:27 2008
@@ -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.41
+version: 0.42
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=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/THANKS (original)
+++ trunk/libnet-sip-perl/THANKS Tue Feb 19 16:14:27 2008
@@ -8,3 +8,5 @@
<t-cpan.org[AT]tobias[DOT]org>
<franz[AT]rzk[DOT]com>
otherwiseguy <tlwilsonii [...] yahoo.com>
+<fiorellino[AT]gmail[DOT]com>
+<andrew[DOT]pogrebennyk[AT]portaone[DOT]com>
Modified: trunk/libnet-sip-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/debian/changelog?rev=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/debian/changelog (original)
+++ trunk/libnet-sip-perl/debian/changelog Tue Feb 19 16:14:27 2008
@@ -1,3 +1,9 @@
+libnet-sip-perl (0.42-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at> Tue, 19 Feb 2008 17:13:15 +0100
+
libnet-sip-perl (0.41-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=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP.pm Tue Feb 19 16:14:27 2008
@@ -4,7 +4,7 @@
require 5.008;
package Net::SIP;
-our $VERSION = '0.41';
+our $VERSION = '0.42';
# 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=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm Tue Feb 19 16:14:27 2008
@@ -149,7 +149,6 @@
die "cannot redefine call-id" if delete $args{ 'call-id' };
my ($leg,$dst_addr) = delete @args{qw(leg dst_addr)};
-
if ( ! UNIVERSAL::isa( $ctx,'Net::SIP::Endpoint::Context' )) {
$ctx = Net::SIP::Endpoint::Context->new($ctx);
$self->{ctx}{ $ctx->callid } = $ctx; # make sure we manage the context
@@ -293,12 +292,10 @@
}
# create a new context;
- my $contact = $request->get_header( 'contact' );
$ctx = Net::SIP::Endpoint::Context->new(
incoming => 1,
from => scalar( $request->get_header( 'from' )),
to => scalar( $request->get_header( 'to' )),
- $contact ? ( contact => $contact ) : (),
callid => scalar( $request->get_header( 'call-id' )),
via => [ $request->get_header( 'via' ) ],
);
@@ -331,13 +328,6 @@
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/Context.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm?rev=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm Tue Feb 19 16:14:27 2008
@@ -99,24 +99,6 @@
}
############################################################################
-# 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;
- }
-}
-
-############################################################################
# get peer
# Args: $self
# Returns: $peer
@@ -142,7 +124,6 @@
sub new_request {
my Net::SIP::Endpoint::Context $self = shift;
my ($method,$body,%args) = @_;
-
my $request;
if ( ref($method)) {
@@ -170,7 +151,7 @@
}
# contact is mandatory for INVITE
- $contact = $from if $method eq 'INVITE' and ! defined $contact;
+ # will be added within Leg
$request = Net::SIP::Request->new(
$method, # Method
@@ -178,7 +159,7 @@
{
from => $from,
to => $to,
- contact => $contact,
+ $contact ? ( contact => $contact ):(),
route => $self->{route},
cseq => "$cseq $method",
'call-id' => $self->{callid},
@@ -352,7 +333,14 @@
if ( $method eq 'INVITE' ) {
# is response to INVITE, create ACK
# and propagate to upper layer
- my $ack = $tr->{request}->create_ack( $response );
+ my $req = $tr->{request};
+ if ( my $contact = $response->get_header( 'contact' )) {
+ # 12.1.2 - set URI for dialog to contact given in response which
+ # establishes the dialog
+ $contact = $1 if $contact =~m{<(\w+:[^>\s]+)>};
+ $req->set_uri( $contact );
+ }
+ my $ack = $req->create_ack( $response );
invoke_callback($cb, at arg,0,$code,$response,$leg,$from,$ack);
$endpoint->new_request( $ack,$self,undef,undef,leg => $leg, dst_addr => $from );
@@ -394,7 +382,8 @@
# 21.3.3 302 moved temporarily
# redo request and insert request again
my $contact = $self->{to} = $response->get_header( 'contact' );
- ( my $r = $tr->{request} )->set_header( to => $contact );
+ $contact = $1 if $contact =~m{<(\w+:[^>\s]+)>};
+ ( my $r = $tr->{request} )->set_uri( $contact );
$r->set_cseq( ++$self->{cseq} );
$endpoint->new_request( $r,$self );
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=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod Tue Feb 19 16:14:27 2008
@@ -43,7 +43,7 @@
=item contact
-Contact info for B<from>.
+Contact info for context.
=item incoming
@@ -87,12 +87,6 @@
=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/Leg.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Leg.pm?rev=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Leg.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Leg.pm Tue Feb 19 16:14:27 2008
@@ -263,7 +263,8 @@
my Net::SIP::Leg $self = shift;
my ($packet,$addr,$callback) = @_;
- if ( $packet->is_request ) {
+ my $isrq = $packet->is_request;
+ if ( $isrq ) {
# add via,
# clone packet, because I don't want to change the original
# one because it might be retried later
@@ -274,6 +275,20 @@
my $via = $self->{via};
$via .= md5_hex( $packet->tid );
$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 );
}
my ($proto,$host,$port) =
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm?rev=15170&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm Tue Feb 19 16:14:27 2008
@@ -301,7 +301,7 @@
|| croak( "unknown from" );
my $contact = delete $args{contact} || $self->{contact} || $from;
my $local = $leg->{addr}.':'.$leg->{port};
- $contact.= '@'.$local unless $contact =~s{\@([\w\-\.]+)}{\@$local};
+ $contact.= '@'.$local unless $contact =~s{\@([\w\-\.:]+)}{\@$local};
my %rarg = (
from => $from,
More information about the Pkg-perl-cvs-commits
mailing list