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


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

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


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

示例1: isSameLocalCseq

UtlBoolean SipDialog::isSameLocalCseq(const SipMessage& message) const
{
    int cseq;
    message.getCSeqField(&cseq, NULL);

    return(cseq == mLastLocalCseq);
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:7,代码来源:SipDialog.cpp

示例2: ChangeState

void WaitingFor200OkforInvite::SuccessfulResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const
{
   int seqNum;
   UtlString seqMethod;
   
   if( response.getCSeqField( &seqNum, &seqMethod ) )
   {
      if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 )
      {
         // normally we would not be expecting this 200 OK response to carry
         // an SDP however we have encountered in the field some endpoints
         // that repeat the SDP answer they already sent in a previous
         // reliable provisional response (see XECS-2079 for the details).
         // Given that, if an SDP answer is found, we will reprocess it
         // to make sure it gets the same transformations that the initial
         // one got as per XECS-2089.
         if( response.hasSdpBody() )
         {
            impl.ProcessMediaAnswer( response, INITIAL_OFFER_ANSWER );
         }
         ChangeState( impl, impl.pWaitingForAckForInvite );
      }
      else
      {
         OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Received unexpected successful response for %s request",
               impl.name(), impl.GetCurrentState()->name(), seqMethod.data() );    
      }
   }   
}
开发者ID:mranga,项目名称:sipxecs,代码行数:29,代码来源:DialogTrackerStates.cpp

示例3: isNextRemoteCseq

UtlBoolean SipDialog::isNextRemoteCseq(const SipMessage& message) const
{
    int cseq;
    message.getCSeqField(&cseq, NULL);

    return(cseq > mLastRemoteCseq);
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:7,代码来源:SipDialog.cpp

示例4: FailureResponse

void Negotiating::FailureResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const
{
   int seqNum;
   UtlString seqMethod;
   
   if( response.getCSeqField( &seqNum, &seqMethod ) )
   {
      if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 )
      {
         // session negotiation failed.  Deallocate all the tentative
         // media relays tentatively allocated to handle the media
         // sessions that just failed.
         impl.deallocateAndClearAllMediaRelaySessions( true, true, false );         

         if( !impl.getDialogEstablishedFlag() )
         {
            // this is a final failure response to a dialog-forming INVITE.  That 
            // event marks the end of the dialog hence, we do not need to continue
            // to track it.
            ChangeState( impl, impl.pMoribund );
         }
         else
         {
            // the renegotiation failed but the dialog is still active. Go back to state where
            // we wait for an incoming INVITE.
            ChangeState( impl, impl.pWaitingForInvite );
         }
      }
      else
      {
         OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Received unexpected successful response for %s request",
               impl.name(), impl.GetCurrentState()->name(), seqMethod.data() );    
      }
   }   
}
开发者ID:mranga,项目名称:sipxecs,代码行数:35,代码来源:DialogTrackerStates.cpp

示例5: SuccessfulResponse

void ProcessingPrack::SuccessfulResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const
{
   int seqNum;
   UtlString seqMethod;

   if( response.getCSeqField( &seqNum, &seqMethod ) )
   {
      if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 )
      {
         // normally we would not be expecting this 200 OK response to carry
         // an SDP in this state however we have encountered in the field some endpoints
         // that repeat the SDP answer they already sent in a previous
         // Successful response (see XECS-2079 for the details).
         // Given that, if an SDP answer is found, we will reprocess it
         // to make sure it gets the same transformations that the initial
         // one got as per XECS-2089.
         if( response.hasSdpBody() )
         {
            impl.ProcessMediaAnswer( response, INITIAL_OFFER_ANSWER );
         }
      }
      else
      {
         OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Received unexpected Successful Response for %s request",
               impl.name(), impl.GetCurrentState()->name(), seqMethod.data() );
      }
      // We have received a response - although that does
      // not cause a state machine state change, we need to reset the tick counter
      // to show that there is still activity in this dialog.
      impl.resetTimerTickCounter();
   }
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:32,代码来源:DialogTrackerStates.cpp

示例6: handleOutputMessage

void SipXProxyCseObserver::handleOutputMessage( SipMessage& message,
                                                const char* address,
                                                int port )
{
   UtlString method;
   UtlString viaValue;
   UtlString branchId;
   UtlString callId;
   int       rspStatus = 0;
   
   
   if (message.isResponse()) {
      int seq;
      if (message.getCSeqField(&seq, &method)) {
         if (0==method.compareTo(SIP_INVITE_METHOD, UtlString::ignoreCase)) {
            rspStatus = message.getResponseStatusCode();
            if (rspStatus >= SIP_2XX_CLASS_CODE) {
                SipMessageEvent* finalTransResponse = new SipMessageEvent(new SipMessage(message), SipMessageEvent::APPLICATION);
                this->postMessage(*finalTransResponse);
                delete finalTransResponse;
            }          
         }          
      }          
   }          
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:25,代码来源:SipXProxyCseObserver.cpp

示例7: 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

示例8: getAcceptedExpiration

UtlBoolean SipRefreshManager::getAcceptedExpiration(RefreshDialogState* state,
                                                    const SipMessage& sipResponse, 
                                                    int& expirationPeriod)
{
    UtlString method;
    UtlBoolean foundExpiration = FALSE;
    int cseq;
    sipResponse.getCSeqField(&cseq, &method);

    if(method.compareTo(SIP_REGISTER_METHOD) == 0)
    {

        // Get the presumably first contact in the REGISTER request
        // so that we can find the same contact in the response and
        // find out what the expiration is
        UtlString requestContact;
        Url requestContactUri;
        if(state && state->mpLastRequest &&
           state->mpLastRequest->getContactEntry(0, &requestContact))
        {
           requestContactUri = requestContact;
        }

        // Register could have it in the Contact header
        UtlString responseContactValue;
        int contactIndex = 0;
        while(sipResponse.getContactEntry(contactIndex , &responseContactValue))
        {
            // Get the expires parameter for the contact if it exists
            Url contactUri(responseContactValue);

            if(requestContactUri.isUserHostPortEqual(contactUri))
            {
                UtlString contactExpiresParameter;
                if(contactUri.getFieldParameter(SIP_EXPIRES_FIELD, 
                        contactExpiresParameter) &&
                   !contactExpiresParameter.isNull())
                {
                    foundExpiration = TRUE;

                    // Convert to int
                    expirationPeriod = atoi(contactExpiresParameter);
                }
            }
            contactIndex++;
        }
    }

    if(!foundExpiration)
    {
        // Not sure if we care if this is a request or response
        foundExpiration = sipResponse.getExpiresField(&expirationPeriod);
    }

    return(foundExpiration);
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:56,代码来源:SipRefreshManager.cpp

示例9: SuccessfulResponse

void WaitingForMediaAnswer::SuccessfulResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const
{
   int seqNum;
   UtlString seqMethod;
   
   if( response.getCSeqField( &seqNum, &seqMethod ) )
   {
      if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 )
      {
         impl.ProcessMediaAnswer( response, INITIAL_OFFER_ANSWER );
         ChangeState( impl, impl.pWaitingForAckForInvite );
      }
   }
}
开发者ID:mranga,项目名称:sipxecs,代码行数:14,代码来源:DialogTrackerStates.cpp

示例10: getSessionHandleFromVia

bool CallTracker::getSessionHandleFromVia( const SipMessage& message, int viaIndex, UtlString& sessionHandle ) const
{
   bool bSessionHandleFound = false;
   UtlString viaValue;
   sessionHandle.remove( 0 );

   if( message.getViaFieldSubField( &viaValue, viaIndex ) )
   {
      // in most cases the Via will contain a proprietary tag called 'id' which carries
      // the handle of the SessionContext - this is the fastest way retrieve the SessionContext
      // handle so try it first.
      if( message.getViaTag( viaValue, VIA_SESSION_HANDLE_TAG, sessionHandle ) )
      {
         bSessionHandleFound = true;
      }
      else
      {
         // The Via didn't contain the information we required to find the SessionContext object.
         // This can happen in cases where the sipXproxy waits for the 'best' failure response to INVITEs.
         // In such cases, for reasons that remain unknown,  the Via headers contained in the
         // 'best' response selected by sipXproxy will be stripped of our special 'id' tag
         // which is normally used to find the correct SessionContext.
         // If we are dealing with a non-200 final response for INVITES then try to find the
         // SessionContext corresponding to the Via's topmost branchId using the information
         // contained in mBranchIdToSessionHandleMap.
         int seqNum;
         UtlString seqMethod;
         message.getCSeqField( &seqNum, &seqMethod );

         if( message.isResponse() &&
             message.getResponseStatusCode() >= SIP_3XX_CLASS_CODE &&
             seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 )
         {
            UtlString branchId;
            if( message.getViaTag( viaValue, "branch", branchId ) )
            {
               UtlString* pSessionHandle;
               pSessionHandle = dynamic_cast<UtlString*>(mBranchIdToSessionHandleMap.findValue( &branchId ) );
               if( pSessionHandle )
               {
                  sessionHandle = *pSessionHandle;
                  bSessionHandleFound = true;
               }
            }
         }
      }
   }
   return bSessionHandleFound;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:49,代码来源:CallTracker.cpp

示例11: lock

enum SipDialogMgr::transactionSequence
    SipDialogMgr::isNewRemoteTransaction(const SipMessage& message)
{
    enum transactionSequence ordering;
    UtlString handle;
    message.getDialogHandle(handle);

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    SipDialog::parseHandle(handle, callId, fromTag, 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))
    {
       int messageCSeq;
       message.getCSeqField(&messageCSeq, NULL);
       int lastRemoteCSeq = dialog->getLastRemoteCseq();
       ordering =
          messageCSeq < lastRemoteCSeq ? OUT_OF_ORDER :
          /** If this message was an exact duplicate of a previous message
           *  (with the same CSeq and branch parameter), it would have been
           *  absorbed earlier in processing.  So we know the branch parameter
           *  is different without having to remember the previous value.
           */
          messageCSeq == lastRemoteCSeq ? LOOPED :
          IN_ORDER;
    }
    else
    {
       ordering = NO_DIALOG;
    }

    unlock();
    
    return ordering;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:43,代码来源:SipDialogMgr.cpp

示例12: ChangeState

void WaitingFor200OkForPrack::SuccessfulResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const
{
   int seqNum;
   UtlString seqMethod;

   if( response.getCSeqField( &seqNum, &seqMethod ) )
   {
      if( seqMethod.compareTo( SIP_PRACK_METHOD ) == 0 )
      {
         ChangeState( impl, impl.pProcessingPrackWaitingForAckforInvite );
      }
      else
      {
         // Not interesting for us but our parent class provides some handling for
         // other successful responses.
         ProcessingPrack::SuccessfulResponse( impl, response, address, port );
      }
   }
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:19,代码来源:DialogTrackerStates.cpp

示例13: 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

示例14: 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

示例15: handleRegisterRequest

UtlBoolean TestRegistrar::handleRegisterRequest(SipMessage message)
{
    UtlBoolean messageProcessed = false;
    SipMessage finalResponse;
    UtlString responseToAddress;
    UtlString protocol;
    int responseToPort;
    int seqNum;
    UtlString method;
    UtlString contactField;
    int expires;
    static int retrySeqNum = 0;
    UtlString callId;

    message.getCallIdField(&callId);

    message.getContactField(0, contactField);
    message.getExpiresField(&expires);

    message.getCSeqField(&seqNum, &method);
    message.getFromAddress(&responseToAddress, &responseToPort, &protocol);

    finalResponse.setContactField(contactField);
    finalResponse.setExpiresField(expires);
    finalResponse.setFromField("sip:127.0.0.1:5070", 5070);
    finalResponse.setSendAddress(contactField, responseToPort);
    finalResponse.setToField(contactField, responseToPort, protocol);
    finalResponse.setUserAgentField("TestRegistrar");
//    finalResponse.setRegisterData(responseToAddress, contactField, "127.0.0.1", contactField, callId, seqNum);

    if (contactField.contains("anon"))      // anonymous user doesnt need authentication, just say ok
    {
        finalResponse.setResponseData(&message, 200, "OK");
    }
    else if (contactField.contains("mike"))  // mike requires registration, say 401
    {
        UtlString realm;

        UtlString requestUser;
        UtlString requestRealm;
        UtlString requestNonce;
        UtlString uriParam;

        // TBD - 25-jan-2010 work might be needed if these tests are re-enabled
        message.getDigestAuthorizationData(
                   &requestUser, &requestRealm, &requestNonce,
                   NULL, NULL, &uriParam,
                   NULL,  // TBD cnonce
                   NULL,  // TBD nonceCount
                   NULL,  // TBD qop
                   HttpMessage::SERVER, 0);

        if (seqNum == retrySeqNum) // if this is a retry response
        {
            // if they've sent any auth field, just accept it.
            // TODO:  figure out if a username and password has been encrypted and sent.
            finalResponse.setCSeqField(++seqNum, SIP_REGISTER_METHOD);
            finalResponse.setResponseData(&message, 200, "OK");
        }
        else
        {
            message.getCSeqField(&seqNum, &method);
            finalResponse.setCSeqField(++seqNum, method);
            retrySeqNum = seqNum;
#ifdef _WIN32
            finalResponse.setAuthenticateData("md5", "TestRegistrar", NULL, NULL, NULL, HttpMessage::HttpEndpointEnum::SERVER );
#else
            finalResponse.setAuthenticateData("md5", "TestRegistrar", NULL, NULL, NULL, HttpMessage::SERVER );
#endif
            finalResponse.setResponseData(&message, 401, "Not authorized");
        }
    }
    else if (contactField.contains("xyzzy"))
    {
        // this is our special username that will cause a response
        // to be echoed back with the 3 digit value after xyzzy.
        // for instance, the contact xyzzy401 will cause a 401 response
        int pos = contactField.first("xyzzy");
        char szCode[4];
        szCode[0] = contactField[pos + 5];
        szCode[1] = contactField[pos + 6];
        szCode[2] = contactField[pos + 7];
        szCode[3] = '\0';

        finalResponse.setResponseData(&message, atoi(szCode), "OK");
    }


    mpUserAgent->send(finalResponse);

    return messageProcessed;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:92,代码来源:TestRegistrar.cpp


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