Net::SIP::Request(3pm) | User Contributed Perl Documentation | Net::SIP::Request(3pm) |
Net::SIP::Request - handling of SIP request packets
my $req = Net::SIP::Request->new( 'INVITE',... ); my $ack = $req->create_ack();
Subclass of Net::SIP::Packet for handling request packets. Has methods to create responses to requests and to authorize requests.
# create INVITE request my $invite = Net::SIP::Request->new( 'INVITE', 'sip:you@example.com', { from => ..., to => ... }, Net::SIP::SDP->new( ... ) ); # somehow send request and retrieve response $resp ... if ( $resp->code eq '401' or $resp->code eq '407' ) { # need to authorize request $invite->authorize( $resp, [ username, password ] ); # somehow send again and retrieve response $resp ... } if ( $resp->code ~m{^[2345]\d\d} ) { # got final response, send ACK my $ack = $invite->create_ack( $resp ); # somehow send $ack ... }
Inherited from Net::SIP::Packet. See there.
For details to \%HEADER and BODY see new_from_parts in Net::SIP::Packet.
The request $self is modified in-place. If a modification occurred, e.g. if (parts of) the authorization requests could be resolved it will return TRUE, else FALSE.
Supports only RFC2617 with md5 and empty qop or qop 'auth', not md5-sess or qop's like 'auth-int'.
2023-02-04 | perl v5.36.0 |