📄 uastatemachine.cxx
字号:
/* ==================================================================== * 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/>. * */static const char* const UaStateMachine_cxx_Version = "$Id: UaStateMachine.cxx,v 1.28 2002/11/09 02:13:08 derekm Exp $";#include "global.h"#include "State.hxx"#include "UaStateMachine.hxx"#include "UaCallInfo.hxx"#include "StateBusy.hxx"#include "StateCallEnded.hxx"#include "StateDialing.hxx"#include "StateError.hxx"#include "StateFastBusy.hxx"#include "StateIdle.hxx"#include "StateInCall.hxx"#include "StateRinging.hxx"#include "StateTrying.hxx"#include "StateInCallDialing.hxx"#include "StateReRinging.hxx"#include "StateInCallTrying.hxx"#include "StateIn2Calls.hxx"#include "StateBeingXferred.hxx"#include "StateBlindXferring.hxx"#include "StateConsultXferring.hxx"#include "StateInCallBusy.hxx"#include "StateInCallFastBusy.hxx"#include "StateConferencing.hxx"#include "StateBusyHere.hxx"#include "StateOnhold.hxx"#include "StateAutoIdle.hxx"#include "StateAutoTrying.hxx"#include "StateAutoInCall.hxx"#include "UaConfiguration.hxx"#include "StateAutoRS.hxx"using namespace Vocal;///UaStateMachine::UaStateMachine(){ cpLog( LOG_DEBUG, "User Agent State Machine" ); if ( UaConfiguration::instance()->getLoadGenOn() ) { if (UaConfiguration::instance()->getRunMode() == "RSTest") { cpLog(LOG_DEBUG, "*** StateMachine for RS Test ***"); addState( new StateAutoRS ); } else if (UaConfiguration::instance()->getRunMode() == "Calling") { // State for calling cpLog(LOG_DEBUG, "*** StateMachine for Calling Load Gen Used ***"); addState( new StateAutoIdle ); addState( new StateAutoTrying ); addState( new StateAutoInCall ); } else if (UaConfiguration::instance()->getRunMode() == "Receiving") { // State for receiving cpLog(LOG_DEBUG, "*** StateMachine for Receiving Load Gen Used ***"); addState( new StateAutoIdle ); addState( new StateAutoInCall ); } else { cpLog(LOG_ERR, "******* RUNNING MODE IS NOT CORRECTLY SET! *******"); assert ( 0 ); } } else { addState( new StateBusy ); addState( new StateCallEnded ); addState( new StateDialing ); addState( new StateError ); addState( new StateFastBusy ); addState( new StateIdle ); addState( new StateInCall ); addState( new StateRinging ); addState( new StateTrying ); addState( new StateBusyHere ); addState( new StateOnhold ); const UaXferMode xferMode = UaConfiguration::instance()->getXferMode(); if ( xferMode != XferOff ) { addState( new StateInCallDialing ); addState( new StateReRinging ); addState( new StateIn2Calls ); addState( new StateBeingXferred ); addState( new StateInCallBusy ); addState( new StateInCallFastBusy ); addState( new StateInCallTrying ); if ( xferMode == XferOn ) { addState( new StateBlindXferring ); addState( new StateConsultXferring ); } else if ( xferMode == ConfOn ) { addState( new StateConferencing ); } } }} // UaStateMachine::UaStateMachine///UaStateMachine::~UaStateMachine(){} // UaStateMachine::~UaStateMachinevoidUaStateMachine::process( const Sptr < SipProxyEvent > event ){ assert( event != 0 ); Sptr<UaCallInfo> call; call.dynamicCast( event->getCallInfo() ); assert( call != 0 ); cpLog( LOG_DEBUG, "Current State is %s", call->getState()->name() ); Sptr<State> nextState = call->getState()->process( event ); if( nextState != PROXY_CONTINUE ) { call->setState( nextState ); cpLog( LOG_DEBUG, "Next State is %s", nextState->name() ); }} // UaStateMachine::process///Sptr < State >UaStateMachine::findState( const string stateName ){ StateIter iter = myStates.begin(); while ( iter != myStates.end() ) { if ( stateName == (*iter)->name() ) { return *iter; } iter++; } return 0;}///const char* constUaStateMachine::name() const{ return "User Agent State Machine";} // UaStateMachine::name
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -