📄 serverinvitesession.cxx
字号:
voidServerInviteSession::dispatchWaitingToOffer(const SipMessage& msg){ InviteSessionHandler* handler = mDum.mInviteSessionHandler; std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg); InfoLog (<< "dispatchWaitingToOffer: " << msg.brief()); switch (toEvent(msg, sdp.get())) { case OnAck: { assert(mProposedLocalSdp.get()); mCurrentRetransmit200 = 0; // stop the 200 retransmit timer provideProposedOffer(); break; } case OnAckAnswer: { mCurrentRetransmit200 = 0; // stop the 200 retransmit timer sendBye(); transition(Terminated); handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg); break; } case OnCancel: { // Cancel and 200 crossed SharedPtr<SipMessage> c200(new SipMessage); mDialog.makeResponse(*c200, msg, 200); send(c200); break; } case OnBye: { SharedPtr<SipMessage> b200(new SipMessage); mDialog.makeResponse(*b200, msg, 200); send(b200); transition(Terminated); handler->onTerminated(getSessionHandle(), InviteSessionHandler::PeerEnded, &msg); mDum.destroy(this); break; } default: if(msg.isRequest()) { dispatchUnknown(msg); } break; }}voidServerInviteSession::dispatchWaitingToRequestOffer(const SipMessage& msg){ InviteSessionHandler* handler = mDum.mInviteSessionHandler; std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg); InfoLog (<< "dispatchWaitingToRequestOffer: " << msg.brief()); switch (toEvent(msg, sdp.get())) { case OnAck: { mCurrentRetransmit200 = 0; // stop the 200 retransmit timer requestOffer(); break; } case OnAckAnswer: { mCurrentRetransmit200 = 0; // stop the 200 retransmit timer sendBye(); transition(Terminated); handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg); break; } case OnCancel: { // Cancel and 200 crossed SharedPtr<SipMessage> c200(new SipMessage); mDialog.makeResponse(*c200, msg, 200); send(c200); break; } case OnBye: { SharedPtr<SipMessage> b200(new SipMessage); mDialog.makeResponse(*b200, msg, 200); send(b200); transition(Terminated); handler->onTerminated(getSessionHandle(), InviteSessionHandler::PeerEnded, &msg); mDum.destroy(this); break; } default: if(msg.isRequest()) { dispatchUnknown(msg); } break; }}voidServerInviteSession::dispatchAcceptedWaitingAnswer(const SipMessage& msg){ InviteSessionHandler* handler = mDum.mInviteSessionHandler; std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg); switch (toEvent(msg, sdp.get())) { case OnAckAnswer: { mCurrentRetransmit200 = 0; // stop the 200 retransmit timer transition(Connected); setCurrentLocalSdp(msg); mCurrentEncryptionLevel = getEncryptionLevel(msg); mCurrentRemoteSdp = InviteSession::makeSdp(*sdp); handler->onAnswer(getSessionHandle(), msg, *sdp); if(!isTerminated()) // onAnswer callback may call end() or reject() { handler->onConnected(getSessionHandle(), msg); } break; } case OnAck: { mCurrentRetransmit200 = 0; // stop the 200 retransmit timer mEndReason = IllegalNegotiation; sendBye(); transition(Terminated); handler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg); break; } case OnCancel: { // no transition SharedPtr<SipMessage> c200(new SipMessage); mDialog.makeResponse(*c200, msg, 200); send(c200); break; } case OnPrack: // broken { // no transition SharedPtr<SipMessage> p200(new SipMessage); mDialog.makeResponse(*p200, msg, 200); send(p200); sendAccept(200, 0); break; } default: if(msg.isRequest()) { dispatchUnknown(msg); } break; }}voidServerInviteSession::dispatchOfferReliable(const SipMessage& msg){}voidServerInviteSession::dispatchNoOfferReliable(const SipMessage& msg){}voidServerInviteSession::dispatchFirstSentOfferReliable(const SipMessage& msg){}voidServerInviteSession::dispatchFirstEarlyReliable(const SipMessage& msg){}voidServerInviteSession::dispatchEarlyReliable(const SipMessage& msg){}voidServerInviteSession::dispatchSentUpdate(const SipMessage& msg){}voidServerInviteSession::dispatchSentUpdateAccepted(const SipMessage& msg){}voidServerInviteSession::dispatchReceivedUpdate(const SipMessage& msg){}voidServerInviteSession::dispatchReceivedUpdateWaitingAnswer(const SipMessage& msg){}voidServerInviteSession::dispatchWaitingToTerminate(const SipMessage& msg){}voidServerInviteSession::dispatchWaitingToHangup(const SipMessage& msg){ std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg); switch (toEvent(msg, sdp.get())) { case OnPrack: case OnAck: case OnAckAnswer: { mCurrentRetransmit200 = 0; // stop the 200 retransmit timer sendBye(); transition(Terminated); mDum.mInviteSessionHandler->onTerminated(getSessionHandle(), InviteSessionHandler::Ended); break; } default: break; }}voidServerInviteSession::dispatchCancel(const SipMessage& msg){ SharedPtr<SipMessage> c200(new SipMessage); mDialog.makeResponse(*c200, msg, 200); send(c200); SharedPtr<SipMessage> i487(new SipMessage); mDialog.makeResponse(*i487, mFirstRequest, 487); send(i487); transition(Terminated); mDum.mInviteSessionHandler->onTerminated(getSessionHandle(), InviteSessionHandler::PeerEnded, &msg); mDum.destroy(this);}voidServerInviteSession::dispatchBye(const SipMessage& msg){ SharedPtr<SipMessage> b200(new SipMessage); mDialog.makeResponse(*b200, msg, 200); send(b200); SharedPtr<SipMessage> i487(new SipMessage); mDialog.makeResponse(*i487, mFirstRequest, 487); send(i487); transition(Terminated); mDum.mInviteSessionHandler->onTerminated(getSessionHandle(), InviteSessionHandler::PeerEnded, &msg); mDum.destroy(this);}voidServerInviteSession::dispatchUnknown(const SipMessage& msg){ SharedPtr<SipMessage> r481(new SipMessage); // !jf! what should we send here? mDialog.makeResponse(*r481, msg, 481); send(r481); SharedPtr<SipMessage> i400(new SipMessage); mDialog.makeResponse(*i400, mFirstRequest, 400); send(i400); transition(Terminated); mDum.mInviteSessionHandler->onTerminated(getSessionHandle(), InviteSessionHandler::GeneralFailure, &msg); mDum.destroy(this);}void ServerInviteSession::startRetransmit1xxTimer(){ // RFC3261 13.3.1 says the UAS must send a non-100 provisional response every minute, to handle the possiblity of lost provisional responses mCurrentRetransmit1xx = mDialog.mDialogSet.getUserProfile()->get1xxRetransmissionTime(); if(mCurrentRetransmit1xx > 0) { unsigned int seq = m1xx->header(h_CSeq).sequence(); mDum.addTimer(DumTimeout::Retransmit1xx, mCurrentRetransmit1xx, getBaseHandle(), seq); }}voidServerInviteSession::sendProvisional(int code, bool earlyFlag){ mDialog.makeResponse(*m1xx, mFirstRequest, code); switch (mState) { case UAS_OfferProvidedAnswer: case UAS_EarlyProvidedAnswer: if (earlyFlag && mCurrentLocalSdp.get()) // early media { setSdp(*m1xx, mCurrentLocalSdp.get()); } break; default: break; } startRetransmit1xxTimer(); DumHelper::setOutgoingEncryptionLevel(*m1xx, mProposedEncryptionLevel); send(m1xx);}voidServerInviteSession::sendAccept(int code, Contents* sdp){ mDialog.makeResponse(*mInvite200, mFirstRequest, code); handleSessionTimerRequest(*mInvite200, mFirstRequest); if (sdp) { setSdp(*mInvite200, sdp); } mCurrentRetransmit1xx = 0; // Stop the 1xx timer startRetransmit200Timer(); // 2xx timer DumHelper::setOutgoingEncryptionLevel(*mInvite200, mCurrentEncryptionLevel); send(mInvite200);}voidServerInviteSession::sendUpdate(const SdpContents& sdp){ if (updateMethodSupported()) { mDialog.makeRequest(*mLastLocalSessionModification, UPDATE); InviteSession::setSdp(*mLastLocalSessionModification, sdp); DumHelper::setOutgoingEncryptionLevel(*mLastLocalSessionModification, mProposedEncryptionLevel); send(mLastLocalSessionModification); } else { throw UsageUseException("Can't send UPDATE to peer", __FILE__, __LINE__); }}/* ==================================================================== * 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 + -