API

SIP.OutgoingRequest

An OutgoingRequest is a data structure that represents an Outgoing SIP Request and its attributes.

Construction

The OutgoingRequest constructor is intended for internal use only.

Instance Attributes

method

String - The SIP method used for the request.

ruri

SIP.URI - The request uri, or the SIP address that the request will be sent to.

ua

SIP.UA - The UA that this request is being sent from.

headers

Object - An object containing extra SIP headers for the request.

body

String - The body of the request, which will follow the SIP headers.

Instance Methods

setHeader(name,value)

Replaces the given header name with the given value.

Parameters

Name Type Description
name String The name of the SIP header to replace
value String|Array The value of to place in the SIP header field

getHeader(name)

Gets the value of the given header name.

Parameters

Name Type Description
name String The name of the SIP header to get the value of

Returns

Type Description
String | undefined Returns the specified header, undefined if header doesn’t exist

getHeaders(name)

Gets the header(s) of the given name.

Parameters

Name Type Description
name String The name of the SIP header to get

Returns

Type Description
Array All of the headers of the specified name

hasHeader(name)

Verify the existence of the given header name

Parameters

Name Type Description
name String The name of the SIP header to verify

Returns

Type Description
boolean true if the header with the given name exists, false otherwise

toString()

Returns a string of the SIP packet generated by the OutgoingRequest

Returns

Type Description
String A string of the SIP packet generated by the OutgoingRequest

Example

outgoingRequest.toString();

'INVITE sip:alice@example.com SIP/2.0
Via: 
Max-Forwards: 69
To: <sip:bob@example.com>
From: "Alice" <sip:alice@example.com>;tag=12g953gosn
Call-ID: 9q3341bc39ab41k8f4vb
CSeq: 4652 INVITE
Contact: <sip:d5e0h5v6@5jthu1mcbpau.invalid;transport=ws;ob>
Allow: ACK,CANCEL,BYE,OPTIONS,INVITE,MESSAGE
Content-Type: application/sdp
Supported: outbound
User-Agent: SIPjs
Content-Length: 0
'