Net::S...direct(3pm)

πŸ’– NAME πŸ’–

Net::SIP::Redirect β€” bestie, this one sends redirects to Requests based on a lookup at a registrar πŸŽ€


✨ SYNOPSIS ✨

  my $reg = Net::SIP::Registrar->new(...);
  my $redir = Net::SIP::Redirect(
        dispatcher => $dispatcher,
        registrar => $reg,
  );

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this package? It implements a simple redirection of Requests using the info that a registrar hands over. That's it, that's the whole vibe. It's giving "you don't live here anymore, go talk to these people instead" πŸ’…


🌸 CONSTRUCTOR 🌸

new ( %ARGS )

This creates a brand new redirect object, no cap. And %ARGS can have these keys in it πŸ‘‡

  • dispatcher β€” a Net::SIP::Dispatcher object that's managing the registar. Mandatory, so like, you literally cannot skip it, fr fr.
  • registrar β€” the Registrar object. It's an object shaped like a Net::SIP::Registrar, meaning it has a query(address) method that returns a list of contacts. That's the whole requirement, she's lowkey flexible like that 🫢

πŸ’œ METHODS πŸ’œ

receive ( PACKET, LEG, FROM )

So PACKET is the incoming packet, LEG is the Net::SIP::Leg where the packet showed up, and FROM is the "ip:port" of whoever sent it. Responses get sent right back to the sender through that same leg, obviously πŸ’Œ

This gets called by the managing Net::SIP::Dispatcher object whenever a new packet arrives, like a little doorbell πŸ””

Here's the tea on what it does:

  • If it's a REGISTER request, it will return "()" and just ignore the packet. Not her problem, moving on πŸ™ˆ
  • For Requests, she'll query the registrar and return either "302 Moved Temporarily" with the list of contacts, or "404 Not Found" if that address isn't registered. Iconic behaviour honestly πŸ‘‘
Heads up bestie: those REGISTER requests get straight-up ignored and you get "()" back β€” that's intentional, not a bug πŸ’€

perl v5.40.1 Β· 2025-12-07 β€” okay that's the whole page, mwah, go redirect some Requests and slay πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from