📄 sipdialogp2t.h
字号:
* <tr><td> p2tTerminate</td><td>a87_resent_terminated</td><td> * terminates the P2T Session. * </td></tr></table> * * <p><b>Transitions for Development</b><br> * There exists two transitions for development purposes: * a98_idle_idle_performance and a99_idle_idle_collisioner.<br> * If you send to <code>SipDialogP2T</code> a CommandString containing 'p2tPerformance', * <code>SipDialogP2T</code> will measure the Push-To-Talk Delay (the time from pressing * the button until the floor is granted) and save the results in the file specified in * <code>P2T::PERFORMANCE_FILE</code>.<br> * If you send a CommandString containing 'p2tCollisioner', <code>SipDialogP2T</code> is * forced to produce a collision if another user requests the floor. *<p> * @author Florian Maurer, florian.maurer@floHweb.ch */class LIBMINISIP_API SipDialogP2T: public SipDialog{ public: /** * Constructor * @param dContainer the SipDialogContainer * @param callconfig the Call configuration * @param phoneconf the Phone configuration */ SipDialogP2T(MRef<SipStack*> stack, MRef<SipDialogConfig*> callconfig, MRef<SipSoftPhoneConfiguration*> phoneconf); /** * Deconstructor */ virtual ~SipDialogP2T(); /** * @return the name "SipDialogP2T" */ virtual std::string getName(){return "SipDialogP2T";} virtual std::string getMemObjectType(){return getName();} void setCallId(std::string id){dialogState.callId = id;} std::string getCallId(){return dialogState.callId;} /** * handles the incoming commands. Accepts commands only if they have the * correct Call Identity and match a transition. * @param command the incoming command * @return true if the command was handled */ virtual bool handleCommand(const SipSMCommand &command); /** * generates and sets up the state machine */ void setUpStateMachine(); /** * returns the sound sender that is used to send * the RTP packets to the other users. * @return <code>SoundSender</code> object */ // SoundSender *getSoundSender(){return soundSender;} /** * returns the sound receiver that receives * RTP packets from other users. * @return <code>SoundReceiver</code> object */ // SoundReceiver *getSoundReceiver(){return soundReceiver;} /** * returns the phone configuration * @return <code>SipSoftPhoneConfiguration</code> object */ MRef<SipSoftPhoneConfiguration*> getPhoneConfig(){return phoneconf;} /** * modify the data about a user in the P2T-Session. * @param uri the SIP URI of the user * @param ip the IP Address * @param RTPport the RTPport (media stream) * @param RTCPport the RTCPport (floor control) * @param codec the codec * @param callId the SipDialogP2Tuser callId * @return true if the user was successfully modified */ bool modifyUser(std::string uri, IPAddress *ip, int RTPport, int RTCPport, Codec *codec, std::string callId); /** * removes a user from the Group Member List. * @param uri the SIP URI of the user * @param reason for which reason the user has to be removed * @param callId the callId from the dialog that wants to remove * the user. Note: The user will be removed only * when the callId in the Group Member List and this * parameter are similar. * @return true if the user was successfully removed */ bool removeUser(std::string user, std::string reason, std::string callId); /** * get the RtcpSender that is responsible for sending * the Floor Control Messages. * @return <code>RtcpSender</code> object */ RtcpSender *getFloorControlSender(){return floorControlSender;} /** * get the Group Member List for this P2T Session. * @return <code>GroupList</code> object. */ MRef<GroupList*> getGroupList(){return grpList;} /** * set the Group Member List for this P2T Session * @param GrpList the Group Member List */ void setGroupList(MRef<GroupList*> GrpList); /** * get the RTP port for the media stream. * @return port number */ int getRTPPort(){return 0;/*soundReceiver->getContactPort();*/} /** * checks the states of the users. * @param status the status that should be checked * @return true if all have the specified status or P2T_NOT_AVAILABLE */ bool checkStates(int status); /** * check if all users have answered a REQUEST message * @return true if all users have one of these states: * P2T::STATUS_GRANT, P2T::STATUS_COLLISION * P2T::RELEASED or P2T::STATUS_NOTAVAILABLE */ bool allAnswered(); /** * checks if the local user has the highest priority * among the users with the specified status. * If the priority is lower or the same, a reference * to a vector containing strings with the username * of those users who have highest priority is given. * If the local user has highest priority this vector * will be empty or contains the other users with the * same priority. Note: The local user may not have * the specified status. * @param status the status that should be checked * @param users a vector containing strings * @return boolean returns true if local user has highest priority. */ bool highestPrio(int status,std::vector<std::string> &users); /** * sets the status of every user in the Group Member List * to the specified state. * @param status the status that should be set */ void setStates(int status); /** * terminate the P2T session. * Sends to all SipDialogP2Tuser dialog a * hangup message. */ void terminateSession(); /** * counts how often the timerREVOKE * has expired. */ int counterRevoke; /** * counts how often a collision has happen, and is used * as value for the Collision Flag. */ int counterCollision; /** * used for development. Forces SipDialogP2T to * make a collision in the floor control. The variable * can be set by sending a CommandString "p2tCollisioner" to the * dialog. */ bool p2tCollisioner; /** * used for development. If this variable is equals true * SipDialogP2T measures the Push-to-talk delay. The variable can * be set by sending a CommandString "p2tPerformance" to the dialog. */ bool p2tPerformance; private: bool a0_idle_talkreq( const SipSMCommand &command); bool a1_talkreq_talk( const SipSMCommand &command); bool a2_talk_releasepend( const SipSMCommand &command); bool a3_releasepend_idle( const SipSMCommand &command); bool a4_idle_listenreq( const SipSMCommand &command); bool a5_listenreq_listen( const SipSMCommand &command); bool a6_listen_idle( const SipSMCommand &command); bool a7_talkreq_listenreq( const SipSMCommand &command); bool a8_talkreq_collision( const SipSMCommand &command); bool a9_collision_listenreq( const SipSMCommand &command); bool a10_collision_resent_timer( const SipSMCommand &command); bool a11_resent_collision_collision( const SipSMCommand &command); bool a12_resent_talk( const SipSMCommand &command); bool a13_resent_resent( const SipSMCommand &command); bool a14_listen_listen( const SipSMCommand &command); bool a15_talkreq_talkreq( const SipSMCommand &command); bool a16_releasepend_releasepend( const SipSMCommand &command); bool a17_listen_idle_revoke( const SipSMCommand &command); bool a18_talk_talk_revoke( const SipSMCommand &command); bool a19_listenreq_listenreq( const SipSMCommand &command); bool a80_idle_terminated( const SipSMCommand &command); bool a81_talkreq_terminated( const SipSMCommand &command); bool a82_listenreq_terminated( const SipSMCommand &command); bool a83_talk_terminated( const SipSMCommand &command); bool a84_collision_terminated( const SipSMCommand &command); bool a85_listen_terminated( const SipSMCommand &command); bool a86_releasepend_terminated( const SipSMCommand &command); bool a87_resent_terminated( const SipSMCommand &command); bool a97_idle_talkreq_collisioner( const SipSMCommand &command); bool a98_idle_idle_performance( const SipSMCommand &command); bool a99_idle_idle_collisioner( const SipSMCommand &command); ///sends the media stream to the other users //SoundSender *soundSender; ///receives the media stream from another user //SoundReceiver *soundReceiver; ///sends the Floor Control Messages to the other users RtcpSender *floorControlSender; ///receives the Floor Control Messages from the other users RtcpReceiver *floorControlReceiver; ///The Group Member List for this P2T Session MRef<GroupList*> grpList; ///The Phone Configuration MRef<SipSoftPhoneConfiguration*> phoneconf; };#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -