r11108 - in /trunk/libnet-sip-perl: Changes META.yml THANKS debian/changelog debian/control lib/Net/SIP.pm lib/Net/SIP/Leg.pm lib/Net/SIP/Simple/Call.pm lib/Net/SIP/Simple/Call.pod lib/Net/SIP/Simple/RTP.pm

rmayorga-guest at users.alioth.debian.org rmayorga-guest at users.alioth.debian.org
Tue Dec 11 05:40:26 UTC 2007


Author: rmayorga-guest
Date: Tue Dec 11 05:40:25 2007
New Revision: 11108

URL: http://svn.debian.org/wsvn/?sc=1&rev=11108
Log:
* New upstream release
* Bump standard version to 3.7.3 ( no changes requiered )

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/debian/control
    trunk/libnet-sip-perl/lib/Net/SIP.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Leg.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod
    trunk/libnet-sip-perl/lib/Net/SIP/Simple/RTP.pm

Modified: trunk/libnet-sip-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/Changes?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/Changes (original)
+++ trunk/libnet-sip-perl/Changes Tue Dec 11 05:40:25 2007
@@ -1,4 +1,13 @@
 Revision history for Net::SIP
+
+0.40
+  - Net::SIP::Simple::RTP - when sending data from file set the timestamp
+    based on sequence number and packet size ( == samples in packet for 8bit)
+  - set Via header correct in the case of udp and port 5061.
+    No longer set Via based on contact header, base it only on address
+    of leg
+  - primitive support for other codecs in Net::SIP::Simple, see 
+    rtp_param in Net::SIP::Simple::Call
 
 0.39
   - work around missing support for non-blocking sockets in IO::Socket

Modified: trunk/libnet-sip-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/META.yml?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/META.yml (original)
+++ trunk/libnet-sip-perl/META.yml Tue Dec 11 05:40:25 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.39
+version:      0.40
 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=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/THANKS (original)
+++ trunk/libnet-sip-perl/THANKS Tue Dec 11 05:40:25 2007
@@ -6,3 +6,4 @@
 cpan:POLETTIX
 <karme[AT]berlios[DOT]de>
 <t-cpan.org[AT]tobias[DOT]org>
+<franz[AT]rzk[DOT]com>

Modified: trunk/libnet-sip-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/debian/changelog?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/debian/changelog (original)
+++ trunk/libnet-sip-perl/debian/changelog Tue Dec 11 05:40:25 2007
@@ -1,3 +1,10 @@
+libnet-sip-perl (0.40-1) unstable; urgency=low
+
+  * New upstream release
+  * Bump standard version to 3.7.3 ( no changes requiered )
+
+ -- Rene Mayorga <rmayorga at debian.org.sv>  Mon, 10 Dec 2007 23:02:00 -0600
+
 libnet-sip-perl (0.39-1) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libnet-sip-perl/debian/control
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/debian/control?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/debian/control (original)
+++ trunk/libnet-sip-perl/debian/control Tue Dec 11 05:40:25 2007
@@ -7,7 +7,7 @@
  gregor herrmann <gregor+debian at comodo.priv.at>
 Build-Depends: debhelper (>= 5)
 Build-Depends-Indep: perl (>= 5.8.1), libnet-dns-perl, net-tools, netbase
-Standards-Version: 3.7.2
+Standards-Version: 3.7.3
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libnet-sip-perl/
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/
 Homepage: http://search.cpan.org/dist/Net-SIP/

Modified: trunk/libnet-sip-perl/lib/Net/SIP.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP.pm?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP.pm Tue Dec 11 05:40:25 2007
@@ -4,7 +4,7 @@
 require 5.008;
 
 package Net::SIP;
-our $VERSION = '0.39';
+our $VERSION = '0.40';
 
 # this includes nearly everything else
 use Net::SIP::Simple ();

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=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Leg.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Leg.pm Tue Dec 11 05:40:25 2007
@@ -73,21 +73,20 @@
 		$self->{proto} = ( $sock->socktype == SOCK_STREAM ) ? 'tcp':'udp'
 	}
 
-	unless ( $self->{contact}  = delete $args{contact} ) {
-		my ($port,$sip_proto) =
-			$self->{port} == 5060 ? ( '','sip' ) :
-			$self->{port} == 5061 && $self->{proto} eq 'udp' ? ( '','sips' ) :
-			( ":$self->{port}",'sip' )
-			;
-		$self->{contact} = $sip_proto.':'.$self->{addr}.$port;
-	}
+	my ($port,$sip_proto) =
+		$self->{port} == 5060 ? ( '','sip' ) :
+		( $self->{port} == 5061 and $self->{proto} eq 'tcp' ) ? ( '','sips' ) :
+		( ":$self->{port}",'sip' )
+		;
+	my $leg_addr = $self->{addr}.$port;
+	$self->{contact}  = delete $args{contact} || "$sip_proto:$leg_addr";
 
 	$self->{branch} = 'z9hG4bK'.
 		( delete $args{branch} || md5_hex( @{$self}{qw( addr port proto )} ));
 
 	$self->{contact} =~m{^\w+:(.*)};
 	$self->{via} =  sprintf( "SIP/2.0/%s %s;branch=%s",
-		uc($self->{proto}),$1, $self->{branch} );
+		uc($self->{proto}),$leg_addr, $self->{branch} );
 
 	return $self;
 }

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm Tue Dec 11 05:40:25 2007
@@ -46,6 +46,12 @@
 #   sip_header: hashref of SIP headers to add
 #   call_on_hold: one-shot parameter to set local media addr to 0.0.0.0,
 #       will be set to false after use
+#   rtp_param: [ pt,size,interval,name ] RTP payload type, packet size and interval
+#       between packets managed in Net::SIP::Simple::RTP, default is PCMU/8000,
+#       e.g [ 0,160,160/8000 ]
+#       a name can be added in which case an rtpmap and ptme entry will be created in the
+#       SDP, e.g. [ 97,240,0.03,'iLBC/8000' ]
+###########################################################################
 
 use Net::SIP::Util qw(create_rtp_sockets invoke_callback);
 use Net::SIP::Debug;
@@ -78,6 +84,7 @@
 	$self->{rtp_cleanup}  = [];
 	$self->{param} = $param ||= {};
 	$param->{init_media} ||= $self->rtp( 'media_recv_echo' );
+	$param->{rtp_param}  ||= [ 0,160,160/8000 ]; # PCMU/8000: 5*160 bytes/second
 	return $self;
 }
 
@@ -432,10 +439,14 @@
 				};
 			}
 		} else {
+			my $rp = $param->{rtp_param};
 			push @media, {
 				proto => 'RTP/AVP',
 				media => 'audio',
-				fmt   => 0, # PCMU/8000
+				fmt   => $rp->[0] || 0, # PCMU/8000
+				$rp->[3] ? ( 
+					a => [ "rtpmap:$rp->[0] $rp->[3]" , "ptime:".$rp->[2]*1000 ]
+				) :(),
 			}
 		}
 

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod Tue Dec 11 05:40:25 2007
@@ -18,7 +18,7 @@
 
 =over 4
 
-=item new ( CONTROL, CTX, %ARGS )
+=item new ( CONTROL, CTX, \%ARGS )
 
 Creates a new L<Net::SIP::Simple::Call> object to control a call.
 Usually called from B<invite> in L<Net::SIP::Simple>.
@@ -51,6 +51,16 @@
 
 Callback will be invoked with the call C<$self> and the connection
 parameter as an argument (as hash reference).
+
+=item rtp_param
+
+Data for the codec used in the media specified by B<init_media> and
+for the initialization of the default SDP data. This is an array reference
+C<< [pt,size,interval,name] >> where B<pt> is the payload type, B<size> is the
+size of the payload and B<interval> the interval in which the RTP packets
+will be send. B<name> is optional and if given rtpmap and ptime entries will be added
+to the SDP so that the name is associated with the given payload type.
+The default is for PCMU/8000: C<< [0,160,160/8000] >>.
 
 =item sdp
 

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Simple/RTP.pm
URL: http://svn.debian.org/wsvn/trunk/libnet-sip-perl/lib/Net/SIP/Simple/RTP.pm?rev=11108&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Simple/RTP.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Simple/RTP.pm Tue Dec 11 05:40:25 2007
@@ -5,7 +5,6 @@
 #    can save received data
 # - media_send_recv: receive and optionally save data. Sends back data
 #    from file with optional repeat count
-# only PCMU 8000 data will be handled at the moment
 ###########################################################################
 
 use strict;
@@ -155,9 +154,10 @@
 					0, # start immediatly
 					[ \&_send_rtp,$s_sock,$call->{loop},$addr,$readfrom, {
 						repeat => $repeat || 1,
-						cb_done => [ sub { invoke_callback(@_) }, $cb_done, $call ]
+						cb_done => [ sub { invoke_callback(@_) }, $cb_done, $call ],
+						rtp_param => $args->{rtp_param},
 					}],
-					160/8000, # 8000 bytes per second, 160 bytes per sample
+					$args->{rtp_param}[2], # repeat timer
 					'rtpsend',
 				);
 
@@ -265,7 +265,7 @@
 ###########################################################################
 # Helper to read  RTP data from file (PCMU 8000) and send them through
 # the RTP socket
-# Args: ($sock,$loop,$addr,$readfrom,$targs)
+# Args: ($sock,$loop,$addr,$readfrom,$targs,$timer)
 #   $sock: RTP socket
 #   $loop: event loop (used for looptime for timestamp)
 #   $addr: where to send data
@@ -275,6 +275,7 @@
 #     send (<=0 means forever) and 'cb_done' holds a [\&sub, at arg] callback
 #     to end the call after sending all data
 #     'repeat' makes only sense if $readfrom is filename
+#   $timer: timer which gets canceled once all data are send
 # Return: NONE
 ###########################################################################
 sub _send_rtp {
@@ -308,7 +309,8 @@
 				open( $fd,'<',$readfrom ) || die $!;
 				$targs->{fd} = $fd;
 			}
-			last if read( $fd,$buf,160 ) == 160;
+			my $size = $targs->{rtp_param}[1]; # 160 for PCMU/8000
+			last if read( $fd,$buf,$size ) == $size;
 			# try to reopen file
 			close($fd);
 			$targs->{fd} = undef;
@@ -318,10 +320,11 @@
 	$buf || die $!;
 
 	# add RTP header
-	my $now = $loop->looptime;
-	my $timestamp = ( $now * 10_000 ) % 2**32; # 10*ms precision in 32 bit
 	$targs->{wseq}++;
 	my $seq = $targs->{wseq};
+	# 32 bit timestamp based on seq and packet size
+	# FIXME: it assumes here that packet size == number of samples which is true only for 8bit
+	my $timestamp = ( $targs->{rtp_param}[1] * $seq ) % 2**32; 
 
 	if (0) {
 		my ($fp,$fa) = unpack_sockaddr_in( getsockname($sock) );
@@ -333,7 +336,7 @@
 
 	my $header = pack('CCnNN',
 		0b10000000, # Version 2
-		0b00000000, # PMCU 8000
+		$targs->{rtp_param}[0], # 0 == PMCU 8000
 		$seq, # sequence
 		$timestamp,
 		0x1234,    # source ID




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