CSIPClientConnection Class Reference
class CSIPClientConnection : public CBase
|
Class provides functions for sending and receiving SIP requests and SIP responses. This class also provides functions for creating and destroying SIP dialogs, sending and receiving SIP requests and responses within SIP dialogs, canceling the SIP requests.
All SIP messages will be sent/received using connection (defined using IAP Id) given by the user.
If the preconditions or postconditions are not met the function will leave with KErrArgument error code.
Public Member Functions
|
|
~CSIPClientConnection
()
|
CSIPFromHeader
*
|
AorL
(
TUint32
)
|
CSIPCallIDHeader
*
|
CallIDL
(
TUint32
)
|
TInt
|
ConnectionErrorL
()
|
CSIPContactHeader
*
|
ContactL
(
TUint32
)
|
void
|
DetachClient
()
|
void
|
FetchRegistrationsL
(const
CSIPRequestElements
&,
TUint32
&)
|
void
|
GetLocalAddrL
(
TInetAddr
&)
|
TUint32
|
IapId
()
|
RStringF
|
LocalTagL
(
TUint32
)
|
CSIPClientConnection
*
|
NewL
(
CSIPClient
&,
MSIPClientConnectionObserver
&,
TUint32
)
|
CSIPClientConnection
*
|
NewLC
(
CSIPClient
&,
MSIPClientConnectionObserver
&,
TUint32
)
|
CSIPRouteHeader
*
|
OutboundProxyL
(
TUint32
)
|
void
|
RefreshConnection
()
|
TUint
|
RefreshIntervalL
(
TUint32
)
|
TInt
|
RemoveOutboundProxy
(
TUint32
)
|
TInt
|
ResetDialogState
(
TUint32
)
|
void
|
SendAckL
(
TUint32
,
TUint32
, const
CSIPMessageElements
*)
|
void
|
SendCancelL
(
TUint32
,
TUint32
&)
|
void
|
SendRegisterL
(
TUint32
&, const
CSIPToHeader
&, const
CSIPFromHeader
&, const
CSIPMessageElements
&, const
CUri8
*, const
CSIPRouteHeader
*,
TBool
,
TBool
,
TBool
)
|
void
|
SendRequestAndCreateDialogL
(
TUint32
&,
TUint32
&,
TUint32
&,
RStringF
, const
CUri8
&, const
CSIPFromHeader
*, const
CSIPMessageElements
*, const
CSIPToHeader
*,
TUint32
,
TBool
)
|
void
|
SendRequestAndTerminateRefreshL
(
TUint32
,
TUint32
&, const
CSIPMessageElements
*)
|
void
|
SendRequestAndUpdateRefreshL
(
TUint32
,
TUint32
&, const
CSIPMessageElements
*)
|
void
|
SendRequestL
(const
CSIPRequestElements
&,
TUint32
&,
TUint32
,
TBool
)
|
void
|
SendRequestWithinDialogL
(
TUint32
,
TUint32
&,
TUint32
&,
RStringF
, const
CSIPMessageElements
*,
TBool
,
TBool
)
|
void
|
SendRequestWithinDialogL
(
TUint32
,
TUint32
,
TUint32
&, const
CSIPMessageElements
*)
|
void
|
SendResponseAndCreateDialogL
(const
CSIPResponseElements
&,
TUint32
,
TUint32
&,
TUint32
)
|
void
|
SendResponseL
(const
CSIPResponseElements
&,
TUint32
)
|
void
|
SendResponseWithinDialogL
(const
CSIPResponseElements
&,
TUint32
,
TUint32
,
TBool
)
|
void
|
SetOptL
(
TUint
,
TUint
, const
TDesC8
&)
|
void
|
SetOptL
(
TUint
,
TUint
,
TInt
)
|
void
|
SetOutboundProxyL
(
TUint32
, const
CSIPRouteHeader
&)
|
void
|
SetRefreshIntervalL
(
TUint32
,
TUint
)
|
CSIPConnection::TState
|
State
()
|
TInt
|
TerminateDialog
(
TUint32
)
|
TInt
|
TerminateDialogRefresh
(
TUint32
,
TUint32
)
|
TInt
|
TerminateRefresh
(
TUint32
)
|
TInt
|
TerminateRegistration
(
TUint32
)
|
void
|
UnregisterL
(
TUint32
,
TUint32
&, const
CSIPMessageElements
*)
|
void
|
UpdateRegistrationL
(
TUint32
,
TUint32
&, const
CSIPMessageElements
*)
|
Constructor & Destructor Documentation
CSIPClientConnection(CSIPClient &, MSIPClientConnectionObserver &, TUint32)
~CSIPClientConnection()
~CSIPClientConnection
|
(
|
)
|
|
Member Functions Documentation
AorL(TUint32)
Gets the AOR for a given registration id. Leaves on failure with a system wide or a SIP stack specific error code.
Parameters
TUint32
aRegistrationId
|
the value of the registration-Id that was returned in a response to an earlier REGISTER request. This value is used to identify the binding for which the AOR is to be fetched.
|
CallIDL(TUint32)
Gets the Call-ID for a given dialog id. Leaves on failure with a system wide or a SIP stack specific error code.
CheckContactExpiresL(const CSIPMessageElements &)
CheckContactL(const CSIPMessageElements *)
CheckContactL(const CSIPMessageElements &)
CheckDialogCreationRequestL(const CSIPToHeader *, const CSIPFromHeader *, const CSIPMessageElements *, TUint32, TBool)
CheckExpiresHeaderL(const CSIPMessageElements *, TBool)
CheckExpiresHeaderL(const CSIPMessageElements &, TBool)
ConnectionErrorL()
TInt
|
ConnectionErrorL
|
(
|
)
|
const
|
Returns the connection error code
ConstructL()
void
|
ConstructL
|
(
|
)
|
[private]
|
ContactL(TUint32)
Gets the Contact-header that has been registered with the given registration id.
Parameters
TUint32
aRegistrationId
|
the value of the registration-Id that was returned in a response to an earlier REGISTER request. This value is used to identify the binding for which the Contact-header is to be fetched.
|
FetchRegistrationsL(const CSIPRequestElements &, TUint32 &)
Creates SIP REGISTER request and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code.
User
must NOT set any expires values to the request (aMessageOptionalElements).
Parameters
const
CSIPRequestElements
& aElements
|
contains remote address and optionally SIP message headers and body.
|
TUint32
& aRequestId
|
the returned request Id, to be used to match a response to this request.
|
GetLocalAddrL(TInetAddr &)
void
|
GetLocalAddrL
|
(
|
TInetAddr
&
|
aAddr
|
)
|
const
|
Gets the local IP address used for this
CSIPClientConnection
when sending SIP messages to the network.
-
Pre-condition
-
State()
== EActive
-
leave
-
A system-wide error codes
Parameters
TInetAddr
& aAddr
|
local IP for this CSIPClientConnection.
|
IapId()
Gets the IAP id of this connection
LocalTagL(TUint32)
Gets the local tag for a given dialog id. Leaves on failure with a system wide or a SIP stack specific error code.
NewL(CSIPClient &, MSIPClientConnectionObserver &, TUint32)
Constructs an instance of
CSIPClientConnection
The connection using IAP-Id is initialized during construction.
NewLC(CSIPClient &, MSIPClientConnectionObserver &, TUint32)
OutboundProxyL(TUint32)
Gets the Outbound Proxy as set by any application for an AOR. Leaves on failure with a system wide or a SIP stack specific error code. Applications should retrieve this value first and examine if outbound proxy address, for the particular AOR, is suitable before sending SIP requests to the sip stack. If not suitable, the application may add a Route-header to the SIP Request in order to override this setting for that particular request.
Parameters
TUint32
aRegistrationId
|
the value of the registration-Id that was returned in a response to an earlier REGISTER request. This value is used to identify the binding for which the outbound proxy setting is to be fetched.
|
RefreshConnection()
void
|
RefreshConnection
|
(
|
)
|
const
|
RefreshIntervalL(TUint32)
RemoveOutboundProxy(TUint32)
Removes the outbound proxy which was used for the particular AOR.
Parameters
TUint32
aRegistrationId
|
the value of the registration-Id that was returned in a response to an earlier REGISTER request. This value is used to identify the binding for which the outbound proxy setting is to be removed.
|
ResetDialogState(TUint32)
SendAckL(TUint32, TUint32, const CSIPMessageElements *)
Creates SIP ACK request within a dialog and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code.
Parameters
TUint32
aDialogId
|
the value of the Dialog-Id that was returned in a response to an earlier INVITE, that created the dialog.
|
TUint32
aRequestId
|
the value of the INVITE Request-Id.
|
const
CSIPMessageElements
* aElements = 0
|
contains optional SIP message headers and body.
|
SendCancelL(TUint32, TUint32 &)
void
|
SendCancelL
|
(
|
TUint32
|
aInviteRequestId,
|
|
TUint32
&
|
aCancelRequestId
|
|
)
|
|
Creates SIP CANCEL request for an existing INVITE request and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code.
Parameters
TUint32
aInviteRequestId
|
the id of the INVITE request to be cancelled.
|
TUint32
& aCancelRequestId
|
the id to be created for the CANCEL request.
|
SendRegisterL(TUint32 &, const CSIPToHeader &, const CSIPFromHeader &, const CSIPMessageElements &, const CUri8 *, const CSIPRouteHeader *, TBool, TBool, TBool)
Creates SIP REGISTER request and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code This function call creates a registration binding. The Registration-Id for this REGISTER is returned with a future 2xx response received for this REGISTER. A 2xx response to this REGISTER creates a binding. There MUST NOT be more than one Contact-header and it MUST NOT be set to STAR.
Parameters
TUint32
& aRequestId
|
the returned request Id, to be used to match a response to this request.
|
const
CSIPToHeader
& aTo
|
a From-header
|
const
CSIPFromHeader
& aFrom
|
|
const
CSIPMessageElements
& aElements
|
contains optional SIP message headers and body.
|
const
CUri8
* aRemoteUri = 0
|
a remote-URI. The ownership is NOT transferred.
|
const
CSIPRouteHeader
* aOutboundProxy = 0
|
the outbound proxy address. The ownership is NOT transferred.
|
TBool
aRefresh = EFalse
|
refresh flag. Refreshing of this REGISTER is requested from the SIP Stack by setting this flag to ETrue.
|
TBool
aSendWithExpires = ETrue
|
when set to EFalse REGISTER message is sent without expires value
|
TBool
aCacheOutboundProxyIP = EFalse
|
when set to ETrue outbound proxy IP of REGISTER message is cached in registration context
|
SendRequestAndCreateDialogL(TUint32 &, TUint32 &, TUint32 &, RStringF, const CUri8 &, const CSIPFromHeader *, const CSIPMessageElements *, const CSIPToHeader *, TUint32, TBool)
Creates a SIP request and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code. The Dialog-Id for this request is returned with a future 2xx response received for this request. This provokes the Non-invite state machine The registration Id is used to select the outbound proxy. There MUST NOT be more than one Contact-header and it MUST NOT be set to STAR.
-
Pre-condition
-
CSIPConnection::State()
==
CSIPConnection::EActive
.
-
aMethod.Length() > 0
-
aMethod != "REGISTER" | "OPTIONS" | "BYE" | "CANCEL" | "ACK" | "NOTIFY" | "MESSAGE" | "PRACK" | "UPDATE"
-
aRemoteUri->IsSIPURI()
-
!aTo->HasTag()
-
!aFrom.HasTag()
Parameters
TUint32
& aRequestId
|
the returned request Id, to be used to match a response to this request.
|
TUint32
& aRefreshId
|
if the request is refresh, contains on return the id of the created refresh.
|
TUint32
& aDialogId
|
the returned dialog Id of the establishing dialog
|
RStringF
aMethod
|
the method
|
const
CUri8
& aRemoteUri
|
a remote-URI.
|
const
CSIPFromHeader
* aFrom
|
a From-header. If not given, aRegistrationId must be given, so that the stack can fill in the From-header based on it. The ownership is NOT transferred.
|
const
CSIPMessageElements
* aElements = 0
|
contains optional SIP message headers and body.
|
const
CSIPToHeader
* aTo = 0
|
a To-header. The ownership is NOT transferred.
|
TUint32
aRegistrationId = 0
|
registration id for the sender's AOR
|
TBool
aRefresh = EFalse
|
refresh flag. Refreshing of this SIP request is requested from the SIP Stack by setting this flag to ETrue.
|
SendRequestAndTerminateRefreshL(TUint32, TUint32 &, const CSIPMessageElements *)
Sends a SIP request and terminates the refresh after sending the request. The method and To- and From-headers from the original request will be used. Leaves on failure with a system wide or a SIP stack specific error code. Any SIP response (2xx - 6xx) to this request terminates a refresh.
Parameters
TUint32
aRefreshId
|
the value of the refresh-Id that was returned in a response to an earlier request that created the refresh.
|
TUint32
& aNewRequestId
|
the returned request Id, to be used to match a response to this request.
|
const
CSIPMessageElements
* aElements = 0
|
contains optional SIP message headers and body.
|
SendRequestAndUpdateRefreshL(TUint32, TUint32 &, const CSIPMessageElements *)
Sends a SIP request and updates an existing refresh. The method and To- and From-headers from the original request will be used. Leaves on failure with a system wide or a SIP stack specific error code.
-
Pre-condition
-
CSIPConnection::State()
==
CSIPConnection::EActive
.
Parameters
TUint32
aRefreshId
|
the value of the refresh-Id that was returned in a response to an earlier request that created the refresh.
|
TUint32
& aNewRequestId
|
the returned request Id, to be used to match a response to this request.
|
const
CSIPMessageElements
* aElements = 0
|
contains optional SIP message headers and body.
|
SendRequestL(const CSIPRequestElements &, TUint32 &, TUint32, TBool)
Creates SIP request and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code. Function returns an error if a SIP request with a known method as defined in preconditions is sent. This provokes the Non-invite state machine. The registration Id is used to select the outbound proxy.
Parameters
const
CSIPRequestElements
& aElements
|
contains local and remote addresses, optional SIP message headers and body.
|
TUint32
& aRequestId
|
the returned request Id, to be used to match a response to this request.
|
TUint32
aRegistrationId = 0
|
registration id for the sender's AOR
|
TBool
aRefresh = EFalse
|
refresh flag. Refreshing of the SIP request is requested from the SIP Stack by setting this flag to ETrue.
|
SendRequestWithinDialogL(TUint32, TUint32 &, TUint32 &, RStringF, const CSIPMessageElements *, TBool, TBool)
Creates a SIP request within a dialog and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code. Contact header SHOULD NOT be created unless user intends to redirect the future requests within this dialog to a different remote target. Contact-header MUST NOT be set if aTargetRefresh flag is EFalse. This provokes the Non-invite state machine
Parameters
TUint32
aDialogId
|
the value of the Dialog-Id that was returned in a response to an earlier request that created the dialog.
|
TUint32
& aNewRequestId
|
the returned request Id, to be used to match a response to this request.
|
TUint32
& aRefreshId
|
if the request is refresh, contains on return the id of the created refresh.
|
RStringF
aMethod
|
the method of the request
|
const
CSIPMessageElements
* aElements = 0
|
contains optional SIP message headers and body.
|
TBool
aTargetRefresh = EFalse
|
indicates if an unknown request is a target refresh request.
|
TBool
aRefresh = EFalse
|
refresh flag. Refreshing of this SIP request is requested from the SIP Stack by setting this flag to ETrue.
|
SendRequestWithinDialogL(TUint32, TUint32, TUint32 &, const CSIPMessageElements *)
Creates a SIP request within a dialog and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code. Contact-header MUST NOT be set. pdates an existing refresh within a dialog. This function can also be used to terminate an existing refresh by setting the Expires-header's value to zero. Expires header is mandatory.
Parameters
TUint32
aDialogId
|
the value of the Dialog-Id that was returned in a response to an earlier request that created the dialog.
|
TUint32
aRefreshId
|
the value of the Refresh-Id that was returned in a response to an earlier request that created the refresh.
|
TUint32
& aNewRequestId
|
the returned request Id, to be used to match a response to this request.
|
const
CSIPMessageElements
* aElements
|
contains optional SIP message headers and body.
|
SendResponseAndCreateDialogL(const CSIPResponseElements &, TUint32, TUint32 &, TUint32)
Creates SIP response and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code. This response creates a dialog.
Parameters
const
CSIPResponseElements
& aElements
|
contains Status Code, optional Reason Phrase and optional SIP message headers and body.
|
TUint32
aRequestId
|
the value of the request id as returned by an earlier received request. This value is used to identify the request to which this response is for.
|
TUint32
& aDialogId
|
a dialog id of the dialog that this response creates.
|
TUint32
aRegistrationId
|
registration id
|
SendResponseL(const CSIPResponseElements &, TUint32)
Creates SIP response and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code. This response does not create a dialog. This function MUST be used only if the request received had no Dialog-Id.
Parameters
const
CSIPResponseElements
& aElements
|
contains Status Code, optional Reason Phrase and optional SIP message headers and body.
|
TUint32
aRequestId
|
the value of the request id as returned by an earlier request. The value is used to identify the request to which this response is for.
|
SendResponseWithinDialogL(const CSIPResponseElements &, TUint32, TUint32, TBool)
Creates SIP response to a request that is within a dialog and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code. Contact-header MUST NOT be set if aTargetRefresh flag is EFalse.
Parameters
const
CSIPResponseElements
& aElements
|
contains Status Code, optional Reason Phrase and optional SIP message headers and body.
|
TUint32
aRequestId
|
the value of the request id as returned by an earlier received request. This value identifies the request to which this response is for.
|
TUint32
aDialogId
|
the value of the dialog id as returned by an earlier received response. This value identifies the dialog to which this response is for.
|
TBool
aTargetRefresh = EFalse
|
indicates if a received request sent within a dialog was a target refresh request.
|
SetOptL(TUint, TUint, const TDesC8 &)
Sets a
RSocket
option used for all the sockets used for sending SIP requests and responses in this
CSIPConnection
.
-
Pre-condition
-
State()
== EActive
-
leave
-
A system-wide error code
Parameters
TUint
aOptionName
|
An integer constant which identifies an option.
|
TUint
aOptionLevel
|
An integer constant which identifies level of an option.
|
const
TDesC8
& aOption =
KNullDesC8
|
Option value packaged in a descriptor.
|
SetOptL(TUint, TUint, TInt)
Sets a
RSocket
option used for all the sockets used for sending SIP requests and responses in this
CSIPConnection
.
-
Pre-condition
-
State()
== EActive
-
leave
-
A system-wide error codes
Parameters
TUint
aOptionName
|
An integer constant which identifies an option.
|
TUint
aOptionLevel
|
An integer constant which identifies level of an option.
|
TInt
aOption
|
Option value as an integer.
|
SetOutboundProxyL(TUint32, const CSIPRouteHeader &)
Sets the Outbound Proxy for a registration binding.
Parameters
TUint32
aRegistrationId
|
the value of the registration-Id that was returned in a response to an earlier REGISTER request. This value is used to identify the binding for which the outbound proxy setting is to be set.
|
const
CSIPRouteHeader
& aOutboundProxy
|
an outbound proxy.
|
SetRefreshIntervalL(TUint32, TUint)
void
|
SetRefreshIntervalL
|
(
|
TUint32
|
aRefreshId,
|
|
TUint
|
aInterval
|
|
)
|
|
State()
Gets the current state of the connection
TerminateDialog(TUint32)
Terminates a dialog. This function can be used to terminate a dialog abnormally or when the dialog does not have any more associations (E.g. After receiving a final response to a BYE request).
Parameters
TUint32
aDialogId
|
dialog id for the dialog to be terminated.
|
TerminateDialogRefresh(TUint32, TUint32)
TerminateRefresh(TUint32)
Terminates a refresh abnormally.
Parameters
TUint32
aRefreshId
|
refresh id of the refresh to be terminated.
|
TerminateRegistration(TUint32)
UnregisterL(TUint32, TUint32 &, const CSIPMessageElements *)
Creates SIP (un)REGISTER request and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code.
User
must NOT set any expires values in the SIP REGISTER request (aSIPMessageOptionalElements). Any SIP response (2xx - 6xx) to this request removes a binding.
Parameters
TUint32
aRegistrationId
|
the value of the registration-Id that was returned in a response, to an earlier REGISTER, that created the binding. This value is used to identify the binding to be removed.
|
TUint32
& aNewRequestId
|
the returned request Id, to be used to match a response to this request.
|
const
CSIPMessageElements
* aElements = 0
|
contains optional SIP message headers and body.
|
UpdateRegistrationL(TUint32, TUint32 &, const CSIPMessageElements *)
Creates SIP (update) REGISTER request and sends it to the given destination. Leaves on failure with a system wide or a SIP stack specific error code.
User
of this function does not need to, but can, set a new expires values in the expires-param of the SIP REGISTER request. This is done to update the refresh interval. A 2xx response to this request updates a binding as well as the refresh interval.
Parameters
TUint32
aRegistrationId
|
the value of the registration-Id that was returned in a response, to an earlier REGISTER, that created the binding. This value is used to identify the binding to be updated.
|
TUint32
& aNewRequestId
|
the returned request Id, to be used to match a response to this request.
|
const
CSIPMessageElements
* aElements = 0
|
contains optional SIP message headers and body.
|
Member Data Documentation
RSIPConnection * iConnection
RStringF
iContactHeaderName
RStringF
iExpiresHeaderName
MSIPClientConnectionObserver & iObserver
CSIPClientConnectionReceiver * iReceiver
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.