Net::S...le::RTP(3pm)
π NAME π
Net::SIP::Simple::RTP β simple RTP handling for Net::SIP::Simple π¦
okay so bestie, this is the page for Net::S...le::RTP(3pm) from the User Contributed Perl Documentation, and it's genuinely the chillest little RTP helper you've ever met, no cap.
β¨ 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 );
like, two lines and you're already living your best life π
πΈ DESCRIPTION πΈ
This package handles the simple RTP stuff β y'know, for testing and for small applications. It's giving utility energy, not trying-to-run-a-whole-telephony-empire energy.
It gives you methods for receiving PCUM/8000 data and for echoing them back, or for sending and receiving PCMU/8000 data. That's it. That's the whole vibe.
It's used from the method rtp in Net::SIP::Simple. So if you're wondering where it gets called from β there. Iconic. π
π«Ά SUBROUTINES π«Ά
media_recv_echo ( [ OUTPUT, DELAY ] )
Receives RTP data and echoes them back to the sender. A little mirror moment, if you will. πͺβ¨
If OUTPUT is given, it will be used as the file for saving the received data β and heads up, that's the received data without the RTP header, so don't come for me when there's no header in there.
OUTPUT might also be a callback, which gets the payload as its argument. Slay, flexible.
Now, DELAY β this one's the whole personality of the function:
- If
DELAYis >0, the data will not be echoed back immediately but with a delay ofDELAYpackets (e.g. withDELAY10it will send back the first packet after it received the 10th packet). - If
DELAYis <0, the data will not be echoed back. at all. it's giving ghosting. π» - If
DELAYis not given or is equal to0, the data will be echoed back immediately.
If no traffic comes in for more then 10 seconds it will hang up the call because of inactivity. so like, keep the convo going bestie, or it's over. π
media_send_recv ( INPUT, [ REPEAT, OUTPUT ] )
Will read data from the file INPUT and send them as RTP to the 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. And if REPEAT is less than 0 it will repeat forever, e.g. until the other party hangs up. main character energy fr fr. π
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. so either the callback handles it or BYE it is, no in-between.
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. (important!)
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. so the formats match up, you love to see it. π
OUTPUT might also be a callback which gets the payload as an argument.
If no traffic comes in for more then 10 seconds it will hang up the call because of inactivity. same deal as before β silence = goodbye. π
that's the whole page, bestie! this was perl v5.40.1, dated 2025-12-07 β so yes, she's fresh, she's current, she's serving. go forth and RTP responsibly. πβ¨ππ¦πΈπ
π«Ά
π¦ 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