Show / Hide Table of Contents

Class SIPResponse

Represents a SIP Response.

Inheritance
System.Object
SIPMessageBase
SIPResponse
Inherited Members
SIPMessageBase.logger
SIPMessageBase.m_CRLF
SIPMessageBase.m_sipFullVersion
SIPMessageBase.m_allowedSIPMethods
SIPMessageBase._body
SIPMessageBase.SIPEncoding
SIPMessageBase.SIPBodyEncoding
SIPMessageBase.Header
SIPMessageBase.Body
SIPMessageBase.BodyBuffer
SIPMessageBase.Created
SIPMessageBase.RemoteSIPEndPoint
SIPMessageBase.LocalSIPEndPoint
SIPMessageBase.SendFromHintChannelID
SIPMessageBase.SendFromHintConnectionID
SIPMessageBase.GetBytes(String)
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)
Namespace: SIPSorcery.SIP
Assembly: SIPSorcery.dll
Syntax
public class SIPResponse : SIPMessageBase

Constructors

| Improve this Doc View Source

SIPResponse(SIPResponseStatusCodesEnum, String)

Declaration
public SIPResponse(SIPResponseStatusCodesEnum responseStatus, string reasonPhrase)
Parameters
Type Name Description
SIPResponseStatusCodesEnum responseStatus
System.String reasonPhrase
| Improve this Doc View Source

SIPResponse(SIPResponseStatusCodesEnum, String, Encoding, Encoding)

SIPResponse Constructor.

Declaration
public SIPResponse(SIPResponseStatusCodesEnum responseStatus, string reasonPhrase, Encoding sipEncoding, Encoding sipBodyEncoding)
Parameters
Type Name Description
SIPResponseStatusCodesEnum responseStatus

The status code for the response.

System.String reasonPhrase

Optional description for the response. Should be kept short.

System.Text.Encoding sipEncoding
System.Text.Encoding sipBodyEncoding

Fields

| Improve this Doc View Source

ReasonPhrase

The optional reason phrase for the SIP response.

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

SIPVersion

The version string for the SIP response.

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

Status

The status of the SIP response, e.g OK or NotAuthorized.

Declaration
public SIPResponseStatusCodesEnum Status
Field Value
Type Description
SIPResponseStatusCodesEnum
| Improve this Doc View Source

StatusCode

The status code of the SIP response, e.g. 200 for an OK response.

Declaration
public int StatusCode
Field Value
Type Description
System.Int32

Properties

| Improve this Doc View Source

IsSuccessStatusCode

Returns true if a successful status code

Declaration
public bool IsSuccessStatusCode { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

ShortDescription

A short one line summary of the SIP response. Useful for logging or diagnostics.

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

Methods

| Improve this Doc View Source

Copy()

Creates an identical copy of the SIP Response for the caller.

Declaration
public SIPResponse Copy()
Returns
Type Description
SIPResponse

New copy of the SIPResponse.

| Improve this Doc View Source

GetBytes()

Declaration
public byte[] GetBytes()
Returns
Type Description
System.Byte[]
| Improve this Doc View Source

GetResponse(SIPEndPoint, SIPEndPoint, SIPResponseStatusCodesEnum, String)

Used to create a SIP response for a request when it was not possible to parse the incoming SIP request. The response generated by this method may or may not make it back to the requester. Because the SIP request could not be parsed there are no Via headers available and without those the return network path is missing. Instead a new Via header is generated that may get through if the requester is only one SIP hop away.

Declaration
public static SIPResponse GetResponse(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteSIPEndPoint, SIPResponseStatusCodesEnum responseCode, string reasonPhrase)
Parameters
Type Name Description
SIPEndPoint localSIPEndPoint

The local SIP end point the request was received on.

SIPEndPoint remoteSIPEndPoint

The remote SIP end point the request was received on.

SIPResponseStatusCodesEnum responseCode

The response code to set on the response.

System.String reasonPhrase

Optional reason phrase to set on the response (keep short).

Returns
Type Description
SIPResponse
| Improve this Doc View Source

GetResponse(SIPRequest, SIPResponseStatusCodesEnum, String)

Helper method to create a SIP response for a SIP request. This method can be thought of as creating a vanilla (or no frills) response for a request. It's suitable for generating error responses. For requests that require an action such as creating a call or registering a contact the response will require additional information and this method will not be suitable.

Declaration
public static SIPResponse GetResponse(SIPRequest sipRequest, SIPResponseStatusCodesEnum responseCode, string reasonPhrase)
Parameters
Type Name Description
SIPRequest sipRequest

The SIP request to create the response for.

SIPResponseStatusCodesEnum responseCode

The response code.

System.String reasonPhrase

Optional reason phrase to set on the response (needs to be short).

Returns
Type Description
SIPResponse

A SIP response object.

| Improve this Doc View Source

ParseSIPResponse(SIPMessageBuffer)

Declaration
public static SIPResponse ParseSIPResponse(SIPMessageBuffer sipMessageBuffer)
Parameters
Type Name Description
SIPMessageBuffer sipMessageBuffer
Returns
Type Description
SIPResponse
| Improve this Doc View Source

ParseSIPResponse(SIPMessageBuffer, Encoding, Encoding)

Parses a SIP response from a SIP message object.

Declaration
public static SIPResponse ParseSIPResponse(SIPMessageBuffer sipMessageBuffer, Encoding sipEncoding, Encoding sipBodyEncoding)
Parameters
Type Name Description
SIPMessageBuffer sipMessageBuffer

The SIP message to parse a response from.

System.Text.Encoding sipEncoding
System.Text.Encoding sipBodyEncoding
Returns
Type Description
SIPResponse

A new SIP response object.

| Improve this Doc View Source

ParseSIPResponse(String)

Declaration
public static SIPResponse ParseSIPResponse(string sipMessageStr)
Parameters
Type Name Description
System.String sipMessageStr
Returns
Type Description
SIPResponse
| Improve this Doc View Source

ParseSIPResponse(String, Encoding, Encoding)

Parses a SIP response from a string.

Declaration
public static SIPResponse ParseSIPResponse(string sipMessageStr, Encoding sipEncoding, Encoding sipBodyEncoding)
Parameters
Type Name Description
System.String sipMessageStr

The string to parse the SIP response from.

System.Text.Encoding sipEncoding
System.Text.Encoding sipBodyEncoding
Returns
Type Description
SIPResponse

A new SIP response object.

| Improve this Doc View Source

SetSendFromHints(SIPEndPoint)

Sets the send from hints for this response based on a local SIP end point. The local SIP end point should generally be the one a related request or response was received on.

Declaration
public void SetSendFromHints(SIPEndPoint localEndPoint)
Parameters
Type Name Description
SIPEndPoint localEndPoint

The SIP end point to base the send from hints on.

| Improve this Doc View Source

ToString()

Returns a string representing the full SIP response.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation of the SIP response.

Overrides
System.Object.ToString()

Extension Methods

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