Show / Hide Table of Contents

Class SIPMessageBuffer

Represents an incoming message before having determined whether it is a request or a response.

Inheritance
System.Object
SIPMessageBuffer
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.SIP
Assembly: SIPSorcery.dll
Syntax
public class SIPMessageBuffer

Constructors

| Improve this Doc View Source

SIPMessageBuffer(Encoding, Encoding)

Declaration
public SIPMessageBuffer(Encoding sipEncoding, Encoding sipBodyEncoding)
Parameters
Type Name Description
System.Text.Encoding sipEncoding
System.Text.Encoding sipBodyEncoding

Fields

| Improve this Doc View Source

Body

Declaration
public byte[] Body
Field Value
Type Description
System.Byte[]
| Improve this Doc View Source

Created

Declaration
public DateTime Created
Field Value
Type Description
System.DateTime
| Improve this Doc View Source

FirstLine

Declaration
public string FirstLine
Field Value
Type Description
System.String
| Improve this Doc View Source

LocalSIPEndPoint

Declaration
public SIPEndPoint LocalSIPEndPoint
Field Value
Type Description
SIPEndPoint
| Improve this Doc View Source

RawBuffer

Declaration
public byte[] RawBuffer
Field Value
Type Description
System.Byte[]
| Improve this Doc View Source

RemoteSIPEndPoint

Declaration
public SIPEndPoint RemoteSIPEndPoint
Field Value
Type Description
SIPEndPoint
| Improve this Doc View Source

SIPBodyEncoding

Declaration
public readonly Encoding SIPBodyEncoding
Field Value
Type Description
System.Text.Encoding
| Improve this Doc View Source

SIPEncoding

Declaration
public readonly Encoding SIPEncoding
Field Value
Type Description
System.Text.Encoding
| Improve this Doc View Source

SIPHeaders

Declaration
public string[] SIPHeaders
Field Value
Type Description
System.String[]
| Improve this Doc View Source

SIPMessageType

Declaration
public SIPMessageTypesEnum SIPMessageType
Field Value
Type Description
SIPMessageTypesEnum

Properties

| Improve this Doc View Source

RawMessage

Declaration
public string RawMessage { get; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

GetContentLength(Byte[], Int32, Int32)

Declaration
public static int GetContentLength(byte[] buffer, int start, int end)
Parameters
Type Name Description
System.Byte[] buffer
System.Int32 start
System.Int32 end
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetContentLength(Byte[], Int32, Int32, Encoding)

Attempts to find the Content-Length header is a SIP header and extract it.

Declaration
public static int GetContentLength(byte[] buffer, int start, int end, Encoding sipEncoding)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to search in.

System.Int32 start

The position in the buffer to start the search from.

System.Int32 end

The position in the buffer to stop the search at.

System.Text.Encoding sipEncoding
Returns
Type Description
System.Int32

If the Content-Length header is found the value if contains otherwise 0.

| Improve this Doc View Source

IsPing(Byte[])

Declaration
public static bool IsPing(byte[] buffer)
Parameters
Type Name Description
System.Byte[] buffer
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ParseSIPMessage(Byte[], SIPEndPoint, SIPEndPoint)

Declaration
public static SIPMessageBuffer ParseSIPMessage(byte[] buffer, SIPEndPoint localSIPEndPoint, SIPEndPoint remoteSIPEndPoint)
Parameters
Type Name Description
System.Byte[] buffer
SIPEndPoint localSIPEndPoint
SIPEndPoint remoteSIPEndPoint
Returns
Type Description
SIPMessageBuffer
| Improve this Doc View Source

ParseSIPMessage(Byte[], Encoding, Encoding, SIPEndPoint, SIPEndPoint)

Attempts to parse a SIP message from a single buffer that can only contain a single message.

Declaration
public static SIPMessageBuffer ParseSIPMessage(byte[] buffer, Encoding sipEncoding, Encoding sipBodyEncoding, SIPEndPoint localSIPEndPoint, SIPEndPoint remoteSIPEndPoint)
Parameters
Type Name Description
System.Byte[] buffer

The buffer that will be parsed for a SIP message.

System.Text.Encoding sipEncoding

SIP protocol encoding, according to RFC should be UTF-8

System.Text.Encoding sipBodyEncoding

SIP payload encoding

SIPEndPoint localSIPEndPoint

The end point the message was received on.

SIPEndPoint remoteSIPEndPoint

The end point the message was received from.

Returns
Type Description
SIPMessageBuffer

If successful a SIP message or null if not.

| Improve this Doc View Source

ParseSIPMessage(String, SIPEndPoint, SIPEndPoint)

Declaration
public static SIPMessageBuffer ParseSIPMessage(string message, SIPEndPoint localSIPEndPoint, SIPEndPoint remoteSIPEndPoint)
Parameters
Type Name Description
System.String message
SIPEndPoint localSIPEndPoint
SIPEndPoint remoteSIPEndPoint
Returns
Type Description
SIPMessageBuffer
| Improve this Doc View Source

ParseSIPMessage(String, Encoding, Encoding, SIPEndPoint, SIPEndPoint)

Attempts to parse a SIP message from a string containing a single SIP request or response.

Declaration
public static SIPMessageBuffer ParseSIPMessage(string message, Encoding sipEncoding, Encoding sipBodyEncoding, SIPEndPoint localSIPEndPoint, SIPEndPoint remoteSIPEndPoint)
Parameters
Type Name Description
System.String message

The string to parse.

System.Text.Encoding sipEncoding
System.Text.Encoding sipBodyEncoding
SIPEndPoint localSIPEndPoint

The end point the message was received on.

SIPEndPoint remoteSIPEndPoint

The end point the message was received from.

Returns
Type Description
SIPMessageBuffer

If successful a SIP message or null if not.

| Improve this Doc View Source

ParseSIPMessageFromStream(Byte[], Int32, Int32, out Int32)

Declaration
public static byte[] ParseSIPMessageFromStream(byte[] receiveBuffer, int start, int length, out int bytesSkipped)
Parameters
Type Name Description
System.Byte[] receiveBuffer
System.Int32 start
System.Int32 length
System.Int32 bytesSkipped
Returns
Type Description
System.Byte[]
| Improve this Doc View Source

ParseSIPMessageFromStream(Byte[], Int32, Int32, Encoding, out Int32)

Processes a buffer from a TCP read operation to extract the first full SIP message. If no full SIP messages are available it returns null which indicates the next read should be appended to the current buffer and the process re-attempted.

Declaration
public static byte[] ParseSIPMessageFromStream(byte[] receiveBuffer, int start, int length, Encoding sipEncoding, out int bytesSkipped)
Parameters
Type Name Description
System.Byte[] receiveBuffer

The buffer to check for the SIP message in.

System.Int32 start

The position in the buffer to start parsing for a SIP message.

System.Int32 length

The position in the buffer that indicates the end of the received bytes.

System.Text.Encoding sipEncoding
System.Int32 bytesSkipped
Returns
Type Description
System.Byte[]

A byte array holding a full SIP message or if no full SIP messages are available null.

Extension Methods

JSONWriter.ToJson(Object)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX