⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientinvitesession.cxx

📁 这是国外的resip协议栈
💻 CXX
📖 第 1 页 / 共 3 页
字号:
         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         mDum.destroy(this);         break;      case OnBye:         dispatchBye(msg);         break;      default:         // !kh!         // should not assert here for peer sent us garbage.         WarningLog (<< "Don't know what this is : " << msg);         break;   }}voidClientInviteSession::dispatchSentAnswer (const SipMessage& msg){   InviteSessionHandler* handler = mDum.mInviteSessionHandler;   std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);   switch (toEvent(msg, sdp.get()))   {      case On200Prack:         transition(UAC_EarlyWithAnswer);         break;      case On2xx:         transition(Connected);         sendAck();         handleFinalResponse(msg);         handler->onConnected(getHandle(), msg);         break;      case On2xxAnswer:      case On2xxOffer:      case On1xxAnswer:      case On1xxOffer:         sendAck();         sendBye();         InfoLog (<< "Failure:  illegal offer/answer: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         break;      case On1xx:         handleProvisional(msg);         sendPrackIfNeeded(msg);         break;      case OnRedirect: // Redirects are handled by the DialogSet - if a 3xx gets here then it's because the redirect was intentionaly not handled and should be treated as an INVITE failure      case OnInviteFailure:      case OnGeneralFailure:      case On422Invite:      case On487Invite:      case On491Invite:         InfoLog (<< "Failure:  error response: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         mDum.destroy(this);         break;      case OnBye:         dispatchBye(msg);         break;      default:         // !kh!         // should not assert here for peer sent us garbage.         WarningLog (<< "Don't know what this is : " << msg);         break;   }}voidClientInviteSession::dispatchQueuedUpdate (const SipMessage& msg){   InviteSessionHandler* handler = mDum.mInviteSessionHandler;   std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);   switch (toEvent(msg, sdp.get()))   {      case On200Prack:         transition(UAC_SentUpdateEarly);         {            mDialog.makeRequest(*mLastLocalSessionModification, UPDATE);            InviteSession::setSdp(*mLastLocalSessionModification, mProposedLocalSdp.get());            DumHelper::setOutgoingEncryptionLevel(*mLastLocalSessionModification, mProposedEncryptionLevel);            send(mLastLocalSessionModification);         }         break;      case On2xx:         transition(SentUpdate);         {            sendAck();            SharedPtr<SipMessage> update(new SipMessage);            mDialog.makeRequest(*update, UPDATE);            InviteSession::setSdp(*update, mProposedLocalSdp.get());            DumHelper::setOutgoingEncryptionLevel(*update, mProposedEncryptionLevel);            send(update);         }         handleFinalResponse(msg);         handler->onConnected(getHandle(), msg);         break;      case On2xxAnswer:      case On2xxOffer:      case On1xxAnswer:      case On1xxOffer:         sendAck();         sendBye();         InfoLog (<< "Failure:  illegal offer/answer: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         break;      case On1xx:         handleProvisional(msg);         sendPrackIfNeeded(msg);         break;      case OnRedirect: // Redirects are handled by the DialogSet - if a 3xx gets here then it's because the redirect was intentionaly not handled and should be treated as an INVITE failure      case OnInviteFailure:      case OnGeneralFailure:      case On422Invite:      case On487Invite:      case On491Invite:         InfoLog (<< "Failure:  error response: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         mDum.destroy(this);         break;      case OnBye:         dispatchBye(msg);         break;      default:         // !kh!         // should not assert here for peer sent us garbage.         WarningLog (<< "Don't know what this is : " << msg);         break;   }}voidClientInviteSession::dispatchEarlyWithAnswer (const SipMessage& msg){   InviteSessionHandler* handler = mDum.mInviteSessionHandler;   std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);   switch (toEvent(msg, sdp.get()))   {      case On1xx:         handleProvisional(msg);         sendPrackIfNeeded(msg);         break;      case On1xxOffer:         if(!isTerminated())           {            transition(UAC_EarlyWithOffer);            handleOffer(msg, *sdp);         }         break;      case On2xx:         transition(Connected);         sendAck();         handleFinalResponse(msg);         handler->onConnected(getHandle(), msg);         break;      case On2xxAnswer:      case On2xxOffer:         sendAck();         sendBye();         InfoLog (<< "Failure:  illegal offer/answer: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         break;      case OnUpdateOffer:         *mLastRemoteSessionModification = msg;         transition(UAC_ReceivedUpdateEarly);         mCurrentEncryptionLevel = getEncryptionLevel(msg);         mProposedRemoteSdp = InviteSession::makeSdp(*sdp);         handler->onOffer(getSessionHandle(), msg, *sdp);         break;      case OnRedirect: // Redirects are handled by the DialogSet - if a 3xx gets here then it's because the redirect was intentionaly not handled and should be treated as an INVITE failure      case OnInviteFailure:      case OnGeneralFailure:      case On422Invite:      case On487Invite:      case On491Invite:         InfoLog (<< "Failure:  error response: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         mDum.destroy(this);         break;      case OnBye:         dispatchBye(msg);         break;      default:         // !kh!         // should not assert here for peer sent us garbage.         WarningLog (<< "Don't know what this is : " << msg);         break;   }}voidClientInviteSession::dispatchSentUpdateEarly (const SipMessage& msg){   InviteSessionHandler* handler = mDum.mInviteSessionHandler;   std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);   switch (toEvent(msg, sdp.get()))   {      case On200Update:         transition(UAC_EarlyWithAnswer);         setCurrentLocalSdp(msg);         mCurrentEncryptionLevel = getEncryptionLevel(msg);         mCurrentRemoteSdp = InviteSession::makeSdp(*sdp);         handler->onAnswer(getSessionHandle(), msg, *sdp);         break;               case OnUpdateOffer:         transition(UAC_SentUpdateEarly);         {            SharedPtr<SipMessage> response(new SipMessage);            mDialog.makeResponse(*response, msg, 491);            send(response);         }         break;               case On491Update:         transition(UAC_SentUpdateEarlyGlare);         start491Timer();         break;      case On2xx:         transition(SentUpdate);                  sendAck();         break;               case OnRedirect: // Redirects are handled by the DialogSet - if a 3xx gets                       // here then it's because the redirect was intentionaly                       // not handled and should be treated as an INVITE failure      case OnInviteFailure:      case OnGeneralFailure:      case On422Invite:      case On487Invite:         InfoLog (<< "Failure:  error response: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         mDum.destroy(this);         break;      default:         WarningLog (<< "Don't know what this is : " << msg);         break;   }}voidClientInviteSession::dispatchSentUpdateEarlyGlare (const SipMessage& msg){   InviteSessionHandler* handler = mDum.mInviteSessionHandler;   std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);   switch (toEvent(msg, sdp.get()))   {      case OnUpdateOffer:         handler->onOfferRejected(getSessionHandle(), &msg);         //will cause transition to UAC_ReceivedUpdateEarly         dispatchEarlyWithAnswer(msg);         break;               case On2xx:         //transition to connected state machine         transition(SentUpdateGlare);                  sendAck();         break;         //!dcm! TODO This block below is repeated many, many times...refactor         //!into a method. Prob. represents the effective ClientInvite superstate.      case OnRedirect: // Redirects are handled by the DialogSet - if a 3xx gets                       // here then it's because the redirect was intentionaly                       // not handled and should be treated as an INVITE failure      case OnInviteFailure:      case OnGeneralFailure:      case On422Invite:      case On487Invite:         InfoLog (<< "Failure:  error response: " << msg.brief());         transition(Terminated);         handler->onFailure(getHandle(), msg);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg);         mDum.destroy(this);         break;      default:         WarningLog (<< "Don't know what this is : " << msg);         break;   }}voidClientInviteSession::dispatchReceivedUpdateEarly (const SipMessage& msg){   /*   InviteSessionHandler* handler = mDum.mInviteSessionHandler;   std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);   switch (toEvent(msg, sdp.get()))   {      default:         // !kh!         // should not assert here for peer sent us garbage.         WarningLog (<< "Don't know what this is : " << msg);         break;   }   */   WarningLog (<< "Ignoring message received in ReceivedUpdateEarly: " << msg);}voidClientInviteSession::dispatchCancelled (const SipMessage& msg){   InviteSessionHandler* handler = mDum.mInviteSessionHandler;   std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);   switch (toEvent(msg, sdp.get()))   {      case OnGeneralFailure:      case OnCancelFailure:      case On487Invite:      case OnRedirect:      case On422Invite:      case On491Invite:      case OnInviteFailure:         transition(Terminated);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::Cancelled, &msg);         mDum.destroy(this);         break;      case On2xx:      case On2xxOffer:      case On2xxAnswer:      {         // this is the 2xx crossing the CANCEL case         sendAck();         sendBye();         transition(Terminated);         handler->onTerminated(getSessionHandle(), InviteSessionHandler::Cancelled, &msg);         mCancelledTimerSeq++;         break;      }      case OnBye:         dispatchBye(msg);         break;      default:         break;   }}//true if 180rel should be ignored. Saves rseq as a side effect.bool ClientInviteSession::checkRseq(const SipMessage& msg){   int code = msg.isResponse() ? msg.header(h_StatusLine).statusCode() : 0;   if (msg.method() == INVITE && code > 100 && code < 200)   {      if (msg.exists(h_RSeq))      {         // store state about the provisional if reliable, so we can detect retransmissions         unsigned int rseq = (unsigned int) msg.header(h_RSeq).value();         unsigned int lastRseq = (unsigned int) mRelRespInfo.rSequence();                  if (rseq == lastRseq)         {            DebugLog(<< "Discarding reliable 1xx retranmission with rseq " << rseq);            return true;         }         else if (lastRseq != 0 && rseq > lastRseq + 1)         {            DebugLog(<< "Discarding out of order reliable 1xx with rseq " << rseq);            return true;         }         mRelRespInfo.rSequence() = rseq;         mRelRespInfo.cSequence() = msg.header(h_CSeq).sequence();         mRelRespInfo.method() = msg.header(h_CSeq).method();      }   }   return false;}   /* ==================================================================== * The Vovida Software License, Version 1.0 * * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. * * 3. The names "VOCAL", "Vovida Open Communication Application Library", *    and "Vovida Open Communication Application Library (VOCAL)" must *    not be used to endorse or promote products derived from this *    software without prior written permission. For written *    permission, please contact vocal@vovida.org. * * 4. Products derived from this software may not be called "VOCAL", nor *    may "VOCAL" appear in their name, without prior written *    permission of Vovida Networks, Inc. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * ==================================================================== * * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc.  For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>. * */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -