r7589 - in /branches/upstream/libnet-sip-perl/current: Changes META.yml lib/Net/SIP.pm lib/Net/SIP/Simple.pm lib/Net/SIP/Simple.pod lib/Net/SIP/Simple/Call.pm
rmayorga-guest at users.alioth.debian.org
rmayorga-guest at users.alioth.debian.org
Sat Sep 15 05:32:52 UTC 2007
Author: rmayorga-guest
Date: Sat Sep 15 05:32:52 2007
New Revision: 7589
URL: http://svn.debian.org/wsvn/?sc=1&rev=7589
Log:
[svn-upgrade] Integrating new upstream version, libnet-sip-perl (0.34)
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/Simple.pm
branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pod
branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple/Call.pm
Modified: branches/upstream/libnet-sip-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/Changes?rev=7589&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/Changes (original)
+++ branches/upstream/libnet-sip-perl/current/Changes Sat Sep 15 05:32:52 2007
@@ -1,5 +1,10 @@
Revision history for Net::SIP
+0.34
+ - Net::SIP::Simple: handle OPTIONS requests. These are for
+ instance used by Asterisk to determine if the registered
+ party accepts incoming calls.
+
0.33
- fix rt#29153 in StatelessProxy.pm ($1 from prev regex
used after call of user function, which could change it)
Modified: branches/upstream/libnet-sip-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/META.yml?rev=7589&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/META.yml (original)
+++ branches/upstream/libnet-sip-perl/current/META.yml Sat Sep 15 05:32:52 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.33
+version: 0.34
version_from: lib/Net/SIP.pm
installdirs: site
requires:
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=7589&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP.pm (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP.pm Sat Sep 15 05:32:52 2007
@@ -4,7 +4,7 @@
require 5.008;
package Net::SIP;
-our $VERSION = '0.33';
+our $VERSION = '0.34';
# this includes nearly everything else
use Net::SIP::Simple ();
Modified: branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pm?rev=7589&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pm (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pm Sat Sep 15 05:32:52 2007
@@ -23,6 +23,7 @@
'from', # SIP address of caller
'domain', # default domain for SIP addresses
'last_error', # last error
+ 'options', # hash with field,values for response to OPTIONS request
);
use Carp qw(croak);
@@ -57,6 +58,7 @@
# registrar - use registrar for registration
# auth - auth data: see Request->authorize for format
# from - myself, used for calls and registration
+# options - hash with fields,values for reply to OPTIONS request
# loop - predefined Net::SIP::Dispatcher::Eventloop, used if
# shared between UAs
# dispatcher - predefined Net::SIP::Dispatcher, used if
@@ -86,6 +88,22 @@
if $from !~m{\s} && $from !~m{\@};
}
+ my $options = delete $args{options} || {};
+ {
+ @{$options}{ map { lc } keys(%$options) } = values(%$options); # lc keys
+ my %default_options = (
+ allow => 'INVITE, ACK, CANCEL, OPTIONS, BYE',
+ accept => 'application/sdp',
+ 'accept-encoding' => '',
+ 'accept-language' => 'en',
+ supported => '',
+ );
+ while ( my ($k,$v) = each %default_options ) {
+ $options->{$k} = $v if ! defined $options->{$k};
+ }
+ }
+
+
my $legs = delete $args{legs} || delete $args{leg};
$legs = [ $legs ] if $legs && ref($legs) ne 'ARRAY';
$legs ||= [];
@@ -148,6 +166,7 @@
dispatcher => $disp,
loop => $loop,
route => $routes,
+ options => $options,
);
return $self;
}
@@ -348,11 +367,17 @@
# handle new requests
my $receive = sub {
my ($self,$args,$endpoint,$ctx,$request,$leg,$from) = @_;
- $request->method eq 'INVITE' or do {
+ my $method = $request->method;
+ if ( $method eq 'OPTIONS' ) {
+ my $response = $request->create_response( '200','OK',$self->{options} );
+ $self->{endpoint}->new_response( $ctx,$response,$leg,$from );
+ $self->{endpoint}->close_context( $ctx );
+ return;
+ } elsif ( $method ne 'INVITE' ) {
DEBUG( 10,"drop non-INVITE request: ".$request->dump );
$self->{endpoint}->close_context( $ctx );
return;
- };
+ }
if ( my $filter = $args->{filter} ) {
my $rv = invoke_callback( $filter, $ctx->{from},$request );
Modified: branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pod
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pod?rev=7589&op=diff
==============================================================================
--- branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pod (original)
+++ branches/upstream/libnet-sip-perl/current/lib/Net/SIP/Simple.pod Sat Sep 15 05:32:52 2007
@@ -81,6 +81,12 @@
SIP address of local sender, either full SIP address or only part before \@, in which
case B<domain> has to be provided.
+=item options
+
+This is a hash reference containing headers (header-key,value) for replies to an
+OPTIONS request. If not or only partly given defaults will be used for the headers
+B<Allow>, B<Accept>, B<Accept-Encoding>, B<Accept-Language> and B<Supported>.
+
=item route
Optional list of SIP routes which will be added to route requests.
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=7589&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 Sat Sep 15 05:32:52 2007
@@ -321,6 +321,11 @@
invoke_callback($param->{cb_established},'OK',$self);
invoke_callback($param->{init_media},$self,$param);
}
+
+ } elsif ( $method eq 'OPTIONS' ) {
+
+ my $response = $packet->create_response( '200','OK',$self->{options} );
+ $self->{endpoint}->new_response( $ctx,$response,$leg,$from );
}
} else {
More information about the Pkg-perl-cvs-commits
mailing list