Net::SIP::Simple::RTP(3pm) User Contributed Perl Documentation Net::SIP::Simple::RTP(3pm)NAME
Net::SIP::Simple::RTP - simple RTP handling for Net::SIP::Simple
SYNOPSIS
my $echo_10 = Net::SIP::Simple->rtp( 'media_recv_echo', 'output.pcmu-8000', 10 );
my $announce = Net::SIP::Simple->rtp( 'media_send_recv', 'announce.pcmu-8000', 2 );
DESCRIPTION
This package handles simple RTP stuff for testing and small applications. It provides methods for receiving PCUM/8000 data and for echoing
them back or for sending and receiving PCMU/8000 data.
It's used from method rtp in Net::SIP::Simple.
SUBROUTINES
media_recv_echo ( [ OUTPUT, DELAY ] )
Receives RTP data and echos them back to the sender. If OUTPUT is given it will be used as the file for saving the received data
without the RTP header.
OUTPUT might also be a callback which gets the payload as argument.
If DELAY is >0 the data will not be echoed back immediatly but with an delay of DELAY packets (e.g. with DELAY 10 it will send back
the first packet after it received the 10th packet). If DELAY is <0 the data will not be echoed back. If DELAY is not given or equal
0 the data will be echoed back immediatly.
If no traffic comes in for more then 10 seconds it will hang up the call because of inactivity.
media_send_recv ( INPUT, [ REPEAT, OUTPUT ] )
Will read data from file INPUT and send them as RTP to peer. It will assume that each data block in INPUT consists of 160 bytes, which
is right for PCMU/8000 without RTP header. The RTP header will be added to the data.
If it reaches the end of the file it will stop unless REPEAT is given in which case it will repeat the sending REPEAT times (if REPEAT
is less 0 it will repeat forever e.g. until the other party hangs up). On stopping it will invoke the callback cb_rtp_done from the
connection params for the Net::SIP::Simple::Call or if this is not given it will close the call by issuing a BYE.
INPUT might also be a callback usable by invoke_callback in Net::SIP::Util which returns the data to send. In this case REPEAT is not
used.
Incoming data will be written to the optional OUTPUT file like in media_recv_echo. The content from OUTPUT has the same format as INPUT
or OUTPUT from media_recv_echo.
OUTPUT might also be a callback which gets the payload as argument.
If no traffic comes in for more then 10 seconds it will hang up the call because of inactivity.
perl v5.14.2 2009-01-23 Net::SIP::Simple::RTP(3pm)
Check Out this Related Man Page
Net::SIP(3pm) User Contributed Perl Documentation Net::SIP(3pm)NAME
Net::SIP - Framework SIP (Voice Over IP, RFC3261)
SYNOPSIS
...
DESCRIPTION
Net::SIP consists of packages for handling the SIP packets, for transport of the packets, for processing the packets and on top of all that
a simplified layer for common tasks.
Addionally Net::SIP::Util provides utility functions and Net::SIP::Debug provides a debugging layer used by all these packets. Especially
it provides the function invoke_callback which is used for all callback unless otherwise in the documentation specified. This function
supports a variety of different callback styles.
For first and simple applications you best start with Net::SIP::Simple. If this is no longer enough you might look at the details of
Net::SIP::Dispatcher, Net::SIP::Endpoint, Net::SIP::Register and Net::SIP::StatelessProxy. Although these packages are in itself well
documented the functionality and the design is best understandable if you look how it gets used in tghe source of Net::SIP::Simple.
SIP packet handling
SIP::Net::Packet
Is the base class for handling SIP packets and provides ways to parse, construct and manipulate SIP packets.
SIP::Net::Request
Is derived from SIP::Net::Packet and handles the request packets. Provides ways to create special requests like ACK or CANCEL based on
previous requests and responses, for creating responses based on requests, for authorization of requests.
SIP::Net::Response
Is derived from SIP::Net::Packet and handles the response packets.
SIP::Net::SDP
Handles SDP bodies from SIP packets. Provides ways to parse, construct these bodies, to get media information from them and to
manipulate the SDP data for NAT etc.
Transport of SIP packets
Net::SIP::Leg
Encapsulates socket for transport of packet. Provides way to find out, if target is reachable through this socket. Prepares incoming,
outgoing and forwarding packets by removing or adding header like Via, Record-Route.
Net::SIP::Dispatcher
Handles new packets coming in through a Net::SIP::Leg. Delivers outgoing packets through the appropriate Net::SIP::Leg. Handles
timeouts and retransmission of outgoing packets, lookup of the appropriate leg through DNS etc.
Net::SIP::Dispatcher::Eventloop
Simple implementation of an event loop for handling socket events and timers. Can be replaced to integrate into other event loops,
like Tk, Lib::Event or POE.
Processing of SIP packets, application layer
Net::SIP::Endpoint
Implements a SIP endpoint (UAC,UAS). Provides ways to INVITE or BYE calls or to handle incoming calls. Calls itself will be handled by
Net::SIP::Endpoint::Context.
Net::SIP::Registrar
Simple implementation of a registrar.
Net::SIP::StatelessProxy
Simple implementation of a stateless proxy. Stateful proxies should probably be implemented by putting multiple Net::SIP::Endpoints
together.
Net::SIP::Blocker
Can block requests by method name with custom error code.
Net::SIP::ReceiveChain
Can contain various objects for processing objects. Useful in connection with Net::SIP::Authorize.
Net::SIP::Redirect
Works together with a registrar and redirects requests.
Net::SIP::Authorize
If put into a Net::SIP::ReceiveChain it requests and checks authorization and gives only authorized requests to the next member of the
chain.
Simplified Layer for common tasks
Net::SIP::Simple
Provides simple layer for common tasks and tests, like sending a voice message to somebody, receiving a message or even implementing an
answer machine. Together with Net::SIP::Simple::RTP it is possible to handle simple RTP data (PCMU/8000).
Error handling
Unless otherwise documented the common way to propagate errors is to raise an exception, e.g. call die(). This might especially happen when
parsing packets from strings, so unless you want to crash your application on bad input you should catch these exceptions with eval.
EXPORTS
By default nothing is exported. There are various arguments for exporting:
:alias
Exports constants as aliases for the Net::SIP::* packages, e.g. 'Simple' for 'Net::SIP::Simple', 'Registrar' for
'Net::SIP::Registrar', 'Packet' for 'Net::SIP::Packet', 'NATHelper_Client' for 'Net::SIP::NATHelper::Client'
etc.
:util
Exports everything (tag ':all') from Net::SIP::Util.
:debug
Exports the default exports from Net::SIP::Debug.
:all
Everything from ':debug', ':util' and ':alias'.
rtp=MINPORT-MAXPORT|rtp:MINPORT-MAXPORT
Set the range of ports to be used for creating RTP sockets to MINPORT..MAXPORT. This affects Net::SIP::Util::create_rtp_sockets.
debug=LEVEL|debug:LEVEL
Set Debugging level to LEVEL
string
Strings where the first character is upper case will be interpreted as aliases for Net::SIP::* and it will try to export it. If the
first character is lower case it will try to import it from Net::SIP::Util.
EXAMPLES
use Net::SIP 'invoke_callback'; # use Net::SIP::Util 'invoke_callback'
use Net::SIP ':debug'; # use Net::SIP::Debug
use Net::SIP ':util'; # use Net::SIP::Util ':all'
use Net::SIP ':alias';
Packet->new( ... ); # Net::SIP::Packet->new( ... )
# restrict rtp sockets from command line
perl -MNet::SIP=rtp:4000-4010 program.pl
COPYRIGHT
This module and are modules in the Net::SIP Hierarchy distributed together with this module are copyright (c) 2006-2007, Steffen Ullrich.
All Rights Reserved. These modules are free software. They may be used, redistributed and/or modified under the same terms as Perl itself.
perl v5.14.2 2011-08-26 Net::SIP(3pm)