mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
Fix some bugs
This commit is contained in:
7
README
7
README
@ -19,9 +19,7 @@ make install
|
|||||||
|
|
||||||
How to use it ?
|
How to use it ?
|
||||||
---------------
|
---------------
|
||||||
1. Lauch it and click on SETUP.
|
1. Lauch it, a setup window appears.
|
||||||
Go to Audio, choose OSS (if you don't it WILL crash, this is a small bug,
|
|
||||||
don't forget, it's alpha).
|
|
||||||
|
|
||||||
2. If you do have a SIP account, fill the SIP stuff where related. You can use
|
2. If you do have a SIP account, fill the SIP stuff where related. You can use
|
||||||
STUN too.
|
STUN too.
|
||||||
@ -40,9 +38,6 @@ Why does it not compile ?
|
|||||||
some compilers). We are using gcc 3.3.3 on
|
some compilers). We are using gcc 3.3.3 on
|
||||||
Fedora Core 2 Linux. Someone reported it works on gcc 3.4.
|
Fedora Core 2 Linux. Someone reported it works on gcc 3.4.
|
||||||
|
|
||||||
- You don't have luck as we cannot help you before
|
|
||||||
January, 5th 2005 because we are on *holidays*.
|
|
||||||
|
|
||||||
Of course we love patches. And contribution. See http://www.sflphone.org/ .
|
Of course we love patches. And contribution. See http://www.sflphone.org/ .
|
||||||
We are setting up the project (CVS, bugtraqer, MLs) infrastructure.
|
We are setting up the project (CVS, bugtraqer, MLs) infrastructure.
|
||||||
Please be patient. The goal was to release an early alpha version before the
|
Please be patient. The goal was to release an early alpha version before the
|
||||||
|
@ -36,8 +36,6 @@ hangup_x=225
|
|||||||
hangup_y=156
|
hangup_y=156
|
||||||
dial_x=225
|
dial_x=225
|
||||||
dial_y=182
|
dial_y=182
|
||||||
ring_x=87
|
|
||||||
ring_y=0
|
|
||||||
redial_x=212
|
redial_x=212
|
||||||
redial_y=84
|
redial_y=84
|
||||||
mute_x=225
|
mute_x=225
|
||||||
|
@ -20,7 +20,7 @@ INC_OTHERS = ../stund
|
|||||||
|
|
||||||
INCPATH = -I. -I$(QTDIR)/include -I$(CCPPDIR)/include/cc++2 -I$(CCRTPDIR)/include -I$(OSIPDIR)/include -I$(EXOPSIP)/include -I/usr/include
|
INCPATH = -I. -I$(QTDIR)/include -I$(CCPPDIR)/include/cc++2 -I$(CCRTPDIR)/include -I$(OSIPDIR)/include -I$(EXOPSIP)/include -I/usr/include
|
||||||
|
|
||||||
CXXFLAGS = -pipe -Wall -W -O2 -g -pipe -march=i386 -mcpu=i686 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -fpermissive -Wno-deprecated $(INCPATH)
|
CXXFLAGS = -pipe -Wall -W -g -pipe -march=i386 -mcpu=i686 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -fpermissive -Wno-deprecated $(INCPATH)
|
||||||
|
|
||||||
LIBS = -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -L/opt/lib -losip2 -leXosip -lccrtp1 `ccgnu2-config --flags --stdlibs`
|
LIBS = -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -L/opt/lib -losip2 -leXosip -lccrtp1 `ccgnu2-config --flags --stdlibs`
|
||||||
|
|
||||||
@ -110,5 +110,5 @@ uninstall:
|
|||||||
rm -rf $(SHARE_DIR)/$(PROGNAME)
|
rm -rf $(SHARE_DIR)/$(PROGNAME)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PROGNAME) *.o *.a *~ *.moc.cpp *.bak core
|
rm -f $(PROGNAME) *.o *.a *~ *.moc.cpp *.bak core.*
|
||||||
|
|
||||||
|
@ -24,9 +24,7 @@
|
|||||||
#include "g711.h"
|
#include "g711.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif
|
|
||||||
|
|
||||||
AudioCodec::AudioCodec (void) {
|
AudioCodec::AudioCodec (void) {
|
||||||
// Init array handleCodecs
|
// Init array handleCodecs
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
#define __CODEC_AUDIO_H__
|
#define __CODEC_AUDIO_H__
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PAYLOAD_CODEC_ULAW = 0,
|
PAYLOAD_CODEC_ULAW = 0,
|
||||||
@ -32,13 +30,7 @@ typedef enum {
|
|||||||
PAYLOAD_CODEC_ILBC = 97,
|
PAYLOAD_CODEC_ILBC = 97,
|
||||||
PAYLOAD_CODEC_SPEEX = 110
|
PAYLOAD_CODEC_SPEEX = 110
|
||||||
} codecType;
|
} codecType;
|
||||||
/*
|
|
||||||
#define CODEC_ALAW QString("G711a")
|
|
||||||
#define CODEC_ULAW QString("G711u")
|
|
||||||
#define CODEC_GSM QString("GSM")
|
|
||||||
#define CODEC_ILBC QString("iLBC")
|
|
||||||
#define CODEC_SPEEX QString("SPEEX")
|
|
||||||
*/
|
|
||||||
#define CODEC_ALAW std::string("G711a")
|
#define CODEC_ALAW std::string("G711a")
|
||||||
#define CODEC_ULAW std::string("G711u")
|
#define CODEC_ULAW std::string("G711u")
|
||||||
#define CODEC_GSM std::string("GSM")
|
#define CODEC_GSM std::string("GSM")
|
||||||
|
153
src/audiortp.cpp
153
src/audiortp.cpp
@ -35,10 +35,8 @@
|
|||||||
#include "../stund/stun.h"
|
#include "../stund/stun.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace ost;
|
using namespace ost;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// AudioRtp
|
// AudioRtp
|
||||||
@ -73,15 +71,6 @@ AudioRtp::createNewSession (SipCall *ca) {
|
|||||||
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, manager, symetric);
|
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, manager, symetric);
|
||||||
RTXThread->start();
|
RTXThread->start();
|
||||||
|
|
||||||
/* if (!manager->useStun()) {
|
|
||||||
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, manager);
|
|
||||||
qDebug("new RTXThread = 0x%X", (int)RTXThread);
|
|
||||||
RTXThread->start();
|
|
||||||
} else {
|
|
||||||
symThread = new AudioRtpSymmetric (ca, manager->audiodriver, manager);
|
|
||||||
symThread->start();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,36 +82,17 @@ AudioRtp::closeRtpSession (SipCall *ca) {
|
|||||||
|
|
||||||
if (RTXThread != NULL) {
|
if (RTXThread != NULL) {
|
||||||
// Wait for them...and delete.
|
// Wait for them...and delete.
|
||||||
|
qDebug ("Thread audio JOIN ...");
|
||||||
RTXThread->join();
|
RTXThread->join();
|
||||||
|
qDebug ("Thread audio JOIN !!!");
|
||||||
delete RTXThread;
|
delete RTXThread;
|
||||||
qDebug ("RTXThread deleted!");
|
|
||||||
RTXThread = NULL;
|
RTXThread = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (!manager->useStun()) {
|
|
||||||
RTXThread->join();
|
|
||||||
if (RTXThread != NULL) {
|
|
||||||
delete RTXThread;
|
|
||||||
qDebug ("RTXThread deleted!");
|
|
||||||
RTXThread = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
symThread->join();
|
|
||||||
if (symThread != NULL) {
|
|
||||||
delete symThread;
|
|
||||||
symThread = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// Flush audio read buffer
|
// Flush audio read buffer
|
||||||
manager->audiodriver->resetDevice();
|
manager->audiodriver->resetDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
AudioRtp::rtpexit (void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// AudioRtpRTX Class //
|
// AudioRtpRTX Class //
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -330,124 +300,5 @@ AudioRtpRTX::run (void) {
|
|||||||
this->exit();
|
this->exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// AudioRtpSymmetric Class //
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
AudioRtpSymmetric::AudioRtpSymmetric (SipCall *sipcall, AudioDrivers *driver,
|
|
||||||
Manager *mngr) {
|
|
||||||
this->ca = sipcall;
|
|
||||||
this->audioDevice = driver;
|
|
||||||
this->manager = mngr;
|
|
||||||
|
|
||||||
InetHostAddress local_ip("192.168.1.172");
|
|
||||||
int forcedPort = manager->getFirewallPort();
|
|
||||||
qDebug("port firewall = %d", forcedPort);
|
|
||||||
|
|
||||||
session = new SymmetricRTPSession (local_ip, forcedPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioRtpSymmetric::~AudioRtpSymmetric () {
|
|
||||||
delete session;
|
|
||||||
terminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
AudioRtpSymmetric::run (void) {
|
|
||||||
AudioCodec ac;
|
|
||||||
unsigned char *data_to_send;
|
|
||||||
short *data_from_mic;
|
|
||||||
int i,
|
|
||||||
compSize,
|
|
||||||
timestamp;
|
|
||||||
int expandedSize;
|
|
||||||
short *data_for_speakers = NULL;
|
|
||||||
|
|
||||||
data_for_speakers = new short[2048];
|
|
||||||
data_from_mic = new short[1024];
|
|
||||||
data_to_send = new unsigned char[1024];
|
|
||||||
|
|
||||||
InetHostAddress remote_ip;
|
|
||||||
remote_ip = ca->remote_sdp_audio_ip;
|
|
||||||
int remote_port = ca->remote_sdp_audio_port;
|
|
||||||
|
|
||||||
if (!remote_ip) {
|
|
||||||
qDebug("Symmetric: IP address is not correct!");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialization
|
|
||||||
session->setSchedulingTimeout(10000);
|
|
||||||
session->setExpireTimeout(1000000);
|
|
||||||
|
|
||||||
if (!session->addDestination (remote_ip, (unsigned short) remote_port)) {
|
|
||||||
qDebug("Symmetric: could not connect to port %d", remote_port);
|
|
||||||
this->exit();
|
|
||||||
} else {
|
|
||||||
qDebug("Symmetric: Connected to %s:%d",
|
|
||||||
ca->remote_sdp_audio_ip, remote_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
session->setPayloadFormat(StaticPayloadFormat(
|
|
||||||
(enum StaticPayloadType) ca->payload));
|
|
||||||
|
|
||||||
setCancel(cancelImmediate);
|
|
||||||
|
|
||||||
timestamp = 0;
|
|
||||||
|
|
||||||
// TODO: get frameSize from user config
|
|
||||||
int frameSize = 20; // 20ms frames
|
|
||||||
TimerPort::setTimer(frameSize);
|
|
||||||
|
|
||||||
// start running the packet queue scheduler.
|
|
||||||
session->startRunning();
|
|
||||||
|
|
||||||
while (ca->enable_audio != -1) {
|
|
||||||
////////////////////////////
|
|
||||||
// Send session
|
|
||||||
////////////////////////////
|
|
||||||
i = audioDevice->readBuffer (data_from_mic, 320);
|
|
||||||
// Encode acquired audio sample
|
|
||||||
compSize = AudioCodec::codecEncode (
|
|
||||||
ac.handleCodecs[0],
|
|
||||||
data_to_send,
|
|
||||||
data_from_mic, i);
|
|
||||||
|
|
||||||
// Send encoded audio sample
|
|
||||||
session->putData(timestamp, data_to_send, compSize);
|
|
||||||
timestamp += compSize;
|
|
||||||
|
|
||||||
////////////////////////////
|
|
||||||
// Recv session
|
|
||||||
////////////////////////////
|
|
||||||
const AppDataUnit* adu = NULL;
|
|
||||||
|
|
||||||
do {
|
|
||||||
Thread::sleep(10);
|
|
||||||
adu = session->getData(session->getFirstTimestamp());
|
|
||||||
} while (adu == NULL);
|
|
||||||
|
|
||||||
// Decode data with relevant codec
|
|
||||||
expandedSize = AudioCodec::codecDecode (
|
|
||||||
adu->getType(),
|
|
||||||
data_for_speakers,
|
|
||||||
(unsigned char*) adu->getData(),
|
|
||||||
adu->getSize());
|
|
||||||
|
|
||||||
// Write decoded data to sound device
|
|
||||||
audioDevice->writeBuffer (data_for_speakers, expandedSize);
|
|
||||||
delete adu;
|
|
||||||
|
|
||||||
// Let's wait for the next cycle
|
|
||||||
Thread::sleep(TimerPort::getTimer());
|
|
||||||
TimerPort::incTimer(frameSize); // 'frameSize' ms
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] data_for_speakers;
|
|
||||||
delete[] data_from_mic;
|
|
||||||
delete[] data_to_send;
|
|
||||||
this->exit();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
@ -24,9 +24,7 @@
|
|||||||
|
|
||||||
#include <ccrtp/rtp.h>
|
#include <ccrtp/rtp.h>
|
||||||
|
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace ost;
|
using namespace ost;
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "sipcall.h"
|
#include "sipcall.h"
|
||||||
|
|
||||||
@ -54,23 +52,6 @@ private:
|
|||||||
bool sym;
|
bool sym;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// One pair of sockets
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
class AudioRtpSymmetric : public Thread, public TimerPort {
|
|
||||||
public:
|
|
||||||
AudioRtpSymmetric (SipCall *, AudioDrivers *, Manager *);
|
|
||||||
~AudioRtpSymmetric();
|
|
||||||
virtual void run ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
SipCall *ca;
|
|
||||||
AudioDrivers *audioDevice;
|
|
||||||
Manager *manager;
|
|
||||||
SymmetricRTPSession *session;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Main class rtp
|
// Main class rtp
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -81,7 +62,6 @@ public:
|
|||||||
|
|
||||||
int createNewSession (SipCall *);
|
int createNewSession (SipCall *);
|
||||||
void closeRtpSession (SipCall *);
|
void closeRtpSession (SipCall *);
|
||||||
void rtpexit (void);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioRtpRTX *RTXThread;
|
AudioRtpRTX *RTXThread;
|
||||||
|
@ -25,11 +25,8 @@
|
|||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#define CFG_PFX PROGNAME
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif
|
|
||||||
|
|
||||||
class ConfigurationTree;
|
class ConfigurationTree;
|
||||||
class Config {
|
class Config {
|
||||||
@ -37,19 +34,6 @@ public:
|
|||||||
Config (void) {};
|
Config (void) {};
|
||||||
~Config (void) {};
|
~Config (void) {};
|
||||||
|
|
||||||
#if 0
|
|
||||||
static QString gets (QString);
|
|
||||||
static QString get (QString, QString);
|
|
||||||
static QString set (QString, QString);
|
|
||||||
|
|
||||||
static int geti (QString);
|
|
||||||
static int get (QString, int);
|
|
||||||
static int set (QString, int);
|
|
||||||
|
|
||||||
static bool getb (QString);
|
|
||||||
static bool get (QString, bool);
|
|
||||||
static bool set (QString, bool);
|
|
||||||
#endif
|
|
||||||
static std::string gets (const char*, const char*);
|
static std::string gets (const char*, const char*);
|
||||||
static char* getschar (const char*, const char*);
|
static char* getschar (const char*, const char*);
|
||||||
static int geti (const char*, const char*);
|
static int geti (const char*, const char*);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Form implementation generated from reading ui file 'configurationpanel.ui'
|
** Form implementation generated from reading ui file 'configurationpanel.ui'
|
||||||
**
|
**
|
||||||
** Created: Tue Jan 11 12:49:32 2005
|
** Created: Thu Jan 13 18:34:00 2005
|
||||||
** by: The User Interface Compiler ($Id$)
|
** by: The User Interface Compiler ($Id$)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Form interface generated from reading ui file 'configurationpanel.ui'
|
** Form interface generated from reading ui file 'configurationpanel.ui'
|
||||||
**
|
**
|
||||||
** Created: Tue Jan 11 12:49:32 2005
|
** Created: Thu Jan 13 18:34:00 2005
|
||||||
** by: The User Interface Compiler ($Id$)
|
** by: The User Interface Compiler ($Id$)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -31,16 +31,6 @@
|
|||||||
#include "skin.h"
|
#include "skin.h"
|
||||||
#include "qtGUImainwindow.h"
|
#include "qtGUImainwindow.h"
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <string>
|
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void OptionProcess (int argc,char **argv) ;
|
void OptionProcess (int argc,char **argv) ;
|
||||||
QString *pOption ;
|
QString *pOption ;
|
||||||
|
@ -43,35 +43,17 @@
|
|||||||
#include "qtGUImainwindow.h"
|
#include "qtGUImainwindow.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif
|
|
||||||
|
|
||||||
Manager::Manager (QString *Dc = NULL) {
|
Manager::Manager (QString *Dc = NULL) {
|
||||||
DirectCall = Dc;
|
DirectCall = Dc;
|
||||||
|
bool exist;
|
||||||
|
|
||||||
for (int i = 0; i < NUMBER_OF_LINES; i++) {
|
for (int i = 0; i < NUMBER_OF_LINES; i++) {
|
||||||
phLines[i] = new PhoneLine ();
|
phLines[i] = new PhoneLine ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create .sflphone directory in home user
|
exist = createSettingsPath();
|
||||||
bool exist = true;
|
|
||||||
char * buffer;
|
|
||||||
// Get variable $HOME
|
|
||||||
buffer = getenv ("HOME"); path = string(buffer);
|
|
||||||
path = path + "/." + PROGNAME;
|
|
||||||
|
|
||||||
if (mkdir (path.data(), 0755) != 0) {
|
|
||||||
// If directory creation failed
|
|
||||||
if (errno != EEXIST) {
|
|
||||||
printf ("Cannot create directory: %s\n", strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load user's config
|
|
||||||
path = path + "/" + PROGNAME + "rc";
|
|
||||||
if (Config::tree()->populateFromFile(path.data()) == 0){
|
|
||||||
exist = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
phonegui = new QtGUIMainWindow (0, 0 ,
|
phonegui = new QtGUIMainWindow (0, 0 ,
|
||||||
Qt::WDestructiveClose |
|
Qt::WDestructiveClose |
|
||||||
@ -82,7 +64,7 @@ Manager::Manager (QString *Dc = NULL) {
|
|||||||
audioRTP = new AudioRtp(this->sip, this);
|
audioRTP = new AudioRtp(this->sip, this);
|
||||||
tone = new ToneGenerator(this);
|
tone = new ToneGenerator(this);
|
||||||
|
|
||||||
sip_rtp_init();
|
sip_init();
|
||||||
|
|
||||||
selectAudioDriver();
|
selectAudioDriver();
|
||||||
|
|
||||||
@ -101,7 +83,6 @@ Manager::Manager (QString *Dc = NULL) {
|
|||||||
// show configuration panel
|
// show configuration panel
|
||||||
gui()->configuration();
|
gui()->configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager::~Manager (void) {
|
Manager::~Manager (void) {
|
||||||
@ -113,27 +94,64 @@ Manager::~Manager (void) {
|
|||||||
delete[] phLines;
|
delete[] phLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create .PROGNAME directory in home user and create configuration tree from
|
||||||
|
* the settings file if this file exists.
|
||||||
|
*
|
||||||
|
* @return true if config-file exists or false if not.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
Manager::createSettingsPath (void) {
|
||||||
|
//
|
||||||
|
bool exist = true;
|
||||||
|
char * buffer;
|
||||||
|
// Get variable $HOME
|
||||||
|
buffer = getenv ("HOME"); path = string(buffer);
|
||||||
|
path = path + "/." + PROGNAME;
|
||||||
|
|
||||||
|
if (mkdir (path.data(), 0755) != 0) {
|
||||||
|
// If directory creation failed
|
||||||
|
if (errno != EEXIST) {
|
||||||
|
printf ("Cannot create directory: %s\n", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load user's config
|
||||||
|
path = path + "/" + PROGNAME + "rc";
|
||||||
|
if (Config::tree()->populateFromFile(path.data()) == 0){
|
||||||
|
exist = false;
|
||||||
|
}
|
||||||
|
return exist;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call audio driver constructor according to the selected driver in setup
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
Manager::selectAudioDriver (void) {
|
Manager::selectAudioDriver (void) {
|
||||||
this->audiodriver = new AudioDriversOSS ();
|
this->audiodriver = new AudioDriversOSS ();
|
||||||
/* if (Config::getb(QString("Audio/Drivers.driverOSS"))) {
|
|
||||||
|
// TODO remplacer par ce qui suit ad ALSA sera implement<6E>
|
||||||
|
#if 0
|
||||||
|
if (Config::getb("Audio", "Drivers.driverOSS")) {
|
||||||
this->audiodriver = new AudioDriversOSS ();
|
this->audiodriver = new AudioDriversOSS ();
|
||||||
} else if (Config::get(QString("Audio/Drivers.driverALSA"), false)) {
|
} else if (Config::getb("Audio", "Drivers.driverALSA")) {
|
||||||
audiodriver = new AudioDriversALSA ();
|
this->audiodriver = new AudioDriversALSA ();
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the SIP stack
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
Manager::sip_rtp_init (void) {
|
Manager::sip_init (void) {
|
||||||
// Init the SIP and RTP stacks.
|
|
||||||
if ( sip->initSIP () != -1) {
|
if ( sip->initSIP () != -1) {
|
||||||
sip->initRtpmapCodec ();
|
sip->initRtpmapCodec ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (Config::getb(QString("Preferences/Options.autoregister"))) {
|
|
||||||
if (Config::getb("Preferences", "Options.autoregister")) {
|
if (Config::getb("Preferences", "Options.autoregister")) {
|
||||||
// Register to the known proxies if available
|
// Register to the known proxies if available
|
||||||
//if (Config::gets("Signalisations/SIP.password").length() > 0) {
|
|
||||||
if (Config::gets("Signalisations", "SIP.password").length() > 0) {
|
if (Config::gets("Signalisations", "SIP.password").length() > 0) {
|
||||||
sip->setRegister ();
|
sip->setRegister ();
|
||||||
}
|
}
|
||||||
@ -143,7 +161,6 @@ Manager::sip_rtp_init (void) {
|
|||||||
void
|
void
|
||||||
Manager::quitLibrary (void) {
|
Manager::quitLibrary (void) {
|
||||||
sip->quitSIP();
|
sip->quitSIP();
|
||||||
audioRTP->rtpexit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -441,7 +458,6 @@ Manager::setChoose (bool b, bool b2) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
Manager::useStun () {
|
Manager::useStun () {
|
||||||
// if (Config::getb("Signalisations/STUN.useStunYes")) {
|
|
||||||
if (Config::getb("Signalisations", "STUN.useStunYes")) {
|
if (Config::getb("Signalisations", "STUN.useStunYes")) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -449,10 +465,14 @@ Manager::useStun () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle choice of the DTMF-send-way
|
/**
|
||||||
|
* Handle choice of the DTMF-send-way
|
||||||
|
*
|
||||||
|
* @param line: number of the line.
|
||||||
|
* @param digit: pressed key.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
Manager::dtmf (int line, char digit) {
|
Manager::dtmf (int line, char digit) {
|
||||||
// int sendType = Config::geti ("Signalisations/DTMF.sendDTMFas");
|
|
||||||
int sendType = Config::geti ("Signalisations", "DTMF.sendDTMFas");
|
int sendType = Config::geti ("Signalisations", "DTMF.sendDTMFas");
|
||||||
|
|
||||||
switch (sendType) {
|
switch (sendType) {
|
||||||
|
@ -26,9 +26,7 @@
|
|||||||
#include "../stund/stun.h"
|
#include "../stund/stun.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif
|
|
||||||
|
|
||||||
class AudioRtp;
|
class AudioRtp;
|
||||||
class SIP;
|
class SIP;
|
||||||
@ -61,7 +59,7 @@ public:
|
|||||||
void quitLibrary (void);
|
void quitLibrary (void);
|
||||||
int outgoingNewCall (void);
|
int outgoingNewCall (void);
|
||||||
void actionHandle (int, int);
|
void actionHandle (int, int);
|
||||||
int findLineNumberNotUsedSIP (void);
|
int findLineNumberNotUsedSIP(void);
|
||||||
void handleRemoteEvent (int, char *, int);
|
void handleRemoteEvent (int, char *, int);
|
||||||
int startSound (SipCall *);
|
int startSound (SipCall *);
|
||||||
void closeSound (SipCall *);
|
void closeSound (SipCall *);
|
||||||
@ -92,8 +90,8 @@ private:
|
|||||||
int firewallPort;
|
int firewallPort;
|
||||||
QString firewallAddr;
|
QString firewallAddr;
|
||||||
|
|
||||||
void sip_rtp_init (void);
|
void sip_init (void);
|
||||||
|
bool createSettingsPath (void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Form implementation generated from reading ui file 'phonebook.ui'
|
** Form implementation generated from reading ui file 'phonebook.ui'
|
||||||
**
|
**
|
||||||
** Created: Tue Jan 11 12:49:31 2005
|
** Created: Thu Jan 13 18:33:59 2005
|
||||||
** by: The User Interface Compiler ($Id$)
|
** by: The User Interface Compiler ($Id$)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Form interface generated from reading ui file 'phonebook.ui'
|
** Form interface generated from reading ui file 'phonebook.ui'
|
||||||
**
|
**
|
||||||
** Created: Tue Jan 11 12:49:31 2005
|
** Created: Thu Jan 13 18:33:59 2005
|
||||||
** by: The User Interface Compiler ($Id$)
|
** by: The User Interface Compiler ($Id$)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
@ -27,10 +27,11 @@ PhoneLine::PhoneLine (void) {
|
|||||||
setState (FREE);
|
setState (FREE);
|
||||||
setStateLine (FREE);
|
setStateLine (FREE);
|
||||||
first = true;
|
first = true;
|
||||||
|
timer = new QTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
PhoneLine::~PhoneLine (void) {
|
PhoneLine::~PhoneLine (void) {
|
||||||
if (timer) {
|
if (timer != NULL) {
|
||||||
delete timer;
|
delete timer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,6 +104,7 @@ PhoneLine::button (void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
PhoneLine::startTimer(void) {
|
PhoneLine::startTimer(void) {
|
||||||
|
if (timer == NULL)
|
||||||
timer = new QTime();
|
timer = new QTime();
|
||||||
timer->start();
|
timer->start();
|
||||||
}
|
}
|
||||||
|
@ -487,20 +487,6 @@ QtGUIMainWindow::numLineBusy(void) {
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
QtGUIMainWindow::stopBlinkingRingPixmap (void) {
|
|
||||||
// Initialisation of red bar rectangle region
|
|
||||||
QRect rect(ExistingDF.GetInt("ring_x","Positions"),
|
|
||||||
ExistingDF.GetInt("ring_y","Positions"),
|
|
||||||
imageRing.width(), imageRing.height());
|
|
||||||
|
|
||||||
// Blit the no-ringing pixmap with update rectangle
|
|
||||||
bitBlt (this, ExistingDF.GetInt("ring_x","Positions"),
|
|
||||||
ExistingDF.GetInt("ring_y","Positions"),&imageNoRing, 0, 0,
|
|
||||||
imageRing.width(), imageRing.height(), Qt::CopyROP);
|
|
||||||
update(rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
QtGUIMainWindow::dialTone (bool var) {
|
QtGUIMainWindow::dialTone (bool var) {
|
||||||
if (this->b_dialtone != var) {
|
if (this->b_dialtone != var) {
|
||||||
@ -556,7 +542,7 @@ QtGUIMainWindow::toggleLine (int num_line) {
|
|||||||
chosenLine = currentLineNumber;
|
chosenLine = currentLineNumber;
|
||||||
if (!noChoose) {
|
if (!noChoose) {
|
||||||
choose = true;
|
choose = true;
|
||||||
this->dialTone(true);
|
//this->dialTone(true);
|
||||||
}
|
}
|
||||||
callmanager->phLines[currentLineNumber]->setStateLine(BUSY);
|
callmanager->phLines[currentLineNumber]->setStateLine(BUSY);
|
||||||
}
|
}
|
||||||
@ -593,7 +579,6 @@ QtGUIMainWindow::toggleLine (int num_line) {
|
|||||||
callmanager->phLines[currentLineNumber]->getStateLine() != ONHOLD){
|
callmanager->phLines[currentLineNumber]->getStateLine() != ONHOLD){
|
||||||
qDebug("GUI: -- Nouvel appel repondu %d --", currentLineNumber);
|
qDebug("GUI: -- Nouvel appel repondu %d --", currentLineNumber);
|
||||||
callmanager->actionHandle (currentLineNumber, ANSWER_CALL);
|
callmanager->actionHandle (currentLineNumber, ANSWER_CALL);
|
||||||
stopBlinkingRingPixmap ();
|
|
||||||
callmanager->phLines[currentLineNumber]->setState(BUSY);
|
callmanager->phLines[currentLineNumber]->setState(BUSY);
|
||||||
callmanager->phLines[currentLineNumber]->setStateLine(BUSY);
|
callmanager->phLines[currentLineNumber]->setStateLine(BUSY);
|
||||||
}
|
}
|
||||||
@ -625,14 +610,19 @@ QtGUIMainWindow::dial (void) {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
if (transfer and callmanager->sip->call[currentLineNumber] != NULL
|
if (transfer and callmanager->sip->call[currentLineNumber] != NULL
|
||||||
and currentLineNumber != -1) {
|
and currentLineNumber != -1) {
|
||||||
|
// If transfer button clicked, validate the number for transfer.
|
||||||
callmanager->actionHandle (currentLineNumber, TRANSFER_CALL);
|
callmanager->actionHandle (currentLineNumber, TRANSFER_CALL);
|
||||||
transfer = false;
|
transfer = false;
|
||||||
|
} else if (callmanager->phLines[currentLineNumber]->isOnHold() or
|
||||||
|
callmanager->phLines[currentLineNumber]->getStateLine() == OFFHOLD
|
||||||
|
or (callmanager->phLines[currentLineNumber]->isBusy() and
|
||||||
|
callmanager->sip->call[currentLineNumber] != NULL)){
|
||||||
|
// If line used
|
||||||
|
// NOTHING
|
||||||
} else {
|
} else {
|
||||||
qDebug("GUI: LINE CURRENT %d", currentLineNumber);
|
qDebug("GUI: LINE CURRENT %d", currentLineNumber);
|
||||||
// If new incoming call
|
|
||||||
// Stop blinking ring pixmap and answer.
|
|
||||||
if (callmanager->ringing()) {
|
if (callmanager->ringing()) {
|
||||||
stopBlinkingRingPixmap();
|
// If new incoming call
|
||||||
currentLineNumber = callmanager->newCallLineNumber();
|
currentLineNumber = callmanager->newCallLineNumber();
|
||||||
toggleLine (currentLineNumber);
|
toggleLine (currentLineNumber);
|
||||||
} else {
|
} else {
|
||||||
@ -714,6 +704,7 @@ void
|
|||||||
QtGUIMainWindow::setFreeStateLine (int line) {
|
QtGUIMainWindow::setFreeStateLine (int line) {
|
||||||
// Set free-status for current line
|
// Set free-status for current line
|
||||||
callmanager->phLines[line]->setState (FREE);
|
callmanager->phLines[line]->setState (FREE);
|
||||||
|
callmanager->phLines[line]->setStateLine (FREE);
|
||||||
// Set free-pixmap
|
// Set free-pixmap
|
||||||
callmanager->phLines[line]->button()->setPixmap( TabLinePixmap[line][FREE]);
|
callmanager->phLines[line]->button()->setPixmap( TabLinePixmap[line][FREE]);
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,6 @@ private:
|
|||||||
void initBlinkTimer (void);
|
void initBlinkTimer (void);
|
||||||
|
|
||||||
int numLineBusy (void);
|
int numLineBusy (void);
|
||||||
void stopBlinkingRingPixmap (void);
|
|
||||||
|
|
||||||
int positionOffsetX (void);
|
int positionOffsetX (void);
|
||||||
|
|
||||||
|
13
src/sip.cpp
13
src/sip.cpp
@ -36,9 +36,7 @@
|
|||||||
#include "sipcall.h"
|
#include "sipcall.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO : mettre dans config
|
// TODO : mettre dans config
|
||||||
#define DEFAULT_SIP_PORT 5060
|
#define DEFAULT_SIP_PORT 5060
|
||||||
@ -484,7 +482,12 @@ SIP::outgoingInvite (void) {
|
|||||||
from = (char*)qfrom.data();
|
from = (char*)qfrom.data();
|
||||||
|
|
||||||
// Form the To header field
|
// Form the To header field
|
||||||
string qto = toHeader(string(callmanager->bufferTextRender().ascii()));
|
string qto;
|
||||||
|
if (callmanager->bufferTextRender().ascii() == NULL)
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
qto = toHeader(string(callmanager->bufferTextRender().ascii()));
|
||||||
|
|
||||||
if (qto.find("@") == string::npos and
|
if (qto.find("@") == string::npos and
|
||||||
Config::getb("Preferences", "Options.autoregister")) {
|
Config::getb("Preferences", "Options.autoregister")) {
|
||||||
qto = qto + "@" + Config::gets("Signalisations", "SIP.hostPart");
|
qto = qto + "@" + Config::gets("Signalisations", "SIP.hostPart");
|
||||||
@ -546,7 +549,6 @@ SIP::carryingDTMFdigits (int line, char digit) {
|
|||||||
int
|
int
|
||||||
SIP::manageActions (int usedLine, int action) {
|
SIP::manageActions (int usedLine, int action) {
|
||||||
int i;
|
int i;
|
||||||
// QString referTo;
|
|
||||||
string referTo;
|
string referTo;
|
||||||
|
|
||||||
char tmpbuf[64];
|
char tmpbuf[64];
|
||||||
@ -732,7 +734,6 @@ SIP::getEvent (void) {
|
|||||||
|
|
||||||
// TODO: stop the ringtone
|
// TODO: stop the ringtone
|
||||||
callmanager->ringTone(false);
|
callmanager->ringTone(false);
|
||||||
|
|
||||||
// Stop the call progress
|
// Stop the call progress
|
||||||
callmanager->setCallInProgress(false);
|
callmanager->setCallInProgress(false);
|
||||||
|
|
||||||
@ -747,6 +748,7 @@ SIP::getEvent (void) {
|
|||||||
if (callmanager->phLines[theline]->getStateLine() == BUSY or
|
if (callmanager->phLines[theline]->getStateLine() == BUSY or
|
||||||
callmanager->phLines[theline]->getStateLine() == OFFHOLD
|
callmanager->phLines[theline]->getStateLine() == OFFHOLD
|
||||||
or !call[theline]->usehold) {
|
or !call[theline]->usehold) {
|
||||||
|
|
||||||
if (!callmanager->transferedCall()) {
|
if (!callmanager->transferedCall()) {
|
||||||
// Associate an audio port with a call
|
// Associate an audio port with a call
|
||||||
call[theline]->setLocalAudioPort(local_port);
|
call[theline]->setLocalAudioPort(local_port);
|
||||||
@ -867,7 +869,6 @@ SIP::getEvent (void) {
|
|||||||
// If callee closes call instead of answering
|
// If callee closes call instead of answering
|
||||||
theline = notUsedLine;
|
theline = notUsedLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (theline >= 0);
|
assert (theline >= 0);
|
||||||
assert (theline < NUMBER_OF_LINES);
|
assert (theline < NUMBER_OF_LINES);
|
||||||
|
|
||||||
|
@ -39,10 +39,8 @@
|
|||||||
|
|
||||||
#include <cc++/thread.h>
|
#include <cc++/thread.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ost;
|
using namespace ost;
|
||||||
#endif
|
|
||||||
|
|
||||||
// List of actions
|
// List of actions
|
||||||
#define ANSWER_CALL 0
|
#define ANSWER_CALL 0
|
||||||
@ -101,7 +99,7 @@ public:
|
|||||||
char *myIPAddress;
|
char *myIPAddress;
|
||||||
SipCall *call[NUMBER_OF_LINES];
|
SipCall *call[NUMBER_OF_LINES];
|
||||||
Manager *callmanager;
|
Manager *callmanager;
|
||||||
|
char displayName[64];
|
||||||
|
|
||||||
int notUsedLine;
|
int notUsedLine;
|
||||||
|
|
||||||
|
@ -22,9 +22,7 @@
|
|||||||
|
|
||||||
#include <cc++/thread.h>
|
#include <cc++/thread.h>
|
||||||
|
|
||||||
#ifdef CCXX_NAMESPACES
|
|
||||||
using namespace ost;
|
using namespace ost;
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Form implementation generated from reading ui file 'url_input.ui'
|
** Form implementation generated from reading ui file 'url_input.ui'
|
||||||
**
|
**
|
||||||
** Created: Tue Jan 11 12:49:31 2005
|
** Created: Thu Jan 13 18:34:00 2005
|
||||||
** by: The User Interface Compiler ($Id$)
|
** by: The User Interface Compiler ($Id$)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Form interface generated from reading ui file 'url_input.ui'
|
** Form interface generated from reading ui file 'url_input.ui'
|
||||||
**
|
**
|
||||||
** Created: Tue Jan 11 12:49:31 2005
|
** Created: Thu Jan 13 18:34:00 2005
|
||||||
** by: The User Interface Compiler ($Id$)
|
** by: The User Interface Compiler ($Id$)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
Reference in New Issue
Block a user