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


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

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


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

示例1: remove

/// Remove identity info from a message.
void SipXauthIdentity::remove(SipMessage & message, HeaderName headerName)
{
   int idHeaderCount = message.getCountHeaderFields(headerName);
   if (idHeaderCount>0)
   {
      UtlString rUri;
      message.getRequestUri(&rUri);
      Os::Logger::instance().log(FAC_SIP, PRI_WARNING,
                    "SipXauthIdentity::remove"
                    ": '%d' occurrances of %s in request to '%s'",
                    idHeaderCount, headerName, rUri.data());
      for (int i = idHeaderCount - 1;i>=0;i--)
      {
         message.removeHeader(headerName, i);
      }
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:18,代码来源:SipXauthIdentity.cpp

示例2: normalize

/// Normalize identity info in a message.
void SipXauthIdentity::normalize(SipMessage & message,  HeaderName headerName)
{
   int idHeaderCount = message.getCountHeaderFields(headerName);
   if (idHeaderCount>1)
   {
      UtlString rUri;
      message.getRequestUri(&rUri);
      Os::Logger::instance().log(FAC_SIP, PRI_WARNING,
                    "SipXauthIdentity::remove"
                    ": '%d' occurrances of SipXauthIdentity in request to '%s'",
                    idHeaderCount, rUri.data());
      // Remove all BUT the last header
      for (int i = idHeaderCount - 2;i>=0;i--)
      {
         //message.removeHeader(SipXauthIdentity::AuthIdentityHeaderName, i);
         message.removeHeader(headerName, i);
      }
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:20,代码来源:SipXauthIdentity.cpp

示例3: decode

/// Check the signature and parse the identity contained in specified header name
bool SipXauthIdentity::decode(const UtlString& headerName,
                              const SipMessage& message,
                              const UtlString& callId,
                              const UtlString& fromTag,
                              DialogRule bindRule )
{
   bool foundIdentityHeader = false;
   UtlString rUri;
   message.getRequestUri(&rUri);

   int idHeaderCount = message.getCountHeaderFields(headerName);
   if (1==idHeaderCount)
   {
      foundIdentityHeader =
         decode(message.getHeaderValue(0, headerName),
                callId, fromTag, bindRule);
   }
   else if (idHeaderCount>1)
   {
      Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                    "SipXauthIdentity::decode:"
                    " '%d' occurrences of %s in request to '%s'",
                    idHeaderCount, headerName.data(), rUri.data());
      foundIdentityHeader =
         decode(message.getHeaderValue(idHeaderCount-1, headerName),
                callId, fromTag, bindRule);
   }

   if (foundIdentityHeader)
   {
      Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                    "SipXauthIdentity::decode:"
                    " found %s '%s' in request to '%s'",
                    headerName.data(), mIdentity.data(), rUri.data());
   }
   return foundIdentityHeader;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:38,代码来源:SipXauthIdentity.cpp

示例4: handleMessage


//.........这里部分代码省略.........
         {
            // collect the sequence data
            mSequenceNumber++;
            
            OsTime timeNow;
            OsDateTime::getCurTime(timeNow); 

            // collect the dialog information
            UtlString callId;
            sipMsg->getCallIdField(&callId);
         
            Url toUrl;
            sipMsg->getToUrl(toUrl);
            UtlString toTag;
            toUrl.getFieldParameter("tag", toTag);

            Url fromUrl;
            sipMsg->getFromUrl(fromUrl);
            UtlString fromTag;
            fromUrl.getFieldParameter("tag", fromTag);

            // collect the To and From
            UtlString toField;
            sipMsg->getToField(&toField);
            
            UtlString fromField;
            sipMsg->getFromField(&fromField);


            // collect the branch Id (i.e. transaction id) and via count.
            UtlString viaValue;
            int viaCount;
            UtlString branchId;
            viaCount = sipMsg->getCountHeaderFields(SIP_VIA_FIELD);
            viaCount = viaCount + sipMsg->getCountHeaderFields(SIP_SHORT_VIA_FIELD);
            if ( sipMsg->getViaFieldSubField( &viaValue, 0 ) ) {
               sipMsg->getViaTag( viaValue, "branch", branchId );
            }
            UtlString referTo;
            UtlString referredBy;
            UtlString requestUri;
            UtlString references;
            UtlString replaces_callId;
            UtlString replaces_toTag;
            UtlString replaces_fromTag;
            UtlString matchingIdentityHeader;
            SipXauthIdentity sipxIdentity(*sipMsg, matchingIdentityHeader, true,SipXauthIdentity::allowUnbound);

            sipMsg->getReferToField(referTo);
            sipMsg->getReferredByField(referredBy);   
            sipMsg->getRequestUri(&requestUri);
            sipMsg->getReferencesField(&references);
            if (sipMsg->getReplacesData(replaces_callId, replaces_toTag, replaces_fromTag)) {
               if (references.length() != 0) {
                  references.append(",");
               }
               references.append(replaces_callId);
               references.append(";rel=xfer");
            }
            
            UtlString responseMethod;
            UtlString calleeRoute;

            int cseqNumber;
            sipMsg->getCSeqField(&cseqNumber, &responseMethod);            
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:66,代码来源:SipXProxyCseObserver.cpp


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