Class SIPHeader
Class for handling the SIP headers portion of a SIP request or a SIP response message.
Inherited Members
Namespace: SipLib.Core
Assembly: SipLib.dll
Syntax
public class SIPHeader
Remarks
For header fields with string values, a null value indicates that the header field is not present. For header fields with numeric values, a value of -1 indicates that the header field is not present.
Constructors
| Edit this page View SourceSIPHeader()
Default constructor.
Declaration
public SIPHeader()
SIPHeader(SIPContactHeader, SIPFromHeader, SIPToHeader, int, string)
Constructs a new SIPHeader object.
Declaration
public SIPHeader(SIPContactHeader contact, SIPFromHeader from, SIPToHeader to, int cseq, string callId)
Parameters
Type | Name | Description |
---|---|---|
SIPContactHeader | contact | SIPContact object |
SIPFromHeader | from | SIPFromHeader object |
SIPToHeader | to | SIPToHeader object |
int | cseq | Numeric portion of the CSeq header field |
string | callId | Call-ID header field value |
Exceptions
Type | Condition |
---|---|
ApplicationException | Thrown if the from, to or callId parameters are null or empty. |
SIPHeader(SIPFromHeader, SIPToHeader, int, string)
Constructs a new SIPHeader object.
Declaration
public SIPHeader(SIPFromHeader from, SIPToHeader to, int cseq, string callId)
Parameters
Type | Name | Description |
---|---|---|
SIPFromHeader | from | SIPFromHeader object |
SIPToHeader | to | SIPToHeader object |
int | cseq | Numeric portion of the CSeq header field |
string | callId | Call-ID header field value |
Exceptions
Type | Condition |
---|---|
ApplicationException | Thrown if the from, to or callId parameters are null or empty. |
SIPHeader(List<SIPContactHeader>, SIPFromHeader, SIPToHeader, int, string)
Constructs a new SIPHeader object
Declaration
public SIPHeader(List<SIPContactHeader> contactList, SIPFromHeader from, SIPToHeader to, int cseq, string callId)
Parameters
Type | Name | Description |
---|---|---|
List<SIPContactHeader> | contactList | List of SIPContactHeader objects |
SIPFromHeader | from | SIPFromHeader object |
SIPToHeader | to | SIPToHeader object |
int | cseq | Numeric portion of the CSeq header field |
string | callId | Call-ID header field value |
Exceptions
Type | Condition |
---|---|
ApplicationException | Thrown if the from, to or callId parameters are null or empty. |
SIPHeader(string, string, int, string)
Constructs a new SIPHeader object.
Declaration
public SIPHeader(string fromHeader, string toHeader, int cseq, string callId)
Parameters
Type | Name | Description |
---|---|---|
string | fromHeader | From header field value. |
string | toHeader | To header field value. |
int | cseq | CSeq header field value. |
string | callId | Call-ID header field value. |
Exceptions
Type | Condition |
---|---|
ApplicationException | Thrown if the fromHeader, toHeader or callId parameters are null or empty. |
SIPHeader(string, string, string, int, string)
Constructs a new SIPHeader object.
Declaration
public SIPHeader(string fromHeader, string toHeader, string contactHeader, int cseq, string callId)
Parameters
Type | Name | Description |
---|---|---|
string | fromHeader | From header field value. |
string | toHeader | To header field value. |
string | contactHeader | Contact header field value |
int | cseq | CSeq header field value. |
string | callId | Call-ID header field value. |
Exceptions
Type | Condition |
---|---|
ApplicationException | Thrown if the fromHeader, toHeader or callId parameters are null or empty. |
Fields
| Edit this page View SourceAccept
Accept header field. See Section 20.1 of RFC 3261.
Declaration
public string? Accept
Field Value
Type | Description |
---|---|
string |
AcceptEncoding
Accept-Encoding header field. See Section 20.2 of RFC 3261.
Declaration
public string? AcceptEncoding
Field Value
Type | Description |
---|---|
string |
AcceptLanguage
Accept-Language header field. See Section 20.3 of RFC 3261.
Declaration
public string? AcceptLanguage
Field Value
Type | Description |
---|---|
string |
AlertInfo
Alert-Info header field. See Section 20.4 of RFC 3261.
Declaration
public string? AlertInfo
Field Value
Type | Description |
---|---|
string |
Allow
Allow header field. See Section 20.5 of RFC 3261.
Declaration
public string? Allow
Field Value
Type | Description |
---|---|
string |
AllowEvents
Allow-Events header field. The Allow header field lists the set of methods supported by the UA generating the message. See Section 3.3.7 of RFC 3265.
Declaration
public string? AllowEvents
Field Value
Type | Description |
---|---|
string |
AuthenticationHeader
WWW-Authenticate header field. See Section 20.44 of RFC 3261.
Declaration
public SIPAuthenticationHeader? AuthenticationHeader
Field Value
Type | Description |
---|---|
SIPAuthenticationHeader |
AuthenticationInfo
Authentication-Info header field. See Section 20.6 of RFC 3261
Declaration
public string? AuthenticationInfo
Field Value
Type | Description |
---|---|
string |
CSeq
Specifies the numeric portion of the CSeq header field. See Section 20.16 of RFC 3261. A value of -1 indicates that there is no CSeq field.
Declaration
public int CSeq
Field Value
Type | Description |
---|---|
int |
CSeqMethod
Specifies the method portion of the CSeq header field. See Section 20.16 of RFC 3261.
Declaration
public SIPMethodsEnum CSeqMethod
Field Value
Type | Description |
---|---|
SIPMethodsEnum |
CallId
Call-ID header field. See Section 20.8 of RFC 3261.
Declaration
public string CallId
Field Value
Type | Description |
---|---|
string |
CallInfo
Call-Info header field. See Section 20.9 of RFC 3261. An empty list indicates that there are no Call-Info header fields.
Declaration
public List<SIPCallInfoHeader> CallInfo
Field Value
Type | Description |
---|---|
List<SIPCallInfoHeader> |
Contact
Contact header field. See Section 20.10 of RFC 3261. An empty list indicates that there are no Contact header fiels.
Declaration
public List<SIPContactHeader>? Contact
Field Value
Type | Description |
---|---|
List<SIPContactHeader> |
ContentDisposition
Content-Disposition header field. See Section 20.11 of RFC 3261.
Declaration
public string? ContentDisposition
Field Value
Type | Description |
---|---|
string |
ContentEncoding
Content-Encoding header field. See Section 20.12 of RFC 3261.
Declaration
public string? ContentEncoding
Field Value
Type | Description |
---|---|
string |
ContentLanguage
Content-Language header field. See Section 20.13 of RFC 3261.
Declaration
public string? ContentLanguage
Field Value
Type | Description |
---|---|
string |
ContentLength
Content-Length header field. See Section 20.14 of RFC 3261.
Declaration
public int ContentLength
Field Value
Type | Description |
---|---|
int |
ContentType
Content-Type header field. See Section 20.15 of RFC 3261.
Declaration
public string? ContentType
Field Value
Type | Description |
---|---|
string |
Date
Date header field. See Section 20.17 of RFC 3261.
Declaration
public string? Date
Field Value
Type | Description |
---|---|
string |
ErrorInfo
Error-Info header field. See Section 20.18 of RFC 3261.
Declaration
public string? ErrorInfo
Field Value
Type | Description |
---|---|
string |
Event
Event header field. See RFC 3265 and RFC 6665.
Declaration
public string? Event
Field Value
Type | Description |
---|---|
string |
Expires
Expires header field. See Section 20.19 of RFC 3261.
Declaration
public int Expires
Field Value
Type | Description |
---|---|
int |
From
From header field. See Section 20.20 of RFC 3261.
Declaration
public SIPFromHeader? From
Field Value
Type | Description |
---|---|
SIPFromHeader |
Geolocation
Contains the header field values of 1 or more Geolocation headers as defined in RFC 6442. An empty list indicates that no Geolocation headers are present.
Declaration
public List<SIPGeolocationHeader> Geolocation
Field Value
Type | Description |
---|---|
List<SIPGeolocationHeader> |
GeolocationError
Contains the header value of a Geolocation-Error header as defined in RFC 6442. The value is numeric code between 1 and 3 digits long.
Declaration
public string? GeolocationError
Field Value
Type | Description |
---|---|
string |
GeolocationRouting
Contains the header value of a Geolocation-Routing header as defined in RFC 6442. The header value may be either yes or no.
Declaration
public string? GeolocationRouting
Field Value
Type | Description |
---|---|
string |
InReplyTo
In-Reply-To header field. See Section 20.21 of RFC 3261.
Declaration
public string? InReplyTo
Field Value
Type | Description |
---|---|
string |
MIMEVersion
MIME-Version header field. See Section 20.24 of RFC 3261.
Declaration
public string? MIMEVersion
Field Value
Type | Description |
---|---|
string |
MaxForwards
Max-Forwards header field. See Section 20.22 of RFC 3261.
Declaration
public int MaxForwards
Field Value
Type | Description |
---|---|
int |
MinExpires
Min-Expires header field. See Section 20.23 of RFC 3261.
Declaration
public int MinExpires
Field Value
Type | Description |
---|---|
int |
Organization
Organization header field. See Section 20.25 of RFC 3261.
Declaration
public string? Organization
Field Value
Type | Description |
---|---|
string |
PAssertedIdentity
P-Asserted-Identity header field. See RFC 3325.
Declaration
public SIPPaiHeader? PAssertedIdentity
Field Value
Type | Description |
---|---|
SIPPaiHeader |
PPreferredIdentity
P-Preferred-Identity header field. See RFC 3325.
Declaration
public SIPPpiHeader? PPreferredIdentity
Field Value
Type | Description |
---|---|
SIPPpiHeader |
Priority
Priority header field. See Section 20.26 of RFC 3261.
Declaration
public string? Priority
Field Value
Type | Description |
---|---|
string |
ProxyRequire
Proxy-Require header field. See Section 20.29 of RFC 3261.
Declaration
public string? ProxyRequire
Field Value
Type | Description |
---|---|
string |
Reason
Reason header field. See RFC 3326.
Declaration
public string? Reason
Field Value
Type | Description |
---|---|
string |
RecordRoutes
Record-Route header field. See Section 20.30 of RFC 3261.
Declaration
public SIPRouteSet RecordRoutes
Field Value
Type | Description |
---|---|
SIPRouteSet |
ReferSub
Refer-Sub header field. See RFC 4488. If set to false indicates the implict REFER subscription should not be created.
Declaration
public string? ReferSub
Field Value
Type | Description |
---|---|
string |
ReferTo
Refer-To header field. See RFC 3515.
Declaration
public string? ReferTo
Field Value
Type | Description |
---|---|
string |
ReferredBy
The Referred-By header field. See RFC 3515.
Declaration
public string? ReferredBy
Field Value
Type | Description |
---|---|
string |
ReplyTo
Reply-To header field. See Section 20.31 of RFC 3261.
Declaration
public string? ReplyTo
Field Value
Type | Description |
---|---|
string |
Require
Require header field. See Section 20.32 of RFC 3261.
Declaration
public string? Require
Field Value
Type | Description |
---|---|
string |
ResourcePriority
Resource-Priority header field. See RFC 4412.
Declaration
public string? ResourcePriority
Field Value
Type | Description |
---|---|
string |
RetryAfter
Retry-After header field. See Section 20.33 of RFC 3261.
Declaration
public string? RetryAfter
Field Value
Type | Description |
---|---|
string |
Routes
Route header field. See Section 20.34 of RFC 3261.
Declaration
public SIPRouteSet Routes
Field Value
Type | Description |
---|---|
SIPRouteSet |
Server
Server header field. See Section 20.35 of RFC 3261.
Declaration
public string? Server
Field Value
Type | Description |
---|---|
string |
Subject
Subject header field. See Section 20.36 of RFC 3261.
Declaration
public string? Subject
Field Value
Type | Description |
---|---|
string |
SubscriptionState
Subscription-State header field. See RFC 3265 and RFC 6665.
Declaration
public string? SubscriptionState
Field Value
Type | Description |
---|---|
string |
Supported
Supported header field. See Section 20.37 of RFC 3261.
Declaration
public string? Supported
Field Value
Type | Description |
---|---|
string |
Timestamp
Timestamp header field. See Section 20.38 of RFC 3261.
Declaration
public string? Timestamp
Field Value
Type | Description |
---|---|
string |
To
To header field. See Section 20.39 of RFC 3261.
Declaration
public SIPToHeader? To
Field Value
Type | Description |
---|---|
SIPToHeader |
UnknownHeaders
Holds any unrecognized headers. Each item in the list is the original header line.
Declaration
public List<string> UnknownHeaders
Field Value
Type | Description |
---|---|
List<string> |
Unsupported
Unsupported header field. See Section 20.40 of RFC 3261.
Declaration
public string? Unsupported
Field Value
Type | Description |
---|---|
string |
UserAgent
User-Agent header field. See Section 20.41 of RFC 3261.
Declaration
public string? UserAgent
Field Value
Type | Description |
---|---|
string |
Vias
Via header field. See Section 20.42 of RFC 3261.
Declaration
public SIPViaSet Vias
Field Value
Type | Description |
---|---|
SIPViaSet |
Warning
Warning header field. See Section 20.43 of RFC 3261.
Declaration
public string? Warning
Field Value
Type | Description |
---|---|
string |
Methods
| Edit this page View SourceCopy()
Creates a deep copy of this SIPHeader object.
Declaration
public SIPHeader Copy()
Returns
Type | Description |
---|---|
SIPHeader |
GetUnknownHeaderValue(string)
Unknown SIP headers are put into the UnknownHeaders member of this object by the ParseSIPHeaders() function. Each string is this string array contains the whole header line (for example: UnknownHeader: value). This function retrieves the entire header line given the input header name.
Declaration
public string? GetUnknownHeaderValue(string unknownHeaderName)
Parameters
Type | Name | Description |
---|---|---|
string | unknownHeaderName | Name of the unknown SIP Header |
Returns
Type | Description |
---|---|
string | Returns null if the header is not found or the complete header line if it exists. |
Remarks
This function assumes that there will be only a single header line for a given header name.
ParseSIPHeaders(string[])
Parses an array of header lines and creates a new SIPHeader object.
Declaration
public static SIPHeader ParseSIPHeaders(string[] headersCollection)
Parameters
Type | Name | Description |
---|---|---|
string[] | headersCollection | Each line contains a single SIP header. |
Returns
Type | Description |
---|---|
SIPHeader | Returns a new SIPHeader object |
Exceptions
Type | Condition |
---|---|
SIPValidationException | Thrown if unable to parse the header fields due to invalid SIP formatting or illegal values. |
Exception | Thrown if an unknown error occurs. |
SetDateHeader()
Sets the Date header field to the current time.
Declaration
public void SetDateHeader()
SplitHeaders(string)
Splits a string containing the header portion of a SIP message into an array of strings. Handles header field folding.
Declaration
public static string[] SplitHeaders(string message)
Parameters
Type | Name | Description |
---|---|---|
string | message |
Returns
Type | Description |
---|---|
string[] | Each string contains a header line |
ToString()
Puts the SIP headers together into a string ready for transmission.
Declaration
public string ToString()
Returns
Type | Description |
---|---|
string | String representing the SIP headers. |