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

📄 sip_invite_state.hxx

📁 模拟移动客户端软件飞信登录的状态机器定义代码。
💻 HXX
字号:
//====================================================================//                // Copyright (C) 2006-2008,  Frank.Ning//                // Filename:      sip_invite_state.hxx// Author:        Frank.Ning <zegong.ning@dinglicom.com>// Description:   //                // $Id:$//                //====================================================================#ifndef __SIP_INVITE_STATE_HXX__#define __SIP_INVITE_STATE_HXX__#include "state.hxx"static const char* const sip_invite_state_hxx_version =   "$Id:$";struct sip_invite_state : public fsm::state<sip_invite_state, FetionInviteStateList, bool>{      bool on_process( shared_ptr<sip_cmd> cmd , ua_agent* parent )      {#if 0         ua_callctl& ua = ua_callctl::instance( );         shared_ptr<sip_callid> callid;         callid.reset( cmd->get_hdr( HDR_CALLID ) );         shared_ptr<ua_agent> agent = ua.find_agent( callid->get_callid( ) );         if( !agent )            return false ;         agent->set_last_sip_cmd_msg( cmd );                  // check there is CANCEL command         if( cmd->get_method( ) == "C" ||             cmd->get_method( ) == "CANCEL" )         {            agent->stop( );            return true ;         }         if( agent->uas( ) )         {            shared_ptr<sip_status> trying_msg = agent->build_trying_msg( cmd );            // Ack to Proxy server            ua.get_output_channel( )->add( shared_ptr<sip_event>( trying_msg ) );            agent->set_last_sip_status_msg( trying_msg );                        // Ack to peer agent            shared_ptr<sip_status> ring_msg = agent->build_ring_msg( cmd );            ua.get_input_channel( )->add( shared_ptr<sip_event>( ring_msg ) ); // Send from ring state                     }         else         {            // UAC cmd is INVITE msg, send to            ua.get_output_channel( )->add( shared_ptr<sip_event>( cmd ) );         }                  switch_to<sip_ring_state>( );         return true ;#endif         // check there is CANCEL command         if( cmd->get_method( ) == "C" ||             cmd->get_method( ) == "CANCEL" )         {            agent->stop( );            return true ;         }                  return false ;               }      bool on_process( shared_ptr<sip_status> status , ua_agent* parent)      {         ua_callctl& ua = ua_callctl::instance( );                  parent->set_last_sip_status_msg( status );         if( status->status_code( ) == 100 )         {            // Proxy Notify client is trying to connect peer            return true ;         }         if( status->status_code( ) == 180 )         {            // Peer notify to ring            switch_to<sip_ring_state>( );            return true ;         }                  // there is not need to process          return false ;      }      bool on_process( shared_ptr<keybord_msg> msg, ua_agent* parent )      {         ua_callctl& ua = ua_callctl::instance( );                  if( msg->get_cmd( ) == "CANCEL" )         {            shared_ptr<sip_cmd> cancel = parent->build_cancel_msg( parent->get_last_sip_cmd_msg( ) );            parent->set_last_sip_cmd_msg( cancel );                        ua.get_output_channel( )->add( cancel );            parent->stop( );            return true ;         }         return false ;      }      };#endif   

⌨️ 快捷键说明

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