My SIP application needed notification of SIP NOTIFY events so that it could track MWI status. I made a small modification to Simple.pm to allow this:
diff -c -r Net-SIP-0.64/lib/Net/SIP/Simple.pm Net-SIP-new-0.64/lib/Net/SIP/Simple.pm
*** Net-SIP-0.64/lib/Net/SIP/Simple.pm 2011-10-07 08:24:36.000000000 -0400
--- Net-SIP-new-0.64/lib/Net/SIP/Simple.pm 2011-12-24 09:37:53.845103566 -0500
***************
*** 412,417 ****
--- 412,424 ----
$self->{endpoint}->new_response( $ctx,$response,$leg,$from );
$self->{endpoint}->close_context( $ctx );
return;
+ } elsif ( $method eq 'NOTIFY' ) {
+ DEBUG( 10,"NOTIFY request: ".$request->dump );
+ if ( my $notify = $args->{notify} ) {
+ invoke_callback( $notify, $ctx->{from},$request );
+ }
+ $self->{endpoint}->close_context( $ctx );
+ return;
} elsif ( $method ne 'INVITE' ) {
DEBUG( 10,"drop non-INVITE request: ".$request->dump );
$self->{endpoint}->close_context( $ctx );
The usage is something like...
$sua->listen(
notify => sub {
my $param = shift;
my $request = shift;
print "RECEIVED NOTIFY: ", scalar(localtime), "\n";
print $request->{body},"\nEND NOTIFY\n";
}
);
Is there any chance that this could be added to the official code?