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

📄 sipcall.h

📁 KphoneSI (kpsi) is a SIP (Session Initiation Protocol) user agent for Linux, with which you can in
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> * Copyright (c) 2004 Wirlab <kphone@wirlab.net> * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 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 Library General Public * License for more details. *  * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB.  If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * */#ifndef SIPCALL_H_INCLUDED#define SIPCALL_H_INCLUDED#include <qobject.h>#include <qptrlist.h>#include "sipuri.h"#include "sipurilist.h"#include "mimecontenttype.h"class SipCall;class SipUser;class SipClient;class SipCallId;class SipMessage;class SipTransaction;class TCPMessageSocket;/** * @short Object to reference a member of a call * Object to reference a member of a call.  Contains the remote URI, their * current Contact URI, and their current status in the call.  It also contains * their current session description, and a copy of our local session * description for this call leg. * * This class also provides an API for modifying call state to this member of * the call, such as sending an invitation to join the session, or accepting a * call. */class SipCallMember : public QObject{	Q_OBJECT	friend class SipCall;public:	/**	 * Creates a new member for this call with the given URI. Initially,	 * this sets the Contact URI for the call member to be the same.	 */	SipCallMember( SipCall *parent, const SipUri &uri );	/**	 * Call member destructor.	 */	~SipCallMember( void );	enum CallMemberType {		unknown,		Subscribe,		Notify,		RNotify,		Message,		Invite,		Disc,		Options };	enum State {		state_Idle,		state_EarlyDialog,		state_Connected,		state_Disconnected,		state_InviteRequested,		state_ReInviteRequested,		state_RequestingInvite,		state_RequestingReInvite,		state_Redirected,		state_Disconnecting,		state_CancelPending,		state_Refer,		state_Refer_handling,		state_r202,		state_r100,		state_r200,		state_RDisconnected		};	enum AuthState {		authState_Authentication,		authState_AuthenticationOK,		authState_AuthenticationRequired,		authState_AuthenticationTrying,		authState_AuthenticationTryingWithPassword,		authState_AuthenticationRequiredWithNewPassword };	enum AuthType {		ProxyBasicAuthenticationRequired,		ProxyDigestAuthenticationRequired,		DigestAuthenticationRequired};		/**	 * Returns the current state of the call member.	 */	State getState( void ) const { return state; }	/**	 * Returns the most recent session description provided by the member	 * for sending media to them.	 */	QString getSessionDescription( void ) const { return sessiondesc; }	/**	 * Returns the MIME Content Type of the session description provided by	 * the call member. If none was provided, this function returns NULL.	 */	MimeContentType getSessionDescriptionType( void ) const { return sessiontype; }	/**	 * Returns the most recently sent local session description. Provided	 * for reference.	 */	QString getLocalSessionDescription( void ) const { return localsessiondesc; }	/**	 * Returns the MIME Content Type of the most recently sent local	 * session description.	 */	MimeContentType getLocalSessionDescriptionType( void ) const { return localsessiontype; }	/**	 * Returns a text description of our current status. Basically, this	 * is the text from the response line of the last message we received,	 * or a text description of what we're currently doing or waiting for.	 * Useful for showing the user what is going on.	 */	QString getLocalStatusDescription( void ) const { return statusdesc; }	/** 	*numeric Value of teh local status description	*/	int getLocalStatusCode ( void ) const { return statuscode; }	void clearLocalStatusCode ( void) { statuscode=0; }		/**	 * Returns the most recent message body we received that was not a	 * session description.	 */	QString getMostRecentMessageBody( void ) const { return recentbody; }	/**	 * Returns the MIME type of the most recent message body we received	 * that was not a session description.	 */	MimeContentType getMostRecentMessageBodyType( void ) const { return recentbodytype; }		/**	 * SUBSCRIBE	 */	void requestSubscribe( int expiresTime = 0, const QString &body = QString::null,		const MimeContentType &bodytype = MimeContentType::null );	void sendRequestSubscribe( QString username = QString::null, QString password = QString::null );	void requestAuthSubscribe( void );	void requestClearSubscribe( void );	void handlingSubscribeResponse( void );	/**	 * NOTIFY for Refer	 */	void requestRNotify( const QString &body = QString::null,		const MimeContentType &bodytype = MimeContentType::null, QString username = QString::null, QString password = QString::null);	/**	 * Evaluation of the incoming NOTIFY	 */	void requestNotify( const QString &body = QString::null,		const MimeContentType &bodytype = MimeContentType::null );	void sendRequestNotify( QString username = QString::null, QString password = QString::null );	void requestAuthNotify( void );	void requestClearNotify( const QString &body, const MimeContentType &bodytype );	void handlingNotifyResponse( void );	/**	 * NOTIFY	 */	 void handlingRNotifyResponse (void);			void sendRequestBye( QString username, QString password );		/**	 * MESSAGE	 */	void requestMessage( const QString &body, const MimeContentType &bodytype );	void sendRequestMessage( QString username = QString::null, QString password = QString::null );	void requestAuthMessage( void );	void handlingMessageResponse( void );	/**	 * Sends a SIP INVITE request, asking the member to join in the session	 * described in the given body. The body and MIME type provided will	 * become the new local session description for this call member.	 */	bool requestInvite( const QString &body, const MimeContentType &bodytype );	bool requestReInvite( const QString &body, const MimeContentType &bodytype );	bool sendRequestInvite( QString username = QString::null, QString password = QString::null );	void requestAuthInvite( void );	void handlingInviteResponse( void );	/**	 * Sends a SIP BYE request to disconnect the session.	 */	void requestDisconnect( void );	/**	 * Requests to establish a session to another party by sending REFER	 * we distinguish between the "short transfer", where no Notification is necessary and we go into state_Disconnect	 * and the standard case where where we go into state_r202* 	 */	void requestRefer( bool shortTr, const SipUri &referto, const QString &body = QString::null,		const MimeContentType &bodytype = MimeContentType::null );	/**	 * Sends a SIP OPTIONS request, asking the member what they support.	 * The body and MIME type provided serve no known purpose at this time.	 * The response to the OPTIONS request will become the new remote	 * session description, so this should not be called on an active call.	 * It is provided here for consistency.	 */	void requestOptions( const QString &body = QString::null,		const MimeContentType &bodytype = MimeContentType::null );	void sendRequestOptions( QString username = QString::null, QString password = QString::null );	void requestAuthOptions( void );	void handlingOptionsResponse( void );							/**	 * Accepts the invitation to join the session sent by the call member.	 * The body and MIME type provided will become the new local session	 * description for this call member.	 */	void acceptInvite( const QString &body = QString::null,		const MimeContentType &bodytype = MimeContentType::null );	void refuseInvite( void );	/**	 * Declines the invitation to join the session sent by the call member.	 * The body and MIME type provided are for possibly giving a reason as	 * to why the call was declined.	 */	void declineInvite( const QString &body = QString::null,		const MimeContentType &bodytype = MimeContentType::null );	void forwardCall( const QString &body);			/**	 * Returns the URI for this call member.	 */	const SipUri &getUri( void ) const { return memberuri; }	/**	 * Returns the current Contact URI for this call member.	 */	const SipUri &getContactUri( void ) const { return contacturi; }	/**	 * Sets the Contact URI for this call member.	 */	void setContactUri( const SipUri &newcontact );	/**	 * Updates the URI for this call member.	 */	void setUri( const SipUri &newuri );	/**	 * Returns the list of URIs where we were redirected.	 */	const SipUriList &getRedirectList( void ) { return redirectlist; }	/**	 * Cancel Transaction.	 */	void cancelTransaction( void );	/**	 * Returns the subject for this call members call.	 */	QString getSubject( void );	void contactUpdate( bool active, QString presence = "" );	void timerStart( int time );	void notAcceptableHere( void );	SipCall *getCall( void ) { return call; }	void setCallMemberType( CallMemberType type ) { callMemberType = type; }	CallMemberType getCallMemberType( void ) { return callMemberType; }	AuthType getAuthenticationType( void ) { return authtype; }	AuthState getAuthState( void ) { return authstate; }	void setAuthState( AuthState au ) { authstate=au; }	void setIdle( void ) { op = opIdle; }	void setState( State newstate ) { state = newstate; }	bool refuseHold(void) {return holdRefused;}signals:	/**	 * This signal is sent whenever the status of this call member has	 * changed.	 */	void statusUpdated( SipCallMember *member );private slots:	void localStatusUpdated( void );	void remoteStatusUpdated( void );	void call_timeout( void );private:	enum Operation {		opIdle,		opRequest,		opClearRequest };	Operation op;	// For SipCall	void incomingTransaction( SipTransaction *newtrans );	SipUri memberuri;	SipUri contacturi;	CallMemberType callMemberType;	State state;	AuthState authstate;	AuthType authtype;	SipCall *call;	SipTransaction *local;	SipTransaction *remote;	SipUriList redirectlist;	QString sessiondesc;	MimeContentType sessiontype;	QString localsessiondesc;	MimeContentType localsessiontype;	QString statusdesc;	int statuscode;	QString recentbody;	MimeContentType recentbodytype;	QString proxyauthstr;	QString proxyauthresponse;	QString authresponse;	int localExpiresTime;	QTimer *timer;	int curPid;	bool holdRefused;	//to avoid crossed  holds	bool masterHold;	QString ourUsername;	QString ourPassword;	int nonceCounter;	int challengeCounter;};typedef QListIterator<SipCallMember> SipCallMemberIterator;/** * @short A class for referencing a speficic SIP call. * @author Billy Biggs <bbiggs@div8.net> * * A class for referencing a specific SIP call. * * It also serves al a database for the transient data of the call */class SipCall : public QObject{	Q_OBJECT	friend class SipClient;	friend class SipTransaction;	friend class SipCallMember;public:// Call Types, please adapt the handling routines, if you change the sequence or add new ones	enum CallType {		GarKeinCall,		OptionsCall,		RegisterCall,		MsgCall,		BrokenCall,		UnknownCall,		outSubscribeCall,		inSubscribeCall,		inSubscribeCall_2,		StandardCall, //first Payload-Type		videoCall,		auviCall,		extCall1, 		extCall2,		extCall3,		extCall4, //last callType		putMeOnHold, //used for media negotiation to signal a Call Hold condition, must not be stored		noChange     //used for media negotiation to inform, that payload type did noch change,  must not be stored

⌨️ 快捷键说明

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