?? sip_invite_state.hxx.~3~
字號(hào):
//====================================================================// // Copyright (C) 2006-2007, 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<event> evt ) { shared_ptr<sip_event> sip_evt; sip_evt.reset( evt ); if( !sip_evt ) return false ; shared_ptr<sip_msg> msg; msg.reset( sip_evt->get_msg( ) ); if( !msg ) return true ; shared_ptr<sip_cmd> cmd; cmd.reset( msg ); if( cmd ) return on_process( cmd ); shared_ptr<sip_status> status ; status.reset( msg ); if( status ) return on_process( status ); return false ; } bool on_process( shared_ptr<sip_cmd> cmd ) { 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 ; } bool on_process( shared_ptr<sip_status> status ) {#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 ; if( agent->uac( ) ) swicth_to<sip_ring_state>( );#endif // there is not need to process return true ; }};#endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -