From f38af512e101d06d140869e8a2fa940675b4ab4a Mon Sep 17 00:00:00 2001 From: llea <llea> Date: Thu, 13 Jan 2005 23:44:39 +0000 Subject: [PATCH] Fix some bugs --- README | 7 +- skins/metal/skin.ini | 2 - src/Makefile | 4 +- src/audiocodec.cpp | 2 - src/audiocodec.h | 10 +-- src/audiortp.cpp | 159 ++--------------------------------- src/audiortp.h | 20 ----- src/configuration.h | 16 ---- src/configurationpanelui.cpp | 2 +- src/configurationpanelui.h | 2 +- src/main.cpp | 10 --- src/manager.cpp | 92 ++++++++++++-------- src/manager.h | 34 ++++---- src/mydisplay.cpp | 2 +- src/phonebookui.cpp | 2 +- src/phonebookui.h | 2 +- src/phoneline.cpp | 6 +- src/qtGUImainwindow.cpp | 33 +++----- src/qtGUImainwindow.h | 1 - src/sip.cpp | 13 +-- src/sip.h | 4 +- src/tonegenerator.h | 2 - src/url_inputui.cpp | 2 +- src/url_inputui.h | 2 +- 24 files changed, 112 insertions(+), 317 deletions(-) diff --git a/README b/README index a14880a0e8..476c1a9453 100644 --- a/README +++ b/README @@ -19,9 +19,7 @@ make install How to use it ? --------------- -1. Lauch it and click on SETUP. - Go to Audio, choose OSS (if you don't it WILL crash, this is a small bug, - don't forget, it's alpha). +1. Lauch it, a setup window appears. 2. If you do have a SIP account, fill the SIP stuff where related. You can use STUN too. @@ -40,9 +38,6 @@ Why does it not compile ? some compilers). We are using gcc 3.3.3 on 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/ . We are setting up the project (CVS, bugtraqer, MLs) infrastructure. Please be patient. The goal was to release an early alpha version before the diff --git a/skins/metal/skin.ini b/skins/metal/skin.ini index ac2b09091f..62d06d6850 100644 --- a/skins/metal/skin.ini +++ b/skins/metal/skin.ini @@ -36,8 +36,6 @@ hangup_x=225 hangup_y=156 dial_x=225 dial_y=182 -ring_x=87 -ring_y=0 redial_x=212 redial_y=84 mute_x=225 diff --git a/src/Makefile b/src/Makefile index 43bcecf9b2..6ca501035b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 -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` @@ -110,5 +110,5 @@ uninstall: rm -rf $(SHARE_DIR)/$(PROGNAME) clean: - rm -f $(PROGNAME) *.o *.a *~ *.moc.cpp *.bak core + rm -f $(PROGNAME) *.o *.a *~ *.moc.cpp *.bak core.* diff --git a/src/audiocodec.cpp b/src/audiocodec.cpp index cd168c968a..4764e83ab2 100644 --- a/src/audiocodec.cpp +++ b/src/audiocodec.cpp @@ -24,9 +24,7 @@ #include "g711.h" #include <string> -#ifdef CCXX_NAMESPACES using namespace std; -#endif AudioCodec::AudioCodec (void) { // Init array handleCodecs diff --git a/src/audiocodec.h b/src/audiocodec.h index 894c826974..79ddb18b26 100644 --- a/src/audiocodec.h +++ b/src/audiocodec.h @@ -21,9 +21,7 @@ #define __CODEC_AUDIO_H__ #include <string.h> -#ifdef CCXX_NAMESPACES using namespace std; -#endif typedef enum { PAYLOAD_CODEC_ULAW = 0, @@ -32,13 +30,7 @@ typedef enum { PAYLOAD_CODEC_ILBC = 97, PAYLOAD_CODEC_SPEEX = 110 } 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_ULAW std::string("G711u") #define CODEC_GSM std::string("GSM") diff --git a/src/audiortp.cpp b/src/audiortp.cpp index 9702d80de0..56439d93a0 100644 --- a/src/audiortp.cpp +++ b/src/audiortp.cpp @@ -35,10 +35,8 @@ #include "../stund/stun.h" #include <string> -#ifdef CCXX_NAMESPACES using namespace ost; using namespace std; -#endif //////////////////////////////////////////////////////////////////////////////// // AudioRtp @@ -72,16 +70,7 @@ AudioRtp::createNewSession (SipCall *ca) { RTXThread = new AudioRtpRTX (ca, manager->audiodriver, manager, symetric); 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; } @@ -92,37 +81,18 @@ AudioRtp::closeRtpSession (SipCall *ca) { ca->enable_audio = -1; if (RTXThread != NULL) { - // Wait for them...and delete. - RTXThread->join(); - + // Wait for them...and delete. + qDebug ("Thread audio JOIN ..."); + RTXThread->join(); + qDebug ("Thread audio JOIN !!!"); delete RTXThread; - qDebug ("RTXThread deleted!"); 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 manager->audiodriver->resetDevice(); } -void -AudioRtp::rtpexit (void) { -} - //////////////////////////////////////////////////////////////////////////////// // AudioRtpRTX Class // //////////////////////////////////////////////////////////////////////////////// @@ -330,124 +300,5 @@ AudioRtpRTX::run (void) { 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 diff --git a/src/audiortp.h b/src/audiortp.h index 815dd5a815..dcbf7b43c3 100644 --- a/src/audiortp.h +++ b/src/audiortp.h @@ -24,9 +24,7 @@ #include <ccrtp/rtp.h> -#ifdef CCXX_NAMESPACES using namespace ost; -#endif #include "sipcall.h" @@ -54,23 +52,6 @@ private: 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 /////////////////////////////////////////////////////////////////////////////// @@ -81,7 +62,6 @@ public: int createNewSession (SipCall *); void closeRtpSession (SipCall *); - void rtpexit (void); private: AudioRtpRTX *RTXThread; diff --git a/src/configuration.h b/src/configuration.h index 1ac9c30cef..d6f147d0b0 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -25,11 +25,8 @@ #include "global.h" -#define CFG_PFX PROGNAME #include <string> -#ifdef CCXX_NAMESPACES using namespace std; -#endif class ConfigurationTree; class Config { @@ -37,19 +34,6 @@ public: 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 char* getschar (const char*, const char*); static int geti (const char*, const char*); diff --git a/src/configurationpanelui.cpp b/src/configurationpanelui.cpp index d6ca913719..f980fa3878 100644 --- a/src/configurationpanelui.cpp +++ b/src/configurationpanelui.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** 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$) ** ** WARNING! All changes made in this file will be lost! diff --git a/src/configurationpanelui.h b/src/configurationpanelui.h index 43407177f6..a03a114fe4 100644 --- a/src/configurationpanelui.h +++ b/src/configurationpanelui.h @@ -1,7 +1,7 @@ /**************************************************************************** ** 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$) ** ** WARNING! All changes made in this file will be lost! diff --git a/src/main.cpp b/src/main.cpp index 284474a80a..607d3171b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,16 +31,6 @@ #include "skin.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) ; QString *pOption ; diff --git a/src/manager.cpp b/src/manager.cpp index 1886bc5ebf..7b6b21d093 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -43,35 +43,17 @@ #include "qtGUImainwindow.h" #include <string> -#ifdef CCXX_NAMESPACES using namespace std; -#endif Manager::Manager (QString *Dc = NULL) { DirectCall = Dc; + bool exist; + for (int i = 0; i < NUMBER_OF_LINES; i++) { phLines[i] = new PhoneLine (); } - - // Create .sflphone directory in home user - 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; - } + + exist = createSettingsPath(); phonegui = new QtGUIMainWindow (0, 0 , Qt::WDestructiveClose | @@ -82,7 +64,7 @@ Manager::Manager (QString *Dc = NULL) { audioRTP = new AudioRtp(this->sip, this); tone = new ToneGenerator(this); - sip_rtp_init(); + sip_init(); selectAudioDriver(); @@ -101,7 +83,6 @@ Manager::Manager (QString *Dc = NULL) { // show configuration panel gui()->configuration(); } - } Manager::~Manager (void) { @@ -113,27 +94,64 @@ Manager::~Manager (void) { 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 Manager::selectAudioDriver (void) { this->audiodriver = new AudioDriversOSS (); - /* if (Config::getb(QString("Audio/Drivers.driverOSS"))) { + + // TODO remplacer par ce qui suit ad ALSA sera implementé +#if 0 + if (Config::getb("Audio", "Drivers.driverOSS")) { this->audiodriver = new AudioDriversOSS (); - } else if (Config::get(QString("Audio/Drivers.driverALSA"), false)) { - audiodriver = new AudioDriversALSA (); - }*/ + } else if (Config::getb("Audio", "Drivers.driverALSA")) { + this->audiodriver = new AudioDriversALSA (); + } +#endif } +/** + * Init the SIP stack + */ void -Manager::sip_rtp_init (void) { - // Init the SIP and RTP stacks. +Manager::sip_init (void) { if ( sip->initSIP () != -1) { sip->initRtpmapCodec (); } -// if (Config::getb(QString("Preferences/Options.autoregister"))) { if (Config::getb("Preferences", "Options.autoregister")) { // Register to the known proxies if available - //if (Config::gets("Signalisations/SIP.password").length() > 0) { if (Config::gets("Signalisations", "SIP.password").length() > 0) { sip->setRegister (); } @@ -143,7 +161,6 @@ Manager::sip_rtp_init (void) { void Manager::quitLibrary (void) { sip->quitSIP(); - audioRTP->rtpexit(); } int @@ -441,7 +458,6 @@ Manager::setChoose (bool b, bool b2) { bool Manager::useStun () { -// if (Config::getb("Signalisations/STUN.useStunYes")) { if (Config::getb("Signalisations", "STUN.useStunYes")) { return true; } 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 Manager::dtmf (int line, char digit) { -// int sendType = Config::geti ("Signalisations/DTMF.sendDTMFas"); int sendType = Config::geti ("Signalisations", "DTMF.sendDTMFas"); switch (sendType) { diff --git a/src/manager.h b/src/manager.h index 3313be727a..50232306c3 100644 --- a/src/manager.h +++ b/src/manager.h @@ -26,9 +26,7 @@ #include "../stund/stun.h" #include <string> -#ifdef CCXX_NAMESPACES using namespace std; -#endif class AudioRtp; class SIP; @@ -53,33 +51,33 @@ public: std::string path; inline - QtGUIMainWindow*gui (void) { return this->phonegui; } - bool ringing (void); + QtGUIMainWindow*gui (void) { return this->phonegui; } + bool ringing (void); inline - void ring (void) { this->ring(true); } - void ring (bool); + void ring (void) { this->ring(true); } + void ring (bool); void quitLibrary (void); int outgoingNewCall (void); void actionHandle (int, int); - int findLineNumberNotUsedSIP (void); + int findLineNumberNotUsedSIP(void); void handleRemoteEvent (int, char *, int); - int startSound (SipCall *); - void closeSound (SipCall *); + int startSound (SipCall *); + void closeSound (SipCall *); void selectAudioDriver (void); QString bufferTextRender (void); bool isNotUsedLine (int); bool isRingingLine (int); - int newCallLineNumber (void); + int newCallLineNumber (void); void getInfoStun (StunAddress4 &); - int getFirewallPort (void); + int getFirewallPort (void); void setFirewallPort (int); QString getFirewallAddress (void); - bool otherLine (void); + bool otherLine (void); bool isChosenLine (void); - int chosenLine (void); - void setChoose (bool, bool); - bool useStun (void); - void dtmf (int, char); + int chosenLine (void); + void setChoose (bool, bool); + bool useStun (void); + void dtmf (int, char); bool getCallInProgress (void); void setCallInProgress (bool); bool transferedCall (void); @@ -92,8 +90,8 @@ private: int firewallPort; QString firewallAddr; - void sip_rtp_init (void); - + void sip_init (void); + bool createSettingsPath (void); }; diff --git a/src/mydisplay.cpp b/src/mydisplay.cpp index e8ae650074..52c8339f15 100644 --- a/src/mydisplay.cpp +++ b/src/mydisplay.cpp @@ -278,7 +278,7 @@ MyDisplay::renderTime (QPainter &painter, QFontMetrics &fm) { } time = new QString(minStr + ":" + secStr); - + } else { // If no conversation, display the current time time = new QString(QDateTime::currentDateTime().toString("hh:mm")); diff --git a/src/phonebookui.cpp b/src/phonebookui.cpp index 4a96f71390..cb4766d439 100644 --- a/src/phonebookui.cpp +++ b/src/phonebookui.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** 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$) ** ** WARNING! All changes made in this file will be lost! diff --git a/src/phonebookui.h b/src/phonebookui.h index b352b9a8e4..430abfc050 100644 --- a/src/phonebookui.h +++ b/src/phonebookui.h @@ -1,7 +1,7 @@ /**************************************************************************** ** 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$) ** ** WARNING! All changes made in this file will be lost! diff --git a/src/phoneline.cpp b/src/phoneline.cpp index 6d5503d218..3cb2365726 100644 --- a/src/phoneline.cpp +++ b/src/phoneline.cpp @@ -27,10 +27,11 @@ PhoneLine::PhoneLine (void) { setState (FREE); setStateLine (FREE); first = true; + timer = new QTime(); } PhoneLine::~PhoneLine (void) { - if (timer) { + if (timer != NULL) { delete timer; } } @@ -103,7 +104,8 @@ PhoneLine::button (void) { void PhoneLine::startTimer(void) { - timer = new QTime(); + if (timer == NULL) + timer = new QTime(); timer->start(); } diff --git a/src/qtGUImainwindow.cpp b/src/qtGUImainwindow.cpp index a4a70bf397..dd3f538e84 100644 --- a/src/qtGUImainwindow.cpp +++ b/src/qtGUImainwindow.cpp @@ -487,20 +487,6 @@ QtGUIMainWindow::numLineBusy(void) { 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 QtGUIMainWindow::dialTone (bool var) { if (this->b_dialtone != var) { @@ -556,7 +542,7 @@ QtGUIMainWindow::toggleLine (int num_line) { chosenLine = currentLineNumber; if (!noChoose) { choose = true; - this->dialTone(true); + //this->dialTone(true); } callmanager->phLines[currentLineNumber]->setStateLine(BUSY); } @@ -593,7 +579,6 @@ QtGUIMainWindow::toggleLine (int num_line) { callmanager->phLines[currentLineNumber]->getStateLine() != ONHOLD){ qDebug("GUI: -- Nouvel appel repondu %d --", currentLineNumber); callmanager->actionHandle (currentLineNumber, ANSWER_CALL); - stopBlinkingRingPixmap (); callmanager->phLines[currentLineNumber]->setState(BUSY); callmanager->phLines[currentLineNumber]->setStateLine(BUSY); } @@ -625,14 +610,19 @@ QtGUIMainWindow::dial (void) { int i = 0; if (transfer and callmanager->sip->call[currentLineNumber] != NULL and currentLineNumber != -1) { + // If transfer button clicked, validate the number for transfer. callmanager->actionHandle (currentLineNumber, TRANSFER_CALL); 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 { qDebug("GUI: LINE CURRENT %d", currentLineNumber); - // If new incoming call - // Stop blinking ring pixmap and answer. - if (callmanager->ringing()) { - stopBlinkingRingPixmap(); + if (callmanager->ringing()) { + // If new incoming call currentLineNumber = callmanager->newCallLineNumber(); toggleLine (currentLineNumber); } else { @@ -650,7 +640,7 @@ QtGUIMainWindow::dial (void) { callmanager->phLines[currentLineNumber]->text = callmanager->bufferTextRender(); toggleLine (currentLineNumber); - callinprogress = true; + callinprogress = true; // RingTone // TODO: callmanager->ringTone(true); @@ -714,6 +704,7 @@ void QtGUIMainWindow::setFreeStateLine (int line) { // Set free-status for current line callmanager->phLines[line]->setState (FREE); + callmanager->phLines[line]->setStateLine (FREE); // Set free-pixmap callmanager->phLines[line]->button()->setPixmap( TabLinePixmap[line][FREE]); } diff --git a/src/qtGUImainwindow.h b/src/qtGUImainwindow.h index 527c8c72d8..cdba736e2d 100644 --- a/src/qtGUImainwindow.h +++ b/src/qtGUImainwindow.h @@ -215,7 +215,6 @@ private: void initBlinkTimer (void); int numLineBusy (void); - void stopBlinkingRingPixmap (void); int positionOffsetX (void); diff --git a/src/sip.cpp b/src/sip.cpp index 1b045841bc..4e42c10acc 100644 --- a/src/sip.cpp +++ b/src/sip.cpp @@ -36,9 +36,7 @@ #include "sipcall.h" #include <string> -#ifdef CCXX_NAMESPACES using namespace std; -#endif // TODO : mettre dans config #define DEFAULT_SIP_PORT 5060 @@ -484,7 +482,12 @@ SIP::outgoingInvite (void) { from = (char*)qfrom.data(); // 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 Config::getb("Preferences", "Options.autoregister")) { qto = qto + "@" + Config::gets("Signalisations", "SIP.hostPart"); @@ -546,7 +549,6 @@ SIP::carryingDTMFdigits (int line, char digit) { int SIP::manageActions (int usedLine, int action) { int i; -// QString referTo; string referTo; char tmpbuf[64]; @@ -732,7 +734,6 @@ SIP::getEvent (void) { // TODO: stop the ringtone callmanager->ringTone(false); - // Stop the call progress callmanager->setCallInProgress(false); @@ -747,6 +748,7 @@ SIP::getEvent (void) { if (callmanager->phLines[theline]->getStateLine() == BUSY or callmanager->phLines[theline]->getStateLine() == OFFHOLD or !call[theline]->usehold) { + if (!callmanager->transferedCall()) { // Associate an audio port with a call call[theline]->setLocalAudioPort(local_port); @@ -867,7 +869,6 @@ SIP::getEvent (void) { // If callee closes call instead of answering theline = notUsedLine; } - assert (theline >= 0); assert (theline < NUMBER_OF_LINES); diff --git a/src/sip.h b/src/sip.h index 0e99dceeda..d78a841850 100644 --- a/src/sip.h +++ b/src/sip.h @@ -39,10 +39,8 @@ #include <cc++/thread.h> #include <string> -#ifdef CCXX_NAMESPACES using namespace std; using namespace ost; -#endif // List of actions #define ANSWER_CALL 0 @@ -101,7 +99,7 @@ public: char *myIPAddress; SipCall *call[NUMBER_OF_LINES]; Manager *callmanager; - + char displayName[64]; int notUsedLine; diff --git a/src/tonegenerator.h b/src/tonegenerator.h index 886003155c..00587b8078 100644 --- a/src/tonegenerator.h +++ b/src/tonegenerator.h @@ -22,9 +22,7 @@ #include <cc++/thread.h> -#ifdef CCXX_NAMESPACES using namespace ost; -#endif #include "manager.h" diff --git a/src/url_inputui.cpp b/src/url_inputui.cpp index 8829fe2875..cd797b0ac3 100644 --- a/src/url_inputui.cpp +++ b/src/url_inputui.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** 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$) ** ** WARNING! All changes made in this file will be lost! diff --git a/src/url_inputui.h b/src/url_inputui.h index 3e62621dd7..21b14bd837 100644 --- a/src/url_inputui.h +++ b/src/url_inputui.h @@ -1,7 +1,7 @@ /**************************************************************************** ** 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$) ** ** WARNING! All changes made in this file will be lost! -- GitLab