Net::SIP - Framework SIP (Voice Over IP, RFC3261)




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


Is the base class for handling SIP packets and provides ways to parse, construct and manipulate SIP packets.


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.


Is derived from SIP::Net::Packet and handles the response packets.


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


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.


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.


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


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.


Simple implementation of a registrar.


Simple implementation of a stateless proxy. Stateful proxies should probably be implemented by putting multiple Net::SIP::Endpoints together.

Simplified Layer for common tasks


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).


By default nothing is exported. There are various arguments for exporting:


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.


Exports everything (tag ':all') from Net::SIP::Util.


Exports the default exports from Net::SIP::Debug.


Everything from ':debug', ':util' and ':alias'.


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.


  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( ... )


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.