Commit 64e93d5b authored by llea's avatar llea

Fix dial tone.

parent e3cb770a
...@@ -69,12 +69,15 @@ AudioRtp::createNewSession (SipCall *ca) { ...@@ -69,12 +69,15 @@ AudioRtp::createNewSession (SipCall *ca) {
} }
#ifdef ALSA #ifdef ALSA
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, if (manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver,
manager->audiodriverReadAlsa, manager, symetric); manager->audiodriverReadAlsa, manager, symetric);
#else }
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager,
symetric);
#endif #endif
if (!manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager,
symetric);
}
if (RTXThread->start() != 0) { if (RTXThread->start() != 0) {
return -1; return -1;
...@@ -111,7 +114,8 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver, ...@@ -111,7 +114,8 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver,
this->sym =sym; this->sym =sym;
this->audioDevice = driver; this->audioDevice = driver;
#ifdef ALSA #ifdef ALSA
this->audioDeviceRead = read_driver; if (manager->useAlsa)
this->audioDeviceRead = read_driver;
#endif #endif
// TODO: Change bind address according to user settings. // TODO: Change bind address according to user settings.
...@@ -256,18 +260,22 @@ AudioRtpRTX::run (void) { ...@@ -256,18 +260,22 @@ AudioRtpRTX::run (void) {
//////////////////////////// ////////////////////////////
if (!manager->mute) { if (!manager->mute) {
#ifdef ALSA #ifdef ALSA
i = audioDeviceRead->readBuffer (data_from_mic, 320); if (manager->useAlsa) {
#else i = audioDeviceRead->readBuffer (data_from_mic, 320);
i = audioDevice->readBuffer (data_from_mic, 320); }
#endif #endif
if (!manager->useAlsa) {
i = audioDevice->readBuffer (data_from_mic, 320);
}
} else { } else {
// When IP-phone user click on mute button, we read buffer of a // When IP-phone user click on mute button, we read buffer of a
// temp buffer to avoid delay in sound. // temp buffer to avoid delay in sound.
#ifdef ALSA #ifdef ALSA
i = audioDeviceRead->readBuffer (data_mute, 320); if (manager->useAlsa)
#else i = audioDeviceRead->readBuffer (data_mute, 320);
i = audioDevice->readBuffer (data_mute, 320);
#endif #endif
if (!manager->useAlsa)
i = audioDevice->readBuffer (data_mute, 320);
} }
// TODO : return an error because no sound // TODO : return an error because no sound
......
/**************************************************************************** /****************************************************************************
** Form implementation generated from reading ui file 'configurationpanel.ui' ** Form implementation generated from reading ui file 'configurationpanel.ui'
** **
** Created: Fri Feb 4 16:42:29 2005 ** Created: Mon Feb 7 11:33:42 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!
......
/**************************************************************************** /****************************************************************************
** Form interface generated from reading ui file 'configurationpanel.ui' ** Form interface generated from reading ui file 'configurationpanel.ui'
** **
** Created: Fri Feb 4 16:42:29 2005 ** Created: Mon Feb 7 11:33:42 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!
......
...@@ -141,10 +141,12 @@ Manager::createSettingsPath (void) { ...@@ -141,10 +141,12 @@ Manager::createSettingsPath (void) {
void void
Manager::selectAudioDriver (void) { Manager::selectAudioDriver (void) {
if (Config::getb("Audio", "Drivers.driverOSS")) { if (Config::getb("Audio", "Drivers.driverOSS")) {
useAlsa = false;
this->audiodriver = new AudioDriversOSS (AudioDrivers::ReadWrite); this->audiodriver = new AudioDriversOSS (AudioDrivers::ReadWrite);
} }
if (Config::getb("Audio", "Drivers.driverALSA")) { if (Config::getb("Audio", "Drivers.driverALSA")) {
#ifdef ALSA #ifdef ALSA
useAlsa = true;
this->audiodriver = new AudioDriversALSA (AudioDrivers::WriteOnly); this->audiodriver = new AudioDriversALSA (AudioDrivers::WriteOnly);
this->audiodriverReadAlsa = new AudioDriversALSA (AudioDrivers::ReadOnly); this->audiodriverReadAlsa = new AudioDriversALSA (AudioDrivers::ReadOnly);
#endif #endif
......
...@@ -46,6 +46,7 @@ public: ...@@ -46,6 +46,7 @@ public:
#ifdef ALSA #ifdef ALSA
AudioDrivers *audiodriverReadAlsa; AudioDrivers *audiodriverReadAlsa;
#endif #endif
bool useAlsa;
ToneGenerator *tone; ToneGenerator *tone;
QString *DirectCall; // from -p argv QString *DirectCall; // from -p argv
bool mute; bool mute;
......
/**************************************************************************** /****************************************************************************
** Form implementation generated from reading ui file 'phonebook.ui' ** Form implementation generated from reading ui file 'phonebook.ui'
** **
** Created: Fri Feb 4 16:42:28 2005 ** Created: Mon Feb 7 11:33:42 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!
......
/**************************************************************************** /****************************************************************************
** Form interface generated from reading ui file 'phonebook.ui' ** Form interface generated from reading ui file 'phonebook.ui'
** **
** Created: Fri Feb 4 16:42:28 2005 ** Created: Mon Feb 7 11:33:42 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!
......
...@@ -598,7 +598,10 @@ QtGUIMainWindow::toggleLine (int num_line) { ...@@ -598,7 +598,10 @@ QtGUIMainWindow::toggleLine (int num_line) {
callmanager->phLines[busyNum]->setStateLine(ONHOLD); callmanager->phLines[busyNum]->setStateLine(ONHOLD);
callmanager->actionHandle (busyNum, ONHOLD_CALL); callmanager->actionHandle (busyNum, ONHOLD_CALL);
if (!callmanager->phLines[currentLineNumber]->getbDial()) { if (!callmanager->phLines[currentLineNumber]->getbDial()) {
this->dialTone(true); if (callmanager->sip->call[busyNum] == NULL) {
setInactiveLine(busyNum);
}
this->dialTone(true);
} }
callmanager->phLines[currentLineNumber]->setState(BUSY); callmanager->phLines[currentLineNumber]->setState(BUSY);
qDebug("GUI: state ON-HOLD line busyNum %d", busyNum); qDebug("GUI: state ON-HOLD line busyNum %d", busyNum);
...@@ -640,6 +643,10 @@ QtGUIMainWindow::toggleLine (int num_line) { ...@@ -640,6 +643,10 @@ QtGUIMainWindow::toggleLine (int num_line) {
qDebug("GUI: state ON-HOLD line %d", currentLineNumber); qDebug("GUI: state ON-HOLD line %d", currentLineNumber);
lcd->setStatus(ONHOLD_STATUS); lcd->setStatus(ONHOLD_STATUS);
callmanager->actionHandle (currentLineNumber, ONHOLD_CALL); callmanager->actionHandle (currentLineNumber, ONHOLD_CALL);
if (callmanager->sip->call[currentLineNumber] == NULL) {
setInactiveLine(currentLineNumber);
lcd->setStatus("Enter Phone Number:");
}
} }
} }
...@@ -727,11 +734,9 @@ QtGUIMainWindow::hangupLine (void) { ...@@ -727,11 +734,9 @@ QtGUIMainWindow::hangupLine (void) {
} else if (callmanager->sip->call[currentLineNumber] == NULL and } else if (callmanager->sip->call[currentLineNumber] == NULL and
callmanager->phLines[currentLineNumber]->isOnHold()) { callmanager->phLines[currentLineNumber]->isOnHold()) {
// If there isn't call on the current line and state line onHold // If there isn't call on the current line and state line onHold
// set free pixmap setInactiveLine(currentLineNumber);
setFreeStateLine (currentLineNumber); // Stop congestion sound
this->dialTone(false);
callmanager->congestion(false); callmanager->congestion(false);
callmanager->phLines[currentLineNumber]->setbDial(false);
lcd->clear(QString("Hung up")); lcd->clear(QString("Hung up"));
} }
...@@ -744,6 +749,15 @@ QtGUIMainWindow::hangupLine (void) { ...@@ -744,6 +749,15 @@ QtGUIMainWindow::hangupLine (void) {
#endif #endif
} }
void
QtGUIMainWindow::setInactiveLine (int num) {
// set free pixmap
setFreeStateLine (num);
// Stop dial tone
this->dialTone(false);
callmanager->phLines[num]->setbDial(false);
}
/** /**
* Stop the blinking message slot and load the message-off button pixmap. * Stop the blinking message slot and load the message-off button pixmap.
*/ */
......
...@@ -137,17 +137,18 @@ public: ...@@ -137,17 +137,18 @@ public:
QString ringFile (void); QString ringFile (void);
QString getRingFile (void); QString getRingFile (void);
inline inline
void ring (bool b) { this->ringVar = b; } void ring (bool b) { this->ringVar = b; }
inline inline
bool ringing (void) { return this->ringVar; } bool ringing (void) { return this->ringVar; }
void stopCallTimer (int); void stopCallTimer (int);
void startCallTimer (int); void startCallTimer (int);
void setFreeStateLine (int); void setFreeStateLine (int);
void setCurrentLineNumber(int); void setCurrentLineNumber(int);
void dialTone (bool); void dialTone (bool);
void setInactiveLine (int);
signals: signals:
void keyPressed(int); void keyPressed (int);
public slots: public slots:
void dial (void); void dial (void);
......
/**************************************************************************** /****************************************************************************
** Form implementation generated from reading ui file 'url_input.ui' ** Form implementation generated from reading ui file 'url_input.ui'
** **
** Created: Fri Feb 4 16:42:29 2005 ** Created: Mon Feb 7 11:33:42 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!
......
/**************************************************************************** /****************************************************************************
** Form interface generated from reading ui file 'url_input.ui' ** Form interface generated from reading ui file 'url_input.ui'
** **
** Created: Fri Feb 4 16:42:29 2005 ** Created: Mon Feb 7 11:33:42 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!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment