// -----------------------------------------------------------------------------
// CMmConferenceCallMessHandler::MapETelCallIdToISACallId
// Utility function that maps an ETel call id to a call id
// in ISA Call Server's format.
// -----------------------------------------------------------------------------
//
TUint8 CMmConferenceCallMessHandler::MapETelCallIdToISACallId(
    const TInt aETelCallId )
    {
TFLOGSTRING("TSY: CMmConferenceCallMessHandler::MapETelCallIdToISACallId");
OstTrace0( TRACE_NORMAL,  CMMCONFERENCECALLMESSHANDLER_MAPETELCALLIDTOISACALLID_TD, "CMmConferenceCallMessHandler::MapETelCallIdToISACallId" );

    TUint8 callId( CALL_MODEM_ID_NONE );

    if ( CALL_MODEM_ID_1 > aETelCallId || CALL_MODEM_ID_7 < aETelCallId )
        {
        callId = CALL_MODEM_ID_NONE;
        }
    else
        {
        callId = static_cast<TUint8>( aETelCallId );
        }

    return callId;
    }
/// Encode identity info into a URL
bool SipXauthIdentity::encodeUri(Url              & uri,
                                 const char*    pCallId,
                                 const Url      fromUrl,
                                 const OsDateTime * timestamp)
{
   // Don't proceed if the encapsulated identity is invalid
   if (!mIsValidIdentity)
   {
      Os::Logger::instance().log(FAC_SIP, PRI_CRIT,
                    "SipXauthIdentity::encodeUri[no msg]: "
                    "encapsulated SipXauthIdentity is invalid");
   }
   else
   {
      // make sure no existing identity in the URI
      uri.removeHeaderParameter(SipXauthIdentity::PAssertedIdentityHeaderName);
      // set Call-Id and from-tag for the signature calculation
      UtlString callId(pCallId);
      UtlString fromTag;
      fromUrl.getFieldParameter("tag", fromTag);

      OsDateTime now;
      OsDateTime::getCurTime(now);
      if (NULL==timestamp)
      {
         timestamp = &now;
      }

      UtlString value;
      encode(value, callId, fromTag, *timestamp);
      uri.setHeaderParameter(SipXauthIdentity::PAssertedIdentityHeaderName, value.data());

      Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                    "SipXauthIdentity::encodeUri[o msg] "
                    "encoded URI '%s'",
                    uri.toString().data()
                    );
   }

   return mIsValidIdentity;
}