Class SIPResponse
Represents a SIP Response.
Inherited Members
Namespace: SIPSorcery.SIP
Assembly: SIPSorcery.dll
Syntax
public class SIPResponse : SIPMessageBase
Constructors
| Improve this Doc View SourceSIPResponse(SIPResponseStatusCodesEnum, String)
Declaration
public SIPResponse(SIPResponseStatusCodesEnum responseStatus, string reasonPhrase)
Parameters
Type | Name | Description |
---|---|---|
SIPResponseStatusCodesEnum | responseStatus | |
System.String | reasonPhrase |
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 SourceReasonPhrase
The optional reason phrase for the SIP response.
Declaration
public string ReasonPhrase
Field Value
Type | Description |
---|---|
System.String |
SIPVersion
The version string for the SIP response.
Declaration
public string SIPVersion
Field Value
Type | Description |
---|---|
System.String |
Status
The status of the SIP response, e.g OK or NotAuthorized.
Declaration
public SIPResponseStatusCodesEnum Status
Field Value
Type | Description |
---|---|
SIPResponseStatusCodesEnum |
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 SourceIsSuccessStatusCode
Returns true if a successful status code
Declaration
public bool IsSuccessStatusCode { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
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 SourceCopy()
Creates an identical copy of the SIP Response for the caller.
Declaration
public SIPResponse Copy()
Returns
Type | Description |
---|---|
SIPResponse | New copy of the SIPResponse. |
GetBytes()
Declaration
public byte[] GetBytes()
Returns
Type | Description |
---|---|
System.Byte[] |
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 |
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. |
ParseSIPResponse(SIPMessageBuffer)
Declaration
public static SIPResponse ParseSIPResponse(SIPMessageBuffer sipMessageBuffer)
Parameters
Type | Name | Description |
---|---|---|
SIPMessageBuffer | sipMessageBuffer |
Returns
Type | Description |
---|---|
SIPResponse |
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. |
ParseSIPResponse(String)
Declaration
public static SIPResponse ParseSIPResponse(string sipMessageStr)
Parameters
Type | Name | Description |
---|---|---|
System.String | sipMessageStr |
Returns
Type | Description |
---|---|
SIPResponse |
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. |
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. |
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. |