Class SIPMessage
Represents an entire SIP message. This is the base class for the SIPRequest and the SIPResponse classes.
Inherited Members
Namespace: SipLib.Core
Assembly: SipLib.dll
Syntax
public class SIPMessage
Fields
| Edit this page View SourceBody
Contains the entire SIP message body as a string. Set to null if the message does not have a body.
Declaration
public string? Body
Field Value
Type | Description |
---|---|
string |
Header
Contains all headers in the request
Declaration
public SIPHeader Header
Field Value
Type | Description |
---|---|
SIPHeader |
LocalSIPEndPoint
The local SIP socket the message was received on or sent from.
Declaration
public SIPEndPoint? LocalSIPEndPoint
Field Value
Type | Description |
---|---|
SIPEndPoint |
RemoteSIPEndPoint
The remote IP socket the message was received from or sent to.
Declaration
public SIPEndPoint? RemoteSIPEndPoint
Field Value
Type | Description |
---|---|
SIPEndPoint |
SIPMessageType
Identifies the type of SIP message -- i.e. a request or a response.
Declaration
public SIPMessageTypesEnum SIPMessageType
Field Value
Type | Description |
---|---|
SIPMessageTypesEnum |
Properties
| Edit this page View SourceHasBody
Returns true if this message has a body.
Declaration
public bool HasBody { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceGetBodyContents()
Gets a list of all of the contents of the body for this SIPMessage.
Declaration
public List<MessageContentsContainer> GetBodyContents()
Returns
Type | Description |
---|---|
List<MessageContentsContainer> | Returns a list of contents. If the list is empty then there are not body contents. |
GetContentsContainer(string)
Gets the MessageContentsContainer containing the body contents for a specified content type.
Declaration
public MessageContentsContainer? GetContentsContainer(string contentType)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | Specifies the MIME type of the content block to get. For example: "application/sdp". Use the values defined in the ContentTypes class to ensure consistancy. This parameter may be a value taken from a message's Content-Type header but it must not include any header parameters. |
Returns
Type | Description |
---|---|
MessageContentsContainer | Returns a MessageContentsContainer object containing the specified body contents block. Returns null if the specified content type is not found. |
GetContentsOfType(string)
Gets a string containing the body contents for a specified content type. This method only returns non-binary content types.
Declaration
public string? GetContentsOfType(string contentType)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | Specifies the MIME type of the content block to get. For example: "application/sdp". Use the values defined in the ContentTypes class to ensure consistancy. This parameter may be a value taken from a message's Content-Type header but it must not include any header parameters. |
Returns
Type | Description |
---|---|
string | Returns a string that contains the body content block. Returns null if the specified content type is not found or if a parsing error occured. |
ParseSIPMessage(byte[], SIPEndPoint, SIPEndPoint)
Parses a byte array containing a SIP message and returns a SIPMessage object.
Declaration
public static SIPMessage? ParseSIPMessage(byte[] buffer, SIPEndPoint localSIPEndPoint, SIPEndPoint remoteSIPEndPoint)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | Byte array containing the SIP message that was received from the transport layer. |
SIPEndPoint | localSIPEndPoint | The local SIP socket the message was received on or sent from. |
SIPEndPoint | remoteSIPEndPoint | The remote IP socket the message was received from or sent to. |
Returns
Type | Description |
---|---|
SIPMessage | Returns a SIPMessage object if successful. Returns null if the message is not valid. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the SIP message exceeds the maximum allowable length defined in: SIPConstants.SIP_MAXIMUM_RECEIVE_LENGTH. |
Exception | Thrown if an unexpected error occurs. |
ParseSIPMessage(string, SIPEndPoint?, SIPEndPoint?)
Parses a string containing a SIP message and returns a SIPMessage
Declaration
public static SIPMessage? ParseSIPMessage(string message, SIPEndPoint? localSIPEndPoint, SIPEndPoint? remoteSIPEndPoint)
Parameters
Type | Name | Description |
---|---|---|
string | message | Input string that contains the entire SIP message. |
SIPEndPoint | localSIPEndPoint | The local SIP socket the message was received on or sent from. |
SIPEndPoint | remoteSIPEndPoint | The remote IP socket the message was received from or sent to. |
Returns
Type | Description |
---|---|
SIPMessage | Returns a SIPMessage object if successful. Returns null if the message is not valid. |