sipxtacklib
Version 3.3
|
Class for containing SIP dialog state information. More...
#include <SipDialog.h>
Public Types | |
enum | DialogState { DIALOG_UNKNOWN, DIALOG_EARLY, DIALOG_ESTABLISHED, DIALOG_FAILED, DIALOG_TERMINATED } |
Public Member Functions | |
SipDialog (const SipMessage *initialMessage=NULL, UtlBoolean isFromLocal=TRUE) | |
Default Dialog constructor. More... | |
SipDialog (const char *callId, const char *localField, const char *remoteField) | |
Constructor accepting the basic pieces of a session callId, toUrl, and from Url. More... | |
virtual | ~SipDialog () |
Destructor. More... | |
void | updateDialogData (const SipMessage &message) |
update the dialog information based upon the given message More... | |
void | setRequestData (SipMessage &request, const char *method) |
Set fields in next SIP request for this dialog. More... | |
void | getHandle (UtlString &dialogHandle) const |
Gets a string handle that can be used to uniquely identify this dialog. More... | |
void | getEarlyHandle (UtlString &earlyDialogHandle) const |
Get the early dialog handle for this dialog. More... | |
void | getCallId (UtlString &callId) const |
Get the SIP call-id header value for this dialog. More... | |
void | setCallId (const char *callId) |
Set the SIP call-id header value for this dialog. More... | |
void | getLocalField (Url &localUrl) const |
Get the SIP To/From header value for the local side of this dialog. More... | |
void | getLocalTag (UtlString &localTag) const |
Get the tag from the SIP To/From header value for the local side of this dialog. More... | |
void | setLocalField (const Url &localUrl) |
Set the SIP To/From header value for the local side of this dialog. More... | |
void | getRemoteField (Url &remoteUrl) const |
Get the SIP To/From header value for the remote side of this dialog. More... | |
void | getRemoteTag (UtlString &remoteTag) const |
Get the tag from the SIP To/From header value for the remote side of this dialog. More... | |
void | setRemoteField (const Url &remoteUrl) |
Set the SIP To/From header value for the remote side of this dialog. More... | |
void | getRemoteContact (Url &remoteContact) const |
Get the SIP Contact header value for the remote side of this dialog. More... | |
void | setRemoteContact (const Url &remoteContact) |
Set the SIP Contact header value for the remote side of this dialog. More... | |
void | getLocalContact (Url &localContact) const |
Get the SIP Contact header value for the local side of this dialog. More... | |
void | setLocalContact (const Url &localContact) |
Get the SIP Contact header value for the remote side of this dialog. More... | |
void | getInitialMethod (UtlString &method) const |
Get the SIP method of the request that initiated this dialog. More... | |
void | setInitialMethod (const char *method) |
Set the SIP method of the request that initiated this dialog. More... | |
int | getNextLocalCseq () |
Get the next (incremented) SIP Cseq number for the local side. More... | |
int | getLastLocalCseq () const |
Get the last used SIP Cseq number for the local side. More... | |
void | setLastLocalCseq (int seqNum) |
Set the last used SIP Cseq number for the local side. More... | |
int | getLastRemoteCseq () const |
Get the last used SIP Cseq number for the remote side. More... | |
void | setLastRemoteCseq (int seqNum) |
Set the last used SIP Cseq number for the remote side. More... | |
void | getLocalRequestUri (UtlString &requestUri) const |
Get the request URI for the local side. More... | |
void | setLocalRequestUri (const UtlString &requestUri) |
Set the request URI for the local side. More... | |
void | getRemoteRequestUri (UtlString &requestUri) const |
Get the request URI for the remote side. More... | |
void | setRemoteRequestUri (const UtlString &requestUri) |
Set the request URI for the remote side. More... | |
void | toString (UtlString &dialogDumpString) |
Debug method to dump the contents of this SipDialog into a string. More... | |
UtlBoolean | isSameDialog (const SipMessage &message) const |
Compare the message to see if it matches this dialog. More... | |
UtlBoolean | isSameDialog (const UtlString &callId, const UtlString &localTag, const UtlString &remoteTag) const |
Compare the given dialog indentifiers match those of this dialog. More... | |
UtlBoolean | isSameDialog (const char *dialogHandle) |
Compare the given dialog handle with that of this dialog. More... | |
UtlBoolean | isEarlyDialog () const |
Determine if this is an early dialog. More... | |
UtlBoolean | isEarlyDialogFor (const SipMessage &message) const |
Checks if this is an early dialog for the given SIP message. More... | |
UtlBoolean | isEarlyDialogFor (const UtlString &callId, const UtlString &localTag, const UtlString &remoteTag) const |
Checks if this is an early dialog for the given SIP message. More... | |
UtlBoolean | wasEarlyDialogFor (const SipMessage &message) const |
Checks if this was an early dialog for the given SIP message. More... | |
UtlBoolean | wasEarlyDialogFor (const UtlString &callId, const UtlString &localTag, const UtlString &remoteTag) const |
Checks if this was an early dialog for the given SIP message. More... | |
UtlBoolean | isTransactionLocallyInitiated (const UtlString &callId, const UtlString &fromTag, const UtlString &toTag) const |
Query if the transaction request was sent from the local side. More... | |
UtlBoolean | isTransactionRemotelyInitiated (const UtlString &callId, const UtlString &fromTag, const UtlString &toTag) const |
Query if the transaction request was sent from the remote side. More... | |
UtlBoolean | isSameLocalCseq (const SipMessage &message) const |
Check if message and SIP local Cseq match. More... | |
UtlBoolean | isSameRemoteCseq (const SipMessage &message) const |
Check if message and SIP remote Cseq match. More... | |
UtlBoolean | isNextLocalCseq (const SipMessage &message) const |
Check if mesage cseq is after the last local transaction. More... | |
UtlBoolean | isNextRemoteCseq (const SipMessage &message) const |
Check if mesage cseq is after the last remote transaction. More... | |
Static Public Member Functions | |
static void | parseHandle (const char *dialogHandle, UtlString &callId, UtlString &localTag, UtlString &remoteTag) |
Gets the call-id, and tags from the dialogHandle. More... | |
static void | reverseTags (const char *dialogHandle, UtlString &reversedHandle) |
Reverse the order of the tags in the handle. More... | |
static void | getStateString (DialogState state, UtlString &stateString) |
Get a string representation for the state value. More... | |
static UtlBoolean | isEarlyDialog (const char *dialogHandle) |
Determine if the given handle is for an early dialog. More... | |
Class for containing SIP dialog state information.
In SIP a dialog is defined by the SIP Call-Id header and the tag parameter from the SIP To and From header fields. An early dialog has has only the tag set on one side, the transaction originator side. In the initial transaction the the originator tag in in the From header field. The final destination sets the To header field tag in the initial transaction.
This class is intended to depricate the SipSession class.
enum DialogState |
SipDialog | ( | const SipMessage * | initialMessage = NULL , |
UtlBoolean | isFromLocal = TRUE |
||
) |
Default Dialog constructor.
Optionally construct a dialog from the given message
initialMessage | - message to initiate the dialog, typically this is a request. |
isFromLocal | - The message was sent from this side of the transaction. When the SipDialog is used in a proxy context, local and remote is not obvious. A way to think about it in a proxy scenario is to think of local to be the left side and remote to be the right side of the transaction. |
SipDialog | ( | const char * | callId, |
const char * | localField, | ||
const char * | remoteField | ||
) |
Constructor accepting the basic pieces of a session callId, toUrl, and from Url.
Optionally construct a dialog from the given message
callId | - sip message call-id header value |
localField | - sip message To or From field value representing the local side of the dialog. |
remoteField | - sip message To or From field value representing the remote side of the dialog. |
|
virtual |
Destructor.
void updateDialogData | ( | const SipMessage & | message | ) |
update the dialog information based upon the given message
Typically this updates things like the Contact, CSeq headers and tag information for the dialog.
message | - SIP message which is assumed to be part of this dialog. |
void setRequestData | ( | SipMessage & | request, |
const char * | method | ||
) |
Set fields in next SIP request for this dialog.
Set the request URI, call-id, To, From, Route and Cseq headers fields for the given request to be sent in the given dialog. The last local cseq of the dialog is incremented and set in the request.
method | - the sip request method for this request. |
request | - the request which is to be part of this dialog and sent as orginating from the local side of the dialog. |
void getHandle | ( | UtlString & | dialogHandle | ) | const |
Gets a string handle that can be used to uniquely identify this dialog.
void getEarlyHandle | ( | UtlString & | earlyDialogHandle | ) | const |
Get the early dialog handle for this dialog.
|
static |
Gets the call-id, and tags from the dialogHandle.
|
static |
Reverse the order of the tags in the handle.
void getCallId | ( | UtlString & | callId | ) | const |
Get the SIP call-id header value for this dialog.
void setCallId | ( | const char * | callId | ) |
Set the SIP call-id header value for this dialog.
void getLocalField | ( | Url & | localUrl | ) | const |
Get the SIP To/From header value for the local side of this dialog.
void getLocalTag | ( | UtlString & | localTag | ) | const |
Get the tag from the SIP To/From header value for the local side of this dialog.
void setLocalField | ( | const Url & | localUrl | ) |
Set the SIP To/From header value for the local side of this dialog.
void getRemoteField | ( | Url & | remoteUrl | ) | const |
Get the SIP To/From header value for the remote side of this dialog.
void getRemoteTag | ( | UtlString & | remoteTag | ) | const |
Get the tag from the SIP To/From header value for the remote side of this dialog.
void setRemoteField | ( | const Url & | remoteUrl | ) |
Set the SIP To/From header value for the remote side of this dialog.
void getRemoteContact | ( | Url & | remoteContact | ) | const |
Get the SIP Contact header value for the remote side of this dialog.
void setRemoteContact | ( | const Url & | remoteContact | ) |
Set the SIP Contact header value for the remote side of this dialog.
void getLocalContact | ( | Url & | localContact | ) | const |
Get the SIP Contact header value for the local side of this dialog.
void setLocalContact | ( | const Url & | localContact | ) |
Get the SIP Contact header value for the remote side of this dialog.
void getInitialMethod | ( | UtlString & | method | ) | const |
Get the SIP method of the request that initiated this dialog.
void setInitialMethod | ( | const char * | method | ) |
Set the SIP method of the request that initiated this dialog.
int getNextLocalCseq | ( | ) |
Get the next (incremented) SIP Cseq number for the local side.
int getLastLocalCseq | ( | ) | const |
Get the last used SIP Cseq number for the local side.
void setLastLocalCseq | ( | int | seqNum | ) |
Set the last used SIP Cseq number for the local side.
int getLastRemoteCseq | ( | ) | const |
Get the last used SIP Cseq number for the remote side.
void setLastRemoteCseq | ( | int | seqNum | ) |
Set the last used SIP Cseq number for the remote side.
void getLocalRequestUri | ( | UtlString & | requestUri | ) | const |
Get the request URI for the local side.
This may be different than the local contact. This is what was received in the last request from the remote side.
void setLocalRequestUri | ( | const UtlString & | requestUri | ) |
Set the request URI for the local side.
void getRemoteRequestUri | ( | UtlString & | requestUri | ) | const |
Get the request URI for the remote side.
This is typically meaningless for the remote side when observed from the local end point as it should not be different than the local contact. However in some applications it may be possible to observe what the request URI is on the remote side or in a proxy in which case this may be interesting.
void setRemoteRequestUri | ( | const UtlString & | requestUri | ) |
Set the request URI for the remote side.
void toString | ( | UtlString & | dialogDumpString | ) |
Debug method to dump the contents of this SipDialog into a string.
|
static |
Get a string representation for the state value.
UtlBoolean isSameDialog | ( | const SipMessage & | message | ) | const |
Compare the message to see if it matches this dialog.
A dialog matches if the SIP Call-Id header and the tags from the SIP message To and From field match those of this dialog. The tags are compared in both directions.
UtlBoolean isSameDialog | ( | const UtlString & | callId, |
const UtlString & | localTag, | ||
const UtlString & | remoteTag | ||
) | const |
Compare the given dialog indentifiers match those of this dialog.
The tags are compared in both directions.
UtlBoolean isSameDialog | ( | const char * | dialogHandle | ) |
Compare the given dialog handle with that of this dialog.
The tags are compared in both directions.
UtlBoolean isEarlyDialog | ( | ) | const |
Determine if this is an early dialog.
|
static |
Determine if the given handle is for an early dialog.
That is check if one of the tags is null
UtlBoolean isEarlyDialogFor | ( | const SipMessage & | message | ) | const |
Checks if this is an early dialog for the given SIP message.
UtlBoolean isEarlyDialogFor | ( | const UtlString & | callId, |
const UtlString & | localTag, | ||
const UtlString & | remoteTag | ||
) | const |
Checks if this is an early dialog for the given SIP message.
UtlBoolean wasEarlyDialogFor | ( | const SipMessage & | message | ) | const |
Checks if this was an early dialog for the given SIP message.
This dialog is considered to have been an early dialog if the SIP Call-Id and one of the given tags matches one of the tags of this dialog.
UtlBoolean wasEarlyDialogFor | ( | const UtlString & | callId, |
const UtlString & | localTag, | ||
const UtlString & | remoteTag | ||
) | const |
Checks if this was an early dialog for the given SIP message.
This dialog is considered to have been an early dialog if the SIP Call-Id and one of the given tags matches one of the tags of this dialog.
UtlBoolean isTransactionLocallyInitiated | ( | const UtlString & | callId, |
const UtlString & | fromTag, | ||
const UtlString & | toTag | ||
) | const |
Query if the transaction request was sent from the local side.
If the request was sent from the local side, the fromTag will match the local tag.
UtlBoolean isTransactionRemotelyInitiated | ( | const UtlString & | callId, |
const UtlString & | fromTag, | ||
const UtlString & | toTag | ||
) | const |
Query if the transaction request was sent from the remote side.
If the request was sent from the local side, the fromTag will match the remote tag.
UtlBoolean isSameLocalCseq | ( | const SipMessage & | message | ) | const |
Check if message and SIP local Cseq match.
UtlBoolean isSameRemoteCseq | ( | const SipMessage & | message | ) | const |
Check if message and SIP remote Cseq match.
UtlBoolean isNextLocalCseq | ( | const SipMessage & | message | ) | const |
Check if mesage cseq is after the last local transaction.
UtlBoolean isNextRemoteCseq | ( | const SipMessage & | message | ) | const |
Check if mesage cseq is after the last remote transaction.