API

SIP.Parser

The Parser object provides methods for extracting and parsing SIP messages.

Dependencies

  • SIP.Grammar.parse
  • SIP.IncomingRequest
  • SIP.IncomingResponse

Injected

SIP.UA

  • .getLogger

Methods

parseMessage(data, ua)

Parses a String representation of a SIP message into a SIP.IncomingRequest or SIP.IncomingResponse.

Parameters

Name Type Description
data String The SIP message, represented as a String.
ua SIP.UA A SIP user agent to use for logging.

Returns

Type Description
SIP.IncomingRequest|SIP.IncomingResponse The SIP message, parsed to a SIP.IncomingRequest or SIP.IncomingResponse object.

getHeader(data, headerStart)

Private From a SIP message, find a header beginning at the designated index.

Parameters

Name Type Description
data String The entire SIP message string.
headerStart Integer The index in the data String at which to start looking for the header.

Returns

Type Description
Integer The index in the data String just after the end of the found header.

parseHeader(message, data, headerStart, headerEnd)

Private Parse a header and set the corresponding properties on the given SIP message object.

Parameters

Name Type Description
message SIP.IncomingRequest|SIP.IncomingResponse The message object to populate.
data String The entire SIP message string.
headerStart Integer The index in the data String at which to start parsing the header.
headerEnd Integer The index in the data String at which to end parsing the header.

Returns

Type Description
Boolean|Object true if the header was parsed successfully. Otherwise, an object literal containing an error message property.