--- a/sipvoipprovider/src/svpemergencyconnection.cpp Tue Jan 26 11:50:49 2010 +0200
+++ b/sipvoipprovider/src/svpemergencyconnection.cpp Tue Feb 02 00:05:57 2010 +0200
@@ -195,45 +195,117 @@
void CSVPEmergencyConnection::RunL()
{
TInt error = iStatus.Int();
- SVPDEBUG2("CSVPEmergencyConnection::RunL(), error: %d", error)
+ SVPDEBUG2( "CSVPEmergencyConnection::RunL(), error: %d", error )
+ SVPDEBUG2( "CSVPEmergencyConnection::RunL(), Request type: %d", iRequestType )
- if ( error )
- {
- iRequestType = ESVPNone;
- iObserver.ConnectionError( error );
- return;
- }
-
+ // execution goes to RunError() if error occured
+ User::LeaveIfError( iStatus.Int() );
switch ( iRequestType )
{
case ESVPSnapConnect:
+ SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSnapConnect" )
iRequestType = ESVPNone;
iObserver.SnapConnected();
break;
case ESVPConnect:
+ SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPConnect" )
iRequestType = ESVPNone;
iObserver.Connected();
break;
case ESVPSipProxyAddress:
{
+ SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSipProxyAddress" )
iRequestType = ESVPNone;
// Copy SIP proxy address in dotted-decimal notation
HBufC16* sipProxyAddrBuf = HBufC16::NewLC( 39 ); // CS:1
TPtr16 sipProxyAddrPtr = sipProxyAddrBuf->Des();
iSipServerAddrBuf().address.Output( sipProxyAddrPtr );
-
+ SVPDEBUG2(
+ "CSVPEmergencyConnection::RunL(), iSipServerAddrBuf: %S",
+ sipProxyAddrBuf )
// Call observer
iObserver.SipProxyAddressReady( *sipProxyAddrBuf );
CleanupStack::PopAndDestroy( sipProxyAddrBuf ); // CS:0
break;
}
+ case ESVPSipDomainAddress:
+ {
+ SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSipDomainAddress" )
+ iRequestType = ESVPNone;
+
+ // Copy SIP proxy domain in dotted-decimal notation
+ HBufC16* sipDomainAddrBuf = HBufC16::NewLC( iSipServerDomainBuf().domainName.Length() ); // CS:1
+ TPtr16 sipDomainAddrPtr = sipDomainAddrBuf->Des();
+ sipDomainAddrPtr.Copy( iSipServerDomainBuf().domainName );
+ SVPDEBUG2(
+ "CSVPEmergencyConnection::RunL(), iSipDomainAddrBuf: %S",
+ sipDomainAddrBuf )
+ // Call observer
+ iObserver.SipProxyAddressReady( *sipDomainAddrBuf );
+ CleanupStack::PopAndDestroy( sipDomainAddrBuf ); // CS:0
+ break;
+ }
default:
+ SVPDEBUG1( "CSVPEmergencyConnection::RunL() - Default" )
iRequestType = ESVPNone;
iObserver.ConnectionError( KErrGeneral );
break;
}
}
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencyConnection::RunError
+//
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencyConnection::RunError( TInt aError )
+ {
+ SVPDEBUG2( "CSVPEmergencyConnection::RunError() %d", aError )
+ if ( iRequestType == ESVPSipProxyAddress )
+ {
+ /*
+ * sip proxy address might be NULL if requested with KConnGetSipServerAddr
+ * and dhcp returns domain name to sip, instead of ipv4 or ipv6 type address.
+ * So try once again with KConnGetSipServerDomain.
+ */
+ SVPDEBUG1( "CSVPEmergencyConnection::RunError() - RequestDomain" )
+ RequestSipServerDomainL();
+ return KErrNone;
+ }
+ else
+ {
+ iRequestType = ESVPNone;
+ SVPDEBUG2( "CSVPEmergencyConnection::RunError() - Notify Observer ConnectionError( %d )", aError )
+ iObserver.ConnectionError( aError );
+ return KErrNone;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Requests for SIP proxy address
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyConnection::RequestSipServerDomainL()
+ {
+ SVPDEBUG1(
+ "CSVPEmergencyConnection::RequestSipServerDomainL() - Try to get Sip server domain" )
+
+ if ( IsActive() )
+ {
+ User::Leave( KErrInUse );
+ }
+
+ iRequestType = ESVPSipDomainAddress;
+ iSipServerDomainBuf().index = 0;
+ // Request SIP server domain
+ iConnection.Ioctl(
+ KCOLConfiguration,
+ KConnGetSipServerDomain, // domain in textual format
+ iStatus,
+ &iSipServerDomainBuf );
+ SetActive();
+ }