Net::SIP::Dropper(3pm) | User Contributed Perl Documentation | Net::SIP::Dropper(3pm) |
Net::SIP::Dropper - drops SIP messages based on callback
use Net::SIP::Dropper::ByIPPort; my $drop_by_ipport = Net::SIP::Dropper::ByIPPort->new( database => '/path/to/database.drop', methods => [ 'REGISTER', '...', '' ], attempts => 10, interval => 60, ); use Net::SIP::Dropper::ByField; my $drop_by_field = Net::SIP::Dropper::ByField->new( methods => [ 'REGISTER', '...', '' ], 'From' => qr/sip(?:vicious|sscuser)/, 'User-Agent' => qr/^friendly-scanner$/, ); my $drop_subscribe = sub { my ($packet,$leg,$from) = @_; # drop all subscribe requests and responses return $packet->method eq 'SUBSCRIBE' ? 1:0; }; my $dropper = Net::SIP::Dropper->new( cbs => [ $drop_by_ipport, $drop_by_field, $drop_subscribe ]); my $chain = Net::SIP::ReceiveChain->new( [ $dropper, ... ] );
Drops messages. This means, does no further processing in the Net::SIP chain and does not send something back if the incoming message match the settings.
Some useful droppers are defined in Net::SIP::Dropper::ByIpPort and Net::SIP::Dropper::ByField.
Returns a new dropper object to be used in the chain.
2023-02-04 | perl v5.36.0 |