.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::SIP::Request 3pm" .TH Net::SIP::Request 3pm "2023-09-29" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::SIP::Request \- handling of SIP request packets .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& my $req = Net::SIP::Request\->new( \*(AqINVITE\*(Aq,... ); \& my $ack = $req\->create_ack(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Subclass of Net::SIP::Packet for handling request packets. Has methods to create responses to requests and to authorize requests. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 6 \& # create INVITE request \& my $invite = Net::SIP::Request\->new( \& \*(AqINVITE\*(Aq, \*(Aqsip:you@example.com\*(Aq, \& { from => ..., to => ... }, \& Net::SIP::SDP\->new( ... ) \& ); \& \& # somehow send request and retrieve response $resp \& ... \& if ( $resp\->code eq \*(Aq401\*(Aq or $resp\->code eq \*(Aq407\*(Aq ) { \& # need to authorize request \& $invite\->authorize( $resp, [ username, password ] ); \& \& # somehow send again and retrieve response $resp \& ... \& } \& \& if ( $resp\->code ~m{^[2345]\ed\ed} ) { \& # got final response, send ACK \& my $ack = $invite\->create_ack( $resp ); \& \& # somehow send $ack \& ... \& } .Ve .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" Inherited from Net::SIP::Packet. See there. .SH "METHODS" .IX Header "METHODS" .IP "method" 4 .IX Item "method" Get method of request. .IP "uri" 4 .IX Item "uri" Get \s-1URI\s0 part of request. .IP "set_uri ( \s-1STRING\s0 )" 4 .IX Item "set_uri ( STRING )" Set \s-1URI\s0 of request to \s-1STRING\s0 .IP "set_cseq ( \s-1NUMBER\s0 )" 4 .IX Item "set_cseq ( NUMBER )" Set sequence number if \f(CW\*(C`CSeq\*(C'\fR header to \s-1NUMBER.\s0 .IP "create_ack ( \s-1RESPONSE\s0 )" 4 .IX Item "create_ack ( RESPONSE )" Returns Net::SIP::Request object for \s-1ACK\s0 request for the case when Net::SIP::Response \s-1RESPONSE\s0 was received in reply for packet \f(CW$self\fR. .IP "create_cancel" 4 .IX Item "create_cancel" Returns Net::SIP::Request object to cancel request in \f(CW$self\fR. .IP "create_response ( \s-1CODE,\s0 [\s-1MSG,\s0] [ \e%HEADER, \s-1BODY\s0 ] )" 4 .IX Item "create_response ( CODE, [MSG,] [ %HEADER, BODY ] )" Returns Net::SIP::Response packet for the received request \f(CW$self\fR with numerical code \s-1CODE\s0 and text message \s-1MSG.\s0 Header for the response will be based on the request, but can be added or overridden using \e%HEADER. If \s-1MSG\s0 is not given (e.g. argument is missing, second argument is \e%HEADER already) a builtin message for the code will be used. .Sp For details to \e%HEADER and \s-1BODY\s0 see \fBnew_from_parts\fR in Net::SIP::Packet. .IP "authorize ( \s-1RESPONSE, AUTH\s0 )" 4 .IX Item "authorize ( RESPONSE, AUTH )" Tries to authorize request \f(CW$self\fR based on the information in \s-1RESPONSE\s0 (a 401 or 407 \*(L"Authorization required\*(R" response) and \s-1AUTH. AUTH\s0 is either \&\f(CW\*(C`[ user,pass ]\*(C'\fR if a global authorization info exists for all realms or \&\f(CW\*(C`{ realm1 => [ user1,pass1 ], realm2 => [ user2,pass2 ],... }\*(C'\fR if different credentials are provided for different realms or a callback \&\f(CW\*(C`callback(realm)\->[user,pass]\*(C'\fR. The realms, for which authorization is needed, are read from \s-1RESPONSE.\s0 .Sp The request \f(CW$self\fR is modified in-place. If a modification occurred, e.g. if (parts of) the authorization requests could be resolved it will return \&\s-1TRUE,\s0 else \s-1FALSE.\s0 .Sp Supports only \s-1RFC2617\s0 with md5 and empty qop or qop 'auth', not md5\-sess or qop's like 'auth\-int'.