Class SIPRequest
Class for a SIP request message.
Inherited Members
Namespace: SipLib.Core
Assembly: SipLib.dll
Syntax
public class SIPRequest : SIPMessage
Constructors
| Edit this page View SourceSIPRequest(SIPMethodsEnum, SIPURI)
Constructs a SIPRequest object. Use this constructor when creating a new request.
Declaration
public SIPRequest(SIPMethodsEnum method, SIPURI uri)
Parameters
Type | Name | Description |
---|---|---|
SIPMethodsEnum | method | The SIP method for the request. |
SIPURI | uri | The URI to use in the request line. Must be a valid SIPURI. |
SIPRequest(SIPMethodsEnum, string)
Constructs a SIPRequest object. Use this constructor when creating a new request.
Declaration
public SIPRequest(SIPMethodsEnum method, string uri)
Parameters
Type | Name | Description |
---|---|---|
SIPMethodsEnum | method | The SIP method for the request. |
string | uri | The URI to use in the request line. Must be a valid SIP URI. |
Exceptions
Type | Condition |
---|---|
SIPValidationException | Thrown if the input uri string is not a valid SIP URI |
Fields
| Edit this page View SourceMethod
Request method
Declaration
public SIPMethodsEnum Method
Field Value
Type | Description |
---|---|
SIPMethodsEnum |
URI
Request URI
Declaration
public SIPURI? URI
Field Value
Type | Description |
---|---|
SIPURI |
Methods
| Edit this page View SourceCopy()
Creates an identical copy of the SIP Request for the caller. This is a deep copy.
Declaration
public SIPRequest Copy()
Returns
Type | Description |
---|---|
SIPRequest | New copy of the SIPRequest. |
CreateBasicRequest(SIPMethodsEnum, SIPURI, SIPURI, string?, SIPURI, string?)
Creates a new SIPRequest containing all the basic headers: From, To, Via, Contact, Call-ID, Max-Forwards, Content-Length and CSeq.
Declaration
public static SIPRequest CreateBasicRequest(SIPMethodsEnum Method, SIPURI reqUri, SIPURI ToSipUri, string? ToDisplayName, SIPURI FromSipUri, string? FromDisplayName)
Parameters
Type | Name | Description |
---|---|---|
SIPMethodsEnum | Method | SIP method of the request. |
SIPURI | reqUri | Request URI. May be the same as the ToSipUri or it may be different. |
SIPURI | ToSipUri | To URI. |
string | ToDisplayName | Display name for the To header. Optional, may be null. |
SIPURI | FromSipUri | From URI. A From-Tag is automatically created |
string | FromDisplayName | Display name for the From header. Optional, may be null. |
Returns
Type | Description |
---|---|
SIPRequest | Returns a new SIPRequest object. |
GetQueueUri()
Gets the URI of the queue (destination) that the request is addressed to. This is the URI of the topmost Route header if a route set is available, or the request URI (RURI) if there are no Route headers.
Declaration
public string GetQueueUri()
Returns
Type | Description |
---|---|
string | Returns the URI of the destination queue. |
IsValid(out SIPValidationFieldsEnum, out string?)
Determines if this SIPRequest object is vallid
Declaration
public bool IsValid(out SIPValidationFieldsEnum errorField, out string? errorMessage)
Parameters
Type | Name | Description |
---|---|---|
SIPValidationFieldsEnum | errorField | Identifies the header field that is not valid |
string | errorMessage | Explanation of the error. |
Returns
Type | Description |
---|---|
bool | Returns true if the SIPMessage is valid. |
ParseSIPRequest(SIPMessage)
Parses a received SIPMessage object that contains a SIP request message and creates a new SIPRequest object.
Declaration
public static SIPRequest ParseSIPRequest(SIPMessage sipMessage)
Parameters
Type | Name | Description |
---|---|---|
SIPMessage | sipMessage | SIPMessage object to build the SIPRequest from /// |
Returns
Type | Description |
---|---|
SIPRequest | Returns a new SIPRequest object. |
Exceptions
Type | Condition |
---|---|
SIPValidationException | Thrown if the SIP message is not a valid SIP Request |
ParseSIPRequest(string)
Parses a string containing a SIPMessage into a SIPRequest object.
Declaration
public static SIPRequest ParseSIPRequest(string sipMessageStr)
Parameters
Type | Name | Description |
---|---|---|
string | sipMessageStr | String containing a SIPMessage object |
Returns
Type | Description |
---|---|
SIPRequest | Returns a new SIPRequest object. |
Exceptions
Type | Condition |
---|---|
SIPValidationException | Thrown if the SIPMessage is not a valid SIP request. |
ToByteArray()
Converts this message to a byte array using UTF8 encoding.
Declaration
public byte[] ToByteArray()
Returns
Type | Description |
---|---|
byte[] | Returns a UTF-8 encoded byte array |
ToString()
Converts this SIP request to a string.
Declaration
public string ToString()
Returns
Type | Description |
---|---|
string | Returns the string represention of this SIPRequest object |
Exceptions
Type | Condition |
---|---|
Exception | Thrown if an unexpected error occured |