C# Class SIPLib.SIP.Message

This class is used to represent a SIP message (both request and response messages).
显示文件 Open project: richardspiers/C-Sharp-Sip-Lib Class Usage Examples

Public Properties

Property Type Description
StatusCodeType StatusCodes
had_lr bool

Public Methods

Method Description
CreateRequest ( string method, SIPURI uri, Dictionary
headers = null, string content = "" ) : Message

Creates a SIP request message based on the passed in parameters.

CreateResponse ( int responseCode, string responseText, Dictionary
headers = null, string content = "", Message originalRequest = null ) : Message

Creates a SIP response based on the passed in parameters.

Dup ( ) : Message

Creates a clone of this Header object.

First ( string name ) : SIPLib.SIP.Header

Helper function to return the first instance of a particular header.

InsertHeader ( SIPLib.SIP.Header header, string method = "replace" ) : void

Inserts a header into the SIP message by either replacing the existing header, appending it at the end of its own header list, or inserting at the front of its own header list depending on the method specified.

Is1XX ( ) : bool

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)

Is2XX ( ) : bool

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)

Is3XX ( ) : bool

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)

Is4XX ( ) : bool

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)

Is5XX ( ) : bool

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)

Is6XX ( ) : bool

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)

Is7XX ( ) : bool

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)

IsFinal ( ) : bool

Determines whether this instance is final (response code >= 200).

Message ( ) : System

Initializes a new, empty instance of the T:SIPLib.SIP.Message class.

Message ( string value ) : System

Initializes a new instance of the T:SIPLib.SIP.Message class based on a input string.

Parse ( string value ) : void

Parses the input string into a SIP message object.

PopulateMessage ( Message m, Dictionary
headers = null, string content = "" ) : Message

Populates the message - inserts the input list of headers into the message

ToString ( ) : string

Returns a System.String that represents this instance. For easy printing / reading.

Private Methods

Method Description
HandleVia ( List
headers ) : string

Creates the multi line representation of the via header list.

Init ( ) : void

Initilises the Message private variables.

Method Details

CreateRequest() public static method

Creates a SIP request message based on the passed in parameters.
public static CreateRequest ( string method, SIPURI uri, Dictionary
headers = null, string content = "" ) : Message
method string The SIP method to use.
uri SIPURI The destination URI used in the first line.
headers Dictionary
The SIP headers.
content string The SIP body content.
return Message

CreateResponse() public static method

Creates a SIP response based on the passed in parameters.
public static CreateResponse ( int responseCode, string responseText, Dictionary
headers = null, string content = "", Message originalRequest = null ) : Message
responseCode int The response code (200 etc.)
responseText string The response text (OK etc.)
headers Dictionary
The SIP headers.
content string The SIP body content.
originalRequest Message The original request.
return Message

Dup() public method

Creates a clone of this Header object.
public Dup ( ) : Message
return Message

First() public method

Helper function to return the first instance of a particular header.
public First ( string name ) : SIPLib.SIP.Header
name string The name.
return SIPLib.SIP.Header

InsertHeader() public method

Inserts a header into the SIP message by either replacing the existing header, appending it at the end of its own header list, or inserting at the front of its own header list depending on the method specified.
public InsertHeader ( SIPLib.SIP.Header header, string method = "replace" ) : void
header SIPLib.SIP.Header The header to insert.
method string The method - "replace", "append" or "insert". "replace" is the default.
return void

Is1XX() public method

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)
public Is1XX ( ) : bool
return bool

Is2XX() public method

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)
public Is2XX ( ) : bool
return bool

Is3XX() public method

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)
public Is3XX ( ) : bool
return bool

Is4XX() public method

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)
public Is4XX ( ) : bool
return bool

Is5XX() public method

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)
public Is5XX ( ) : bool
return bool

Is6XX() public method

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)
public Is6XX ( ) : bool
return bool

Is7XX() public method

Helper function to indicate type of SIP response message (Informational, Successful, ClientFailure etc.)
public Is7XX ( ) : bool
return bool

IsFinal() public method

Determines whether this instance is final (response code >= 200).
public IsFinal ( ) : bool
return bool

Message() public method

Initializes a new, empty instance of the T:SIPLib.SIP.Message class.
public Message ( ) : System
return System

Message() public method

Initializes a new instance of the T:SIPLib.SIP.Message class based on a input string.
public Message ( string value ) : System
value string The SIP message as a string.
return System

Parse() public method

Parses the input string into a SIP message object.
public Parse ( string value ) : void
value string The value.
return void

PopulateMessage() public static method

Populates the message - inserts the input list of headers into the message
public static PopulateMessage ( Message m, Dictionary
headers = null, string content = "" ) : Message
m Message The message being populated.
headers Dictionary
The headers to insert.
content string The SIP body content.
return Message

ToString() public method

Returns a System.String that represents this instance. For easy printing / reading.
public ToString ( ) : string
return string

Property Details

StatusCodeType public_oe property

The status code type (Informational, Successful, ClientFailure etc.)
public StatusCodes StatusCodeType
return StatusCodes

had_lr public_oe property

Indication of loose routing.
public bool had_lr
return bool