manager.h 2.75 KB
Newer Older
savoirfairelinux's avatar
savoirfairelinux committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/**
 *  Copyright (C) 2004 Savoir-Faire Linux inc.
 *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
 *                                                                              
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *                                                                              
 *  This program 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 General Public License for more details.
 *                                                                              
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef __MANAGER_H__
#define __MANAGER_H__


#include "audiodrivers.h"
#include "phoneline.h"
#include "../stund/stun.h"

28 29 30 31 32
#include <string>
#ifdef  CCXX_NAMESPACES
using namespace std;
#endif

savoirfairelinux's avatar
savoirfairelinux committed
33 34 35 36 37 38 39 40
class AudioRtp;
class SIP;
class SipCall;
class ToneGenerator;
class QtGUIMainWindow;

class Manager {
public:
savoirfairelinux's avatar
 
savoirfairelinux committed
41
	Manager (QString *);
savoirfairelinux's avatar
savoirfairelinux committed
42 43 44 45 46 47 48 49
	~Manager (void);

	QtGUIMainWindow *phonegui;
	SIP 			*sip;
	PhoneLine		*phLines[NUMBER_OF_LINES];	
	AudioRtp		*audioRTP;
	AudioDrivers	*audiodriver;
	ToneGenerator	*tone;
llea's avatar
llea committed
50
	QString 		*DirectCall; // from argv[1]
savoirfairelinux's avatar
savoirfairelinux committed
51 52
	bool 			 mute;
	bool 			 tonezone;
llea's avatar
llea committed
53
	std::string		 path;
savoirfairelinux's avatar
savoirfairelinux committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

	inline
	QtGUIMainWindow*gui			(void) { return this->phonegui; }
	bool	ringing 			(void);
	inline
	void 	ring    			(void) { this->ring(true); }
	void 	ring    			(bool);
	void 	quitLibrary 			(void);
	int		outgoingNewCall			(void);
	void 	actionHandle			(int, int);
	int 	findLineNumberNotUsedSIP	(void);
	void 	handleRemoteEvent		(int, char *, int);
	int	startSound			(SipCall *);
	void 	closeSound 			(SipCall *);	
	void	selectAudioDriver		(void);
	QString	bufferTextRender		(void);
	bool	isNotUsedLine			(int);
	bool	isRingingLine			(int);
	int	newCallLineNumber		(void);
	void	getInfoStun		       	(StunAddress4 &);
	int	getFirewallPort			(void);
	void	setFirewallPort 		(int);
	QString	getFirewallAddress		(void);
	bool	otherLine			(void);
	bool	isChosenLine			(void);
	int	chosenLine			(void);
	void	setChoose			(bool, bool);
	bool	useStun				(void);
	void	dtmf				(int, char);
	bool	getCallInProgress		(void);
	void	setCallInProgress		(bool);
	bool	transferedCall			(void);

	void	ringTone				(bool);

private:
	bool	b_ringing;
	bool	b_ringtone;
	int		firewallPort;
	QString	firewallAddr;

	void 	sip_rtp_init			(void);


};

#endif // __MANAGER_H__