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

📄 rtcptransactiongetfloor.cxx

📁 MiniSip Client with DomainKeys Authentication, Sip, Audio communications, Echo Cancel
💻 CXX
📖 第 1 页 / 共 2 页
字号:
		}		CommandString c(/*gf->*/ /*getDialog()->getCallId()*/ callId, "p2tRequestAnswered",					itoa(/*gf->*/getRemoteSSRC()), 					itoa(/*gf->*/getSeqNo()), 					p3);		SipSMCommand cmd(c, SipSMCommand::transaction, SipSMCommand::TU);		/*gf->*/ /*getDialog()*/ dialog->getDialogContainer()->enqueueCommand(cmd, HIGH_PRIO_QUEUE, PRIO_LAST_IN_QUEUE);								return true;	}else{		return false;	}}bool RtcpTransactionGetFloor::a7_completed_completed_grant( const SipSMCommand &command){	if (transitionMatch(command, "p2tGRANT")){				//do nothing				return true;	}else{		return false;	}}bool RtcpTransactionGetFloor::a8_completed_completed_request( const SipSMCommand &command){	if (transitionMatch(command, "p2tREQUEST")){				//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;				//check remote sequence number		if(command.getCommandString().getParam2()!=itoa(/*gf->*/getRemoteSeqNo()))			return false;				//resen Floor REQUEST		//if this transaction interacts in a collision simulation		//with the user that sent first a REQUEST message		//used for development purposes.		if(/*gf->*/first_invitation){			if(command.getCommandString().getParam3()==/*gf->*/getUser()){				/*gf->*/sendRequest();			}			return true;		}				/*merr<<"----------------------------------------"<<end;		merr<<"RtcpTransactionGetFloor:::a8"<<end;		merr<<"user="<<gf->getUser()<<end;		merr<<"cmd="<<command.getCommandString().getOp()<<end;		merr<<"p1="<<command.getCommandString().getParam()<<end;		merr<<"p2="<<command.getCommandString().getParam2()<<end;		merr<<"p3="<<command.getCommandString().getParam3()<<end;		merr<<"cf="<<itoa(gf->CollisionCounter)<<end;		merr<<"-------------------------------------------"<<end;*/				return true;	}else{		return false;	}}void RtcpTransactionGetFloor::setUpStateMachine(){		State<SipSMCommand,string> *s_start=new State<SipSMCommand,string>(this,"start");	addState(s_start);	State<SipSMCommand,string> *s_req_sent=new State<SipSMCommand,string>(this,"req_sent");	addState(s_req_sent);	State<SipSMCommand,string> *s_completed=new State<SipSMCommand,string>(this,"completed");	addState(s_completed);		State<SipSMCommand,string> *s_terminated=new State<SipSMCommand,string>(this,"terminated");	addState(s_terminated);//	StateTransition<SipSMCommand,string> *transition_start_reqsent=		new StateTransition<SipSMCommand,string>(this,				"transition_start_reqsent",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a0_start_reqsent, 				s_start, s_req_sent				);	//	StateTransition<SipSMCommand,string> *transition_reqsent_reqsent=		new StateTransition<SipSMCommand,string>(this,				"transition_reqsent_reqsent",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a1_reqsent_reqsent, 				s_req_sent, s_req_sent				);//	StateTransition<SipSMCommand,string> *transition_reqsent_completed_grant=		new StateTransition<SipSMCommand,string>(this,				"transition_reqsent_completed_grant",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a2_reqsent_completed_grant, 				s_req_sent, s_completed				);//	StateTransition<SipSMCommand,string> *transition_reqsent_completed_request=		new StateTransition<SipSMCommand,string>(this,				"transition_reqsent_completed_request",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a3_reqsent_completed_request, 				s_req_sent, s_completed				);	//	StateTransition<SipSMCommand,string> *transition_reqsent_completed_timer=		new StateTransition<SipSMCommand,string>(this,				"transition_reqsent_completed_timer",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a4_reqsent_completed_timer, 				s_req_sent, s_completed				);	//	StateTransition<SipSMCommand,string> *transition_completed_terminated=		new StateTransition<SipSMCommand,string>(this,				"transition_completed_terminated",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a5_completed_terminated, 				s_completed, s_terminated				);				//	StateTransition<SipSMCommand,string> *transition_reqsent_terminated=		new StateTransition<SipSMCommand,string>(this,				"transition_reqsent_terminated",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a6_reqsent_terminated, 				s_req_sent, s_terminated				);				/*	StateTransition<SipSMCommand,string> *transition_completed_completed_grant=		new StateTransition<SipSMCommand,string>(this,				"transition_completed_completed_grant",				a7_completed_completed_grant, 				s_completed, s_completed				);*/	//	StateTransition<SipSMCommand,string> *transition_completed_completed_request=		new StateTransition<SipSMCommand,string>(this,				"transition_completed_completed_request",				(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &RtcpTransactionGetFloor::a8_completed_completed_request, 				s_completed, s_completed				);		setCurrentState(s_start);}RtcpTransactionGetFloor::RtcpTransactionGetFloor(MRef<SipDialog*> dialog, int seqNo, IPAddress *toaddr, int32_t port, string callId, unsigned remoteSSRC) : 	SipTransaction(/*"RtcpTransactionGetFloor",*/dialog->getSipStack(), dialog,seqNo,"", callId),		seqNo(seqNo),		remoteSSRC(remoteSSRC){	//this->toaddr = toaddr;	this->port = port;		counter=1;	tGrant=P2T::timerGRANT;	tGetTimeout=P2T::timerGetTIMEOUT;	tGetFloorTerminate=P2T::timerGetFloorTERMINATE;		CollisionCounter=0;	remoteSeqNo=-1;		first_invitation=false;	setUpStateMachine();}RtcpTransactionGetFloor::~RtcpTransactionGetFloor(){#ifdef DEBUG_OUTPUT	merr<< "RtcpTransactionGetFloor::~RtcpTransactionGetFloor invoked"<< end;#endif}bool RtcpTransactionGetFloor::handleCommand(const SipSMCommand &c){		mdbg<<"RtcpTransactionGetFloor::handleCommand"<<end;			//wrong destination	if (c.getDestination()!=SipSMCommand::transaction && c.getDestination()!=SipSMCommand::ANY)		return false;		//CommandPacket instead of CommandString	if (c.getType()==SipSMCommand::COMMAND_PACKET)		return false;		//check ssrc only if it's not a 'timer'-Command		if(c.getCommandString().getOp().substr(0,5) != "timer"){					if(CollisionCounter==0){						//check SIP URI				if(c.getCommandString().getParam3()!=user)				return false;				}		else if(CollisionCounter>0) {			//check SSRC			if(c.getCommandString().getParam()!=itoa(remoteSSRC))				return false;						//check CollisionCounter in REQUEST messages			if(c.getCommandString().getOp()=="p2tREQUEST"){				if(c.getCommandString().getParam3()!= itoa(CollisionCounter))					return false;			}					}			/*		//check ssrc or SIP URI		if (getRemoteSSRC()==0){			if(c.getCommandString().getParam3()!=user)				return false;			}		else{			if(c.getCommandString().getParam()!=itoa(remoteSSRC))				return false;				}			//check CollisionCounter in REQUEST message		if(c.getCommandString().getOp()=="p2tREQUEST"){			if (CollisionCounter>0){				if(c.getCommandString().getParam3()!= itoa(CollisionCounter))					return false;			}			else if(CollisionCounter==0)						}*/		//check seqno only if its not another REQUEST message		if(c.getCommandString().getOp()!= "p2tREQUEST"){			if(c.getCommandString().getParam2()!=itoa(seqNo))				return false;			}	}				return StateMachine<SipSMCommand,string>::handleCommand(c);}void RtcpTransactionGetFloor::setUser(string user) {	this->user=user;}MRef<SipDialogP2T*> RtcpTransactionGetFloor::getDialogP2T() {//	MRef<SipDialog*> sipCall = getDialog();	//MRef<SipDialogP2T*> sipCallP2T = MRef<SipDialogP2T*>((SipDialogP2T*)*sipCall);	MRef<SipDialogP2T*> sipCallP2T = MRef<SipDialogP2T*>((SipDialogP2T*)*dialog);	return sipCallP2T;}void RtcpTransactionGetFloor::sendRequest() {		getDialogP2T()->getFloorControlSender()			->send_APP_FC(P2T::APP_REQUEST, /*getDialog()*/dialog->getDialogConfig()->local_ssrc, 				P2T::APP_NAME, toaddr, port, seqNo, CollisionCounter);}			void RtcpTransactionGetFloor::reportStatus(int status){	if(getDialogP2T()->getGroupList()->isParticipant(getUser()))		getDialogP2T()->getGroupList()->getUser(this->getUser())->setStatus(status);	/*		mdbg<<"¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤"<<end;	mdbg<<"RtcpTransactionGetFloor::"<<end;	mdbg<<getDialogP2T()->getGroupList()->print_debug()<<end;	mdbg<<"¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤"<<end;*/}                

⌨️ 快捷键说明

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