当前位置: 首页>>代码示例>>C++>>正文


C++ SipMessage::getCallIdField方法代码示例

本文整理汇总了C++中SipMessage::getCallIdField方法的典型用法代码示例。如果您正苦于以下问题:C++ SipMessage::getCallIdField方法的具体用法?C++ SipMessage::getCallIdField怎么用?C++ SipMessage::getCallIdField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SipMessage的用法示例。


在下文中一共展示了SipMessage::getCallIdField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: isNewRemoteTransaction

UtlBoolean SipDialogMgr::isNewRemoteTransaction(const SipMessage& message)
{
    UtlBoolean matchesTransaction = FALSE;
    UtlString handle;
    SipDialog::getDialogHandle(message, handle);

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    Url fromField;
    Url toField;
    message.getFromUrl(fromField);
    message.getToUrl(toField);
    message.getCallIdField(callId);
    fromField.getFieldParameter("tag", fromTag);
    toField.getFieldParameter("tag", toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if(dialog && 
       dialog->isTransactionRemotelyInitiated(callId, fromTag, toTag) &&
       dialog->isNextRemoteCseq(message))
    {
        matchesTransaction = TRUE;
    }

    unlock();
    
    return(matchesTransaction);
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:34,代码来源:SipDialogMgr.cpp

示例2: buildSubscribeRequest

void SipImpliedSubscriptions::buildSubscribeRequest( const SipMessage& registerMessage
                           ,int duration
                           ,SipMessage& subscribeRequest
                           ,UtlString&  callId
                           ,UtlString&  fromTag
                           ,UtlString&  fromUri
                           )
{
   UtlString registrationValue;
   UtlString tagNameValuePair;
   UtlString contactUri;
   int      sequenceNumber = 0;

   // Get the From URL, and change the tag
   Url fromUrl;
   registerMessage.getFromUrl( fromUrl );
   fromUrl.removeFieldParameter("tag"); // discard from tag from REGISTER
   registerMessage.getFromUri( &fromUri );
   (void) registerMessage.getContactUri(0, &contactUri);
   (void) registerMessage.getCSeqField(&sequenceNumber, &registrationValue);

   Url toUrl;
   registerMessage.getToUrl( toUrl );
   toUrl.removeFieldParameter("tag");
   
   UtlString toUri;
   registerMessage.getToUri( &toUri );

   registerMessage.getCallIdField( &callId );
   callId.prepend("implied-mwi-");

   // Build a from tag for the SUBSCRIBE
   //   - hash the call id so that it will be the same on each refresh
   UtlString callIdHash;
   NetMd5Codec::encode( callId.data(), callIdHash );
   fromUrl.setFieldParameter("tag", callIdHash.data() );
   fromTag = callIdHash; // for constructing the nonce

   subscribeRequest.setVoicemailData( fromUrl.toString() // From:
                                     ,toUrl.toString()   // To:
                                     ,toUri.data()       // request URI
                                     ,contactUri.data()  // taken from registration
                                     ,callId.data()
                                     ,++sequenceNumber
                                     ,duration
                                     );

   /*
    * Rewrite the event field to add our extension parameter to
    * ensure that the registration and subscription are synchronized.
    */
   const char* standardEventHeader = subscribeRequest.getHeaderValue(0, SIP_EVENT_FIELD);
   UtlString extendedEventHeader(standardEventHeader);
   extendedEventHeader.append(";" SIPX_IMPLIED_SUB "=");
   char durationString[12];
   sprintf(durationString, "%d", duration);
   extendedEventHeader.append(durationString);
   subscribeRequest.setHeaderValue(SIP_EVENT_FIELD, extendedEventHeader.data(), 0);
}
开发者ID:chemeris,项目名称:sipxecs,代码行数:59,代码来源:SipImpliedSubscriptions.cpp

示例3: mIsValidIdentity

/// Decode the identity from a message.
SipXauthIdentity::SipXauthIdentity(const SipMessage& message,
                                   const HeaderName headerName,
                                   DialogRule bindRule
                                   )
  : mIsValidIdentity(FALSE)
{
   UtlString callId;
   UtlString fromTag;
   Url fromUrl;
   message.getCallIdField(&callId);
   message.getFromUrl(fromUrl);
   fromUrl.getFieldParameter("tag", fromTag);

   decode(headerName, message, callId, fromTag, bindRule);
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:16,代码来源:SipXauthIdentity.cpp

示例4: insert

/// Add identity info to a message.
bool SipXauthIdentity::insert(SipMessage & message,
                              HeaderName headerName,
                              const OsDateTime * timestamp)
{
   // Don't proceed if the encapsulated identity is invalid
   if (!mIsValidIdentity)
   {
      Os::Logger::instance().log(FAC_SIP, PRI_CRIT,
                    "SipXauthIdentity::insert: "
                    "encapsulated SipXauthIdentity is invalid");
   }
   else
   {
      // make sure no existing identity in the message
      remove(message, headerName);

      // set Call-Id and from-tag for the signature calculation
      UtlString callId;
      UtlString fromTag;
      Url fromUrl;
      message.getCallIdField(&callId);
      message.getFromUrl(fromUrl);
      fromUrl.getFieldParameter("tag", fromTag);

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

      UtlString value;
      encode(value, callId, fromTag, *timestamp);

      // Insert displayName if it is an P-Asserted-Identity header.
      if (headerName == SipXauthIdentity::PAssertedIdentityHeaderName)
      {
          UtlString displayName;
          fromUrl.getDisplayName(displayName);
          value.prepend(displayName.data());
      }

      message.addHeaderField(headerName, value.data());
   }

   return mIsValidIdentity;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:48,代码来源:SipXauthIdentity.cpp

示例5: removeErrorSubscription

int SubscribeServerThread::removeErrorSubscription (const SipMessage& sipMessage )
{
    int returnStatus = STATUS_SUCCESS;
    UtlString callId;
    UtlString to;
    UtlString from;
    sipMessage.getToField(&to);
    sipMessage.getFromField(&from);
    sipMessage.getCallIdField(&callId);

    OsSysLog::add(FAC_SIP, PRI_WARNING,
                  "SubscribeServerThread::removeErrorSubscription %s",
                  callId.data());

    removeErrorRow(from, to, callId);
    return returnStatus;
}
开发者ID:astubbs,项目名称:sipxecs,代码行数:17,代码来源:SubscribeServerThread.cpp

示例6:

AuthPlugin::AuthResult
SubscriptionAuth::authorizeAndModify(const UtlString& id,    /**< The authenticated identity of the
                                                              *   request originator, if any (the null
                                                              *   string if not).
                                                              *   This is in the form of a SIP uri
                                                              *   identity value as used in the
                                                              *   credentials database ([email protected])
                                                              *   without the scheme or any parameters.
                                                              */
                                    const Url&  requestUri, ///< parsed target Uri
                                    RouteState& routeState, ///< the state for this request.
                                    const UtlString& method,///< the request method
                                    AuthResult  priorResult,///< results from earlier plugins.
                                    SipMessage& request,    ///< see AuthPlugin wrt modifying
                                    bool bSpiralingRequest, ///< request spiraling indication
                                    UtlString&  reason      ///< rejection reason
                                    )
{
   AuthResult result = CONTINUE;
   UtlString eventField;
   UtlString targetUser;
   requestUri.getUserId(targetUser);

   if (CONTINUE == priorResult &&
       id.isNull() &&
       method.compareTo(SIP_SUBSCRIBE_METHOD) == 0 &&
       request.getEventField(eventField) &&
       mEventPackagesRequiringAuthentication.contains( &eventField ) &&
       !isTargetExemptedFromAuthentication(targetUser))
   {
      // we do not have an authenticated ID for the request - challenge it.
      // get the call-id to use in logging
      UtlString callId;
      request.getCallIdField(&callId);

      OsSysLog::add(FAC_AUTH, PRI_INFO, "SubscriptionAuth[%s]::authorizeAndModify "
                    "challenging subscription for dialog event package '%s' (call id = '%s')",
                    mInstanceName.data(), eventField.data(), callId.data()
                    );
      result = DENY;
      reason = "Authentication Required to Subscribe to " + eventField;
   }
   return result;
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:44,代码来源:SubscriptionAuth.cpp

示例7: lookUpDialog

RedirectPlugin::LookUpStatus
SipRedirectorJoin::lookUp(
   const SipMessage& message,
   const UtlString& requestString,
   const Url& requestUri,
   const UtlString& method,
   ContactList& contactList,
   RedirectPlugin::RequestSeqNo requestSeqNo,
   int redirectorNo,
   SipRedirectorPrivateStorage*& privateStorage,
   ErrorDescriptor& errorDescriptor)
{
   UtlString userId;
   UtlString incomingCallId;

   requestUri.getUserId(userId);
   message.getCallIdField(&incomingCallId);

   if (!mCallJoinCode.isNull() &&
       userId.length() > mCallJoinCode.length() &&
       userId.index(mCallJoinCode.data()) == 0 &&
       userId.compareTo(mExcludedUser1) != 0 &&
       userId.compareTo(mExcludedUser2) != 0)
   {
      return lookUpDialog(requestString,
                          incomingCallId,
                          contactList,
                          requestSeqNo,
                          redirectorNo,
                          privateStorage,
                          // The suffix of the request URI after the
                          // directed call pick-up code.
                          userId.data() + mCallJoinCode.length(),
                          // Only examine confirmed dialogs.
                          stateConfirmed);
   }
   else
   {
      // We do not recognize the user, so we do nothing.
      return RedirectPlugin::SUCCESS;
   }
}
开发者ID:ClydeFroq,项目名称:sipxecs,代码行数:42,代码来源:SipRedirectorJoin.cpp

示例8: encodeUri

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

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

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

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

   return mIsValidIdentity;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:42,代码来源:SipXauthIdentity.cpp

示例9: isLastLocalTransaction

UtlBoolean SipDialogMgr::isLastLocalTransaction(const SipMessage& message, 
                                                const char* dialogHandle)
{
    UtlBoolean matchesTransaction = FALSE;
    UtlString handle(dialogHandle ? dialogHandle : "");
    // If the dialog handle was not set, get it from the message
    if(handle.isNull())
    {
       SipDialog::getDialogHandle(message, handle);
    }

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    Url fromField;
    Url toField;
    message.getFromUrl(fromField);
    message.getToUrl(toField);
    message.getCallIdField(callId);
    fromField.getFieldParameter("tag", fromTag);
    toField.getFieldParameter("tag", toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if(dialog && 
       dialog->isTransactionLocallyInitiated(callId, fromTag, toTag) &&
       dialog->isSameLocalCseq(message))
    {
        matchesTransaction = TRUE;
    }

    unlock();
    
    return(matchesTransaction);
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:39,代码来源:SipDialogMgr.cpp

示例10: updateVersion

// Update the IMDB with the NOTIFY CSeq now in notifyRequest and the
// specified 'version' for the given eventTypeKey.
void SipPersistentSubscriptionMgr::updateVersion(SipMessage& notifyRequest,
                                                 int version,
                                                 const UtlString& eventTypeKey)
{
   // Call the superclass's updateVersion.
   SipSubscriptionMgr::updateVersion(notifyRequest, version, eventTypeKey);

   // Extract from the NOTIFY the information we need to find the right
   // IMDB row.
   int cseq;
   UtlString method;
   notifyRequest.getCSeqField(&cseq, &method);

   UtlString to;
   UtlString from;
   UtlString callId;
   UtlString eventType, eventId;
   int now;

   // Note that the "to" and "from" fields of the subscription table
   // are as those URIs appear in the SUBSCRIBE message, which is
   // reversed in the NOTIFY message.
   notifyRequest.getToField(&from);
   notifyRequest.getFromField(&to);
   notifyRequest.getCallIdField(&callId);
   notifyRequest.getEventField(&eventType, &eventId);
   now = (int) OsDateTime::getSecsSinceEpoch();

   OsSysLog::add(FAC_SIP, PRI_DEBUG,
                 "SipPersistentSubscriptionMgr::updateVersion "
                 "callId = '%s', to = '%s', from = '%s', eventType = '%s', eventTypeKey = '%s', eventId = '%s', cseq = %d, version = %d",
                 callId.data(), to.data(), from.data(), eventType.data(), eventTypeKey.data(), eventId.data(), cseq, version);
   mSubscriptionDBInstance->updateNotifyUnexpiredSubscription(
      mComponent, to, from, callId, eventTypeKey, eventId, now, cseq, version);

   // Start the save timer.
   mPersistenceTimer.oneshotAfter(sPersistInterval);
}
开发者ID:astubbs,项目名称:sipxecs,代码行数:40,代码来源:SipPersistentSubscriptionMgr.cpp

示例11: isSameDialog

UtlBoolean SipDialog::isSameDialog(const SipMessage& message) const
{
    UtlString messageCallId;
    message.getCallIdField(&messageCallId);
    UtlBoolean isSameDialog = FALSE;
    if(messageCallId.compareTo(*this, UtlString::ignoreCase) == 0)
    {
        Url messageFromUrl;
        message.getFromUrl(messageFromUrl);
        UtlString messageFromTag;
        messageFromUrl.getFieldParameter("tag", messageFromTag);
        if(messageFromTag.compareTo(mLocalTag, UtlString::ignoreCase) == 0)
        {
            Url messageToUrl;
            message.getToUrl(messageToUrl);
            UtlString messageToTag;
            messageToUrl.getFieldParameter("tag", messageToTag);
            if(messageToTag.compareTo(mRemoteTag, UtlString::ignoreCase) == 0)
            {
                isSameDialog = TRUE;
            }
        }
        else if(messageFromTag.compareTo(mRemoteTag, UtlString::ignoreCase) == 0)
        {
            Url messageToUrl;
            message.getToUrl(messageToUrl);
            UtlString messageToTag;
            messageToUrl.getFieldParameter("tag", messageToTag);
            if(messageToTag.compareTo(mLocalTag, UtlString::ignoreCase) == 0)
            {
                isSameDialog = TRUE;
            }
        }

    }
    return(isSameDialog);

}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:38,代码来源:SipDialog.cpp

示例12: if

/// Decode the identity from a message by searching for SipXauthIdentity then P-Asserted-Identity
SipXauthIdentity::SipXauthIdentity( const SipMessage& message,
                                    UtlString& matchedHeaderName,
                                    bool bSipXauthIdentityTakesPrecedence,
                                    DialogRule bindRule )
  : mIsValidIdentity(FALSE)
{
   UtlString callId;
   UtlString fromTag;
   Url fromUrl;
   message.getCallIdField(&callId);
   message.getFromUrl(fromUrl);
   fromUrl.getFieldParameter("tag", fromTag);
   matchedHeaderName.remove(0);
   HeaderName firstHeaderToTest;
   HeaderName secondHeaderToTest;

   if( bSipXauthIdentityTakesPrecedence == true )
   {
      firstHeaderToTest  = AuthIdentityHeaderName;
      secondHeaderToTest = PAssertedIdentityHeaderName;
   }
   else
   {
      firstHeaderToTest  = PAssertedIdentityHeaderName;
      secondHeaderToTest = AuthIdentityHeaderName;
   }

   if( decode(firstHeaderToTest, message, callId, fromTag, bindRule) )
   {
      matchedHeaderName = firstHeaderToTest;
   }
   else if( decode(secondHeaderToTest, message, callId, fromTag, bindRule) )
   {
      matchedHeaderName = secondHeaderToTest;
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:37,代码来源:SipXauthIdentity.cpp

示例13: updateDialogInfo

UtlBoolean SipPersistentSubscriptionMgr::updateDialogInfo(
   const SipMessage& subscribeRequest,
   UtlString& resourceId,
   UtlString& eventTypeKey,
   UtlString& eventType,
   UtlString& subscribeDialogHandle,
   UtlBoolean& isNew,
   UtlBoolean& isSubscriptionExpired,
   SipMessage& subscribeResponse,
   SipSubscribeServerEventHandler& handler)
{
   OsSysLog::add(FAC_SIP, PRI_DEBUG,
                 "SipPersistentSubscriptionMgr::updateDialogInfo "
                 "resourceId = '%s', eventTypeKey = '%s'",
                 resourceId.data(), eventTypeKey.data());

   UtlBoolean ret;

   // Call SipSubscriptionMgr to update the in-memory data.
   ret = SipSubscriptionMgr::updateDialogInfo(subscribeRequest,
                                              resourceId,
                                              eventTypeKey,
                                              eventType,
                                              subscribeDialogHandle,
                                              isNew,
                                              isSubscriptionExpired,
                                              subscribeResponse,
                                              handler);

   // If that succeeded, update the IMDB.
   if (ret)
   {
      UtlString requestUri;
      UtlString callId;
      UtlString contactEntry;
      UtlString to;
      UtlString from;
      UtlString route;
      UtlString accept;

      subscribeRequest.getRequestUri(&requestUri);
      subscribeRequest.getCallIdField(&callId);
      subscribeRequest.getContactEntry(0, &contactEntry);
      subscribeRequest.getToField(&to);
      subscribeRequest.getFromField(&from);
      subscribeRequest.buildRouteField(&route);
      accept.append(subscribeRequest.getHeaderValue(0, SIP_ACCEPT_FIELD));

      int expires = 0;
      subscribeResponse.getExpiresField(&expires);
      expires += OsDateTime::getSecsSinceEpoch();

      int subscribeCseq;
      UtlString subscribeCseqMethod;
      subscribeRequest.getCSeqField(&subscribeCseq, &subscribeCseqMethod);

      OsSysLog::add(FAC_SIP, PRI_DEBUG,
                    "SipPersistentSubscriptionMgr::updateDialogInfo "
                    "mComponent = '%s', requestUri = '%s', callId = '%s', contactEntry = '%s', expires = %d, to = '%s', from = '%s', key = '%s', route = '%s', accept = '%s'",
                    mComponent.data(), requestUri.data(),
                    callId.data(), contactEntry.data(), expires,
                    to.data(), from.data(), resourceId.data(), route.data(),
                    accept.data());

      // Attempt to update an existing row.
      int now = (int)OsDateTime::getSecsSinceEpoch();
      ret = mSubscriptionDBInstance->updateSubscribeUnexpiredSubscription(
         mComponent, to, from, callId, eventTypeKey, "",
         now, expires, subscribeCseq);
      
      if (!ret)
      {
         // Add a new row.

         // This call assumes that eventTypeKey is OK for use as the <eventtype>,
         // and that the NOTIFY CSeq's will start at 1.  0 is used as
         // the initial XML version.
         ret = mSubscriptionDBInstance->insertRow(
            mComponent, requestUri, callId, contactEntry,
            expires, subscribeCseq, eventTypeKey, "",
            to, from, resourceId, route, 1, accept, 0);

         if (!ret)
         {
            OsSysLog::add(FAC_SIP, PRI_ERR,
                          "SipPersistantSubscriptionMgr::addSubscription "
                          "Could not update or insert record in database");
         }
      }

      // Start the save timer.
      mPersistenceTimer.oneshotAfter(sPersistInterval);
   }

   return ret;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:96,代码来源:SipPersistentSubscriptionMgr.cpp

示例14: isAuthenticated

UtlBoolean AppAgentSubscribePolicy::isAuthenticated(const SipMessage & subscribeRequest,
                                                    SipMessage & subscribeResponse)
{
   UtlBoolean isAuthorized = FALSE;

   UtlString callId;
   subscribeRequest.getCallIdField(&callId);

   Url fromNameAddr;
   UtlString fromTag;
   subscribeRequest.getFromUrl(fromNameAddr);
   fromNameAddr.getFieldParameter("tag", fromTag);

   UtlString authNonce;
   UtlString authRealm;
   UtlString authUser;
   UtlString authUserBase;
   UtlString uriParam;
   UtlString authCnonce;
   UtlString authNonceCount;
   UtlString authQop;

   // Iterate through Authorization and Proxy-Authorization credentials,
   // looking for one that shows this request is authenticated.
   for (int authIndex = 0;
        ! isAuthorized
        && subscribeRequest.getDigestAuthorizationData(&authUser,
                                                       &authRealm,
                                                       &authNonce,
                                                       NULL, NULL, 
                                                       &uriParam,
                                                       &authCnonce,
                                                       &authNonceCount,
                                                       &authQop,
                                                       HttpMessage::SERVER, 
                                                       authIndex,
                                                       &authUserBase);
        authIndex++
      )
   {
      Os::Logger::instance().log(FAC_AUTH, PRI_DEBUG, 
                    "AppAgentSubscribePolicy::isAuthenticated "
                    "Message Authorization received: "
                    "reqRealm='%s', reqUser='%s', reqUserBase='%s'",
                    authRealm.data(), authUser.data(), authUserBase.data());

      UtlString qopType;

      if (mRealm.compareTo(authRealm) ) // case sensitive check that realm is correct
      {
         Os::Logger::instance().log(FAC_AUTH, PRI_DEBUG,
                       "AppAgentSubscribePolicy::isAuthenticated "
                       "Realm does not match");
      }

      // validate the nonce
      else if (!mNonceDb.isNonceValid(authNonce, callId, fromTag, mRealm, mNonceExpiration))
      {
          Os::Logger::instance().log(FAC_AUTH, PRI_INFO,
                        "AppAgentSubscribePolicy::isAuthenticated -"
                        "Invalid nonce: nonce='%s', callId='%s'",
                        authNonce.data(), callId.data());
      }

      // verify that qop,cnonce, nonceCount are compatible
      else if (subscribeRequest.verifyQopConsistency(authCnonce.data(),
                                                     authNonceCount.data(),
                                                     &authQop,
                                                     qopType)
               >= HttpMessage::AUTH_QOP_NOT_SUPPORTED)
      {
          Os::Logger::instance().log(FAC_AUTH, PRI_INFO,
                        "AppAgentSubscribePolicy::isAuthenticated -"
                        "Invalid combination of QOP('%s'), cnonce('%s') and nonceCount('%s')",
                        authQop.data(), authCnonce.data(), authNonceCount.data());
      }

      else // realm, nonce and qop are all ok
      {    
         // build the "authorization identity" from the auth credentials
         Url authIdentity;
         UtlString authTypeDB;
         UtlString passTokenDB;

         // then get the credentials for this user & realm
         if (mEntityDb.getCredential(authUserBase, authRealm, authIdentity, passTokenDB, authTypeDB))
         {
            // only DIGEST is used, so the authTypeDB above is ignored
            if ((isAuthorized =
                 subscribeRequest.verifyMd5Authorization(authUser.data(),
                                                         passTokenDB.data(),
                                                         authNonce.data(),
                                                         authRealm.data(),
                                                         authCnonce.data(),
                                                         authNonceCount.data(),
                                                         authQop.data(),
                                                         uriParam.data())
                   ))
            {
               Os::Logger::instance().log(FAC_AUTH, PRI_DEBUG,
//.........这里部分代码省略.........
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:101,代码来源:AppAgentSubscribePolicy.cpp

示例15: ContactSetTest

   /// wrapper function for all reg-info event tests
   bool ContactSetTest(UtlString regContactxml, UtlString requestUri, UtlString route)
   {
      bool ret = FALSE;
      instantiateAllTestFixtures( "resource-lists2.xml", 
                                  "subscription1", 
                                  "credential1", 
                                  "sip:127.0.0.1:45141",
                                  FALSE);

      // receive the reg-info subscribe 
      SipMessage request;
      while(getNextMessageFromRlsClientUnderTest( request, 5 ) )
      {
         UtlString method;
         request.getRequestMethod(&method);
         if(!request.isResponse() &&
            0 == method.compareTo(SIP_SUBSCRIBE_METHOD) )
         {
            // Accept the Subscription, regardless of whether it for a 'dialog' or 'reg' event
            // in order to stop retransmissions
            SipMessage regResponse;
            regResponse.setResponseData(&request, 202, "Accepted", "sip:127.0.0.1:45141");
            SipMessage * dispatchedMessage = new SipMessage(regResponse);            
            pResourceServerUnderTest->mClientUserAgent.dispatch(dispatchedMessage);

            // Deal with the two events separately
            UtlString eventField;
            request.getEventField(eventField);
            if(0 == eventField.compareTo("reg"))
            {
               UtlString contactInfo;
               request.getContactUri(0, &contactInfo);
               UtlString callid;
               request.getCallIdField(&callid);
               int cseq;
               request.getCSeqField(&cseq, NULL);

               Url toField;
               regResponse.getToUrl(toField);

               SipMessage regNotify;
               regNotify.setNotifyData(&request, 1, "", "", "reg");
               UtlString regInfo ("<?xml version=\"1.0\"?>\r\n"
                                 "<reginfo xmlns=\"urn:ietf:params:xml:ns:reginfo\" "
                                 "xmlns:gr=\"urn:ietf:params:xml:ns:gruuinfo\" version=\"911\" state=\"full\">\r\n"
                                 "   <registration aor=\"sip:[email protected]\" id=\"sip:[email protected]\" state=\"active\">\r\n "
                                 "      <contact id=\"sip:[email protected]@@&lt;");
               regInfo.append(contactInfo);
               regInfo.append("&gt;\" state=\"active\" event=\"registered\" q=\"1\" callid=\"");
               regInfo.append(callid);
               regInfo.append("\" cseq=\"");
               regInfo.appendNumber(cseq);
               regInfo.append("\">\r\n");
               regInfo.append(regContactxml);
               regInfo.append("      </contact>\r\n"
                              "   </registration>\r\n"
                              "</reginfo>");
               HttpBody * newBody = new HttpBody (regInfo, strlen(regInfo), "application/reginfo+xml");
               regNotify.setContentType("application/reginfo+xml");
               regNotify.setBody(newBody);

               // Set the From field the same as the to field from the 202 response, as it
               // contains the dialog identifying to tags
               regNotify.setRawFromField(toField.toString().data());
               sendToRlsServerUnderTest( regNotify );
            }
            else if(0 == eventField.compareTo("dialog"))
            {
               // If we find a dialog event subscription with the request uri and route
               // that we are looking for, mark the test as passed

               UtlString uri;
               UtlString myRoute;
               request.getRequestUri(&uri);
               request.getRouteField(&myRoute); 
               if(0 == uri.compareTo(requestUri) &&
                  0 == route.compareTo(myRoute))
               {
                  ret = true;
               }
            }
         }
      }
      return ret;
   }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:86,代码来源:ResourceListServerTest.cpp


注:本文中的SipMessage::getCallIdField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。