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

📄 rtcptransactiongetfloor.cxx

📁 MiniSip Client with DomainKeys Authentication, Sip, Audio communications, Echo Cancel
💻 CXX
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 2004-2006 the Minisip Team  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.  You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA *//* Copyright (C) 2004  * * Authors: Erik Eliasson <eliasson@it.kth.se> *          Johan Bilien <jobi@via.ecp.fr>*//* Name * 	RtcpTransactionGetFloor.cxx * Author * 	Florian Maurer, florian.maurer@floHweb.ch * Purpose * */#include <config.h>#include<assert.h>#include<libminisip/p2t/RtcpTransactionGetFloor.h>#include<libminisip/p2t/P2T.h>#include<libmsip/SipTransactionUtils.h>#include<libmsip/SipDialogContainer.h>#include<libmsip/SipDialog.h>#include<libmutil/itoa.h>//#include"DefaultCallHandler.h"#include<libminisip/mediahandler/MediaHandler.h>bool RtcpTransactionGetFloor::a0_start_reqsent( const SipSMCommand &command){	if (transitionMatch(command, "p2tSendRequest")){				//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;		/*gf->*/sendRequest();				//start timerGRANT and timerRelTIMEOUT		/*gf->*/requestTimeout(/*gf->*/tGrant, "timerGRANT");		/*gf->*/requestTimeout(/*gf->*/tGetTimeout, "timerGetTIMEOUT");		/*gf->*/requestTimeout(/*gf->*/tGetFloorTerminate, "timerGetFloorTERMINATE");				return true;	}	else{		return false;	}	}bool RtcpTransactionGetFloor::a1_reqsent_reqsent( const SipSMCommand &command){	if (transitionMatch(command, "timerGRANT")){		//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;				//resend request		/*gf->*/sendRequest();				//set new timer value		if(/*gf->*/counter<=5)			/*gf->*/tGrant = 2 * /*gf->*/tGrant;			/*gf->*/requestTimeout(/*gf->*/tGrant, "timerGRANT");		/*gf->*/counter++;				return true;	}else{		return false;	}}bool RtcpTransactionGetFloor::a2_reqsent_completed_grant( const SipSMCommand &command){	if (transitionMatch(command, "p2tGRANT")){				//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;				merr<<"RtcpTransactionGetFloor:: a2_reqsent_completed_grant"<<end;		merr<<"user="<</*gf->*/getUser()<<end;		merr<<"p1="<<command.getCommandString().getParam()<<end;		merr<<"p2="<<command.getCommandString().getParam2()<<end;		merr<<"p3="<<command.getCommandString().getParam3()<<end;					//set ssrc		int ssrc=0;				for(uint32_t k=0;k<command.getCommandString().getParam().size();k++) 			ssrc = (ssrc*10) + (command.getCommandString().getParam()[k]-'0');				if(/*gf->*/getDialogP2T()->getGroupList()->isParticipant(/*gf->*/getUser()))			/*gf->*/getDialogP2T()->getGroupList()->getUser(/*gf->*/getUser())->setSSRC(ssrc);				/*gf->*/setRemoteSSRC(ssrc);				//stop timers		/*gf->*/cancelTimeout("timerGRANT");			/*gf->*/cancelTimeout("timerGetTIMEOUT");				//set status		/*gf->*/reportStatus(P2T::STATUS_GRANT);				//inform call that answer message was received		string p3="";		if(/*gf->*/getCollisionCounter()>0){			p3=itoa(/*gf->*/getCollisionCounter());		}		else{			p3=/*gf->*/getUser();		}		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::a3_reqsent_completed_request( const SipSMCommand &command){	if (transitionMatch(command, "p2tREQUEST")){				//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;						merr<<"RtcpTransactionGetFloor:: a3_reqsent_completed_request"<<end;		merr<<"user="<</*gf->*/getUser()<<end;		merr<<"p1="<<command.getCommandString().getParam()<<end;		merr<<"p2="<<command.getCommandString().getParam2()<<end;		merr<<"p3="<<command.getCommandString().getParam3()<<end;									//stop timers		/*gf->*/cancelTimeout("timerGRANT");			/*gf->*/cancelTimeout("timerGetTIMEOUT");					//set ssrc and store his sequence number		//maybe we have to grant him later the floor.		int ssrc=0;		for(uint32_t k=0;k<command.getCommandString().getParam().size();k++) 			ssrc = (ssrc*10) + (command.getCommandString().getParam()[k]-'0');					int sNo=0;		for(uint32_t x=0;x<command.getCommandString().getParam2().size();x++) 			sNo = (sNo*10) + (command.getCommandString().getParam2()[x]-'0');									if(/*gf->*/getDialogP2T()->getGroupList()->isParticipant(/*gf->*/getUser())){			/*gf->*/getDialogP2T()->getGroupList()->getUser(/*gf->*/getUser())->setSSRC(ssrc);			/*gf->*/getDialogP2T()->getGroupList()->getUser(/*gf->*/getUser())->setSeqNo(sNo);			/*gf->*/setRemoteSSRC(ssrc);		}		else{			merr<<"RtcpTransactionGetFloor:: a3"<<end;			merr<<"User not found!"<<end;		}				//report collision		/*gf->*/reportStatus(P2T::STATUS_COLLISION);				//store his sequence number		//maybe we have to grant him later the floor		/*gf->*/getDialogP2T()->getGroupList()->getUser(/*gf->*/getRemoteSSRC())->setSeqNo(sNo);		/*gf->*/setRemoteSeqNo(sNo);				//inform call that answer message was received		string p3="";		if(/*gf->*/getCollisionCounter()>0){			p3=itoa(/*gf->*/getCollisionCounter());		}		else{			p3=/*gf->*/getUser();		}		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);						//for development reasons:		//send again a request for ensure that the remote user		//recognizes the collision		/*gf->*/sendRequest();								return true;	}else{		return false;	}} bool RtcpTransactionGetFloor::a4_reqsent_completed_timer( const SipSMCommand &command){ 	if (transitionMatch(command, "timerGetTIMEOUT")){		//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;				//stop timers		/*gf->*/cancelTimeout("timerGRANT");				//report 'not available'		/*gf->*/reportStatus(P2T::STATUS_NOTAVAILABLE);				//inform call that answer message was received		string p3="";		if(/*gf->*/getCollisionCounter()>0){			p3=itoa(/*gf->*/getCollisionCounter());		}		else{			p3=/*gf->*/getUser();		}		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::a5_completed_terminated( const SipSMCommand &command){	if (transitionMatch(command, "timerGetFloorTERMINATE")){		//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;						return true;	}else{		return false;	}}bool RtcpTransactionGetFloor::a6_reqsent_terminated( const SipSMCommand &command){	if (transitionMatch(command, "timerGetFloorTERMINATE")){		//RtcpTransactionGetFloor *gf = (RtcpTransactionGetFloor *)sipStateMachine;				//stop timers		/*gf->*/cancelTimeout("timerGRANT");		/*gf->*/cancelTimeout("timerGetTIMEOUT");				//set status		/*gf->*/reportStatus(P2T::STATUS_NOTAVAILABLE);				//inform call that answer message was received		string p3="";		if(/*gf->*/getCollisionCounter()>0){			p3=itoa(/*gf->*/getCollisionCounter());		}		else{			p3=/*gf->*/getUser();

⌨️ 快捷键说明

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