Net::SIP(3pm)
β¨ NAME β¨
Net::SIP β the Framework SIP situation, aka Voice Over IP, aka RFC3261 π
(it's a perl manual page, section 3pm, if you were wondering π«Ά)
π SYNOPSIS π
...
(yes bestie, the synopsis is literally three dots. it's giving mysterious. it's giving "read the DESCRIPTION, babe" π)
π DESCRIPTION π
okay so Net::SIP is not one thing, it's a whole ensemble cast. It's made of packages that handle the SIP packets themselves, packages for transporting those packets, packages for processing them, and then β sitting on top like a crown π β a simplified layer for all the common tasks.
Also (and the original really does spell it "Addionally", we love a typo moment β¨) there's Net::SIP::Util, which gives you utility functions, and Net::SIP::Debug, which gives you a debugging layer that literally all of these packages use. The big one in there is the function invoke_callback, and it's the function used for all callbacks unless the documentation says otherwise. Bestie, this function is so versatile β it supports a whole variety of different callback styles. main character energy fr fr π
If you're doing your first little simple application, start with Net::SIP::Simple, no notes, that's the move. And if that's no longer enough for you (growth! we love to see it π±), go look at the details of Net::SIP::Dispatcher, Net::SIP::Endpoint, Net::SIP::Register and Net::SIP::StatelessProxy. And yeah, those packages are each well documented on their own, but ngl the functionality and the design are best understood if you go look at how they get used in the source of Net::SIP::Simple. iykyk π§
π¦ SIP packet handling π¦
- Net::SIP::Packet β the base class for handling SIP packets, and it gives you ways to parse, construct and manipulate SIP packets. the foundation, the blueprint, the mother π
- Net::SIP::Request β derived from
Net::SIP::Packet, and it handles the request packets. It gives you ways to create special requests like ACK or CANCEL based on previous requests and responses, to create responses based on requests, and to do authorization of requests. multitasking queen π - Net::SIP::Response β derived from
Net::SIP::Packet, and it handles the response packets. short king, does its job πΈ - Net::SIP::SDP β handles the SDP bodies from SIP packets. Gives you ways to parse and construct these bodies, to get media information out of them, and to manipulate the SDP data for NAT etc. the glow-up artist of the packet world β¨
π Transport of SIP packets π
- Net::SIP::Leg β encapsulates the socket for transport of packets. Gives you a way to find out if a target is reachable through this socket. And it prepares incoming, outgoing and forwarding packets by removing or adding headers like Via and Record-Route. the little packet stylist π
- Net::SIP::Dispatcher β handles new packets coming in through a
Net::SIP::Leg. Delivers outgoing packets through the appropriateNet::SIP::Leg. Handles timeouts and retransmission of outgoing packets, lookup of the appropriate leg through DNS, etc. the traffic controller of the whole vibe π¦ - Net::SIP::Dispatcher::Eventloop β a simple implementation of an event loop for handling socket events and timers. It can be replaced to integrate into other event loops, like Tk, Lib::Event or POE. modular? we stan π«Ά
π Processing of SIP packets, application layer π
- Net::SIP::Endpoint β implements a SIP endpoint (UAC,UAS). Gives you ways to INVITE or BYE calls, or to handle incoming calls. The calls themselves get handled by
Net::SIP::Endpoint::Context. so many layers, so much lore π - Net::SIP::Registrar β a simple implementation of a registrar. iconic, no further questions π
- Net::SIP::StatelessProxy β a simple implementation of a stateless proxy. And heads up: stateful proxies should probably be implemented by putting multiple
Net::SIP::Endpointstogether. teamwork makes the dream work π§ - Net::SIP::Blocker β can block requests by method name with a custom error code. it's giving bouncer at the club π«β¨
- Net::SIP::ReceiveChain β can contain various objects for processing objects (yes, that's what it says, we're being faithful here π). Useful in connection with
Net::SIP::Authorize. - Net::SIP::Redirect β works together with a registrar and redirects requests. go that way, bestie β‘οΈ
- Net::SIP::Authorize β if you put it into a
Net::SIP::ReceiveChainit requests and checks authorization, and it gives only authorized requests to the next member of the chain. no VIP pass, no entry ποΈ
π Simplified Layer for common tasks π
- Net::SIP::Simple β gives you a simple layer for common tasks and tests, like sending a voice message to somebody, receiving a message, or even implementing an answer machine. And together with
Net::SIP::Simple::RTPit's possible to handle simple RTP data (PCMU/8000). the starter pack, the beginner's blessing πΈ
π Error handling π
Unless the docs say otherwise, the common way to propagate errors is to raise an exception, e.g. call die(). This can especially happen when you're parsing packets from strings β so unless you want to crash your application on bad input (and bestie, you do not π), you should catch these exceptions with eval.
no cap: unhandled exceptions are not a personality trait. wrap it in eval, protect your peace π«Ά
π EXPORTS π
By default, nothing is exported. nothing. zero. the bag is empty until you ask π
There are various arguments for exporting:
:aliasβ exports constants as aliases for theNet::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. nickname privileges only β¨:utilβ exports everything (tag':all') fromNet::SIP::Util. the whole toolbox, dumped on the table π§°:debugβ exports the default exports fromNet::SIP::Debug. the default default, but make it debug π:allβ everything from':debug',':util'and':alias'. yes, all of it. go off πrtp=MINPORT-MAXPORTorrtp:MINPORT-MAXPORTβ sets the range of ports to be used for creating RTP sockets toMINPORT..MAXPORT. This affectsNet::SIP::Util::create_rtp_sockets. keep your ports on a leash πdebug=LEVELordebug:LEVELβ sets the Debugging level toLEVEL. turn the volume up π₯stringβ strings where the first character is upper case will be interpreted as aliases forNet::SIP::*and it will try to export it. If the first character is lower case it will try to import it fromNet::SIP::Util. case-sensitive behaviour, uppercase = export, lowercase = import, periodt π
π 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
look at those comments doing the explaining for us, we love a self-documenting moment ππ
π BUGS π
Support for TCP and SIPS is not, or not fully, implemented. that's the whole bug report. no elaboration. we respect the brevity π
π COPYRIGHT π
This module, and the modules in the Net::SIP hierarchy that are distributed together with this module, are copyright (c) 2006-2013, 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. π
and that's the whole page, bestie π«Ά this was written for perl v5.40.1 and dated 2025-12-07 β so yeah, shoutout to that version and that date, they're the ones holding this whole thing down πβ¨ bye mwah π
πΈ
π¦ where this page comes from
- ubuntu resolute: libnet-sip-perl 0.840-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-sip-perl 0.840-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms