Skip to content
Snippets Groups Projects
Commit 64e93d5b authored by llea's avatar llea
Browse files

Fix dial tone.

parent e3cb770a
No related branches found
No related tags found
No related merge requests found
...@@ -69,12 +69,15 @@ AudioRtp::createNewSession (SipCall *ca) { ...@@ -69,12 +69,15 @@ AudioRtp::createNewSession (SipCall *ca) {
} }
#ifdef ALSA #ifdef ALSA
if (manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, RTXThread = new AudioRtpRTX (ca, manager->audiodriver,
manager->audiodriverReadAlsa, manager, symetric); manager->audiodriverReadAlsa, manager, symetric);
#else }
#endif
if (!manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager, RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager,
symetric); symetric);
#endif }
if (RTXThread->start() != 0) { if (RTXThread->start() != 0) {
return -1; return -1;
...@@ -111,6 +114,7 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver, ...@@ -111,6 +114,7 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver,
this->sym =sym; this->sym =sym;
this->audioDevice = driver; this->audioDevice = driver;
#ifdef ALSA #ifdef ALSA
if (manager->useAlsa)
this->audioDeviceRead = read_driver; this->audioDeviceRead = read_driver;
#endif #endif
...@@ -256,18 +260,22 @@ AudioRtpRTX::run (void) { ...@@ -256,18 +260,22 @@ AudioRtpRTX::run (void) {
//////////////////////////// ////////////////////////////
if (!manager->mute) { if (!manager->mute) {
#ifdef ALSA #ifdef ALSA
if (manager->useAlsa) {
i = audioDeviceRead->readBuffer (data_from_mic, 320); i = audioDeviceRead->readBuffer (data_from_mic, 320);
#else }
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
if (manager->useAlsa)
i = audioDeviceRead->readBuffer (data_mute, 320); i = audioDeviceRead->readBuffer (data_mute, 320);
#else
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,6 +598,9 @@ QtGUIMainWindow::toggleLine (int num_line) { ...@@ -598,6 +598,9 @@ 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()) {
if (callmanager->sip->call[busyNum] == NULL) {
setInactiveLine(busyNum);
}
this->dialTone(true); this->dialTone(true);
} }
callmanager->phLines[currentLineNumber]->setState(BUSY); callmanager->phLines[currentLineNumber]->setState(BUSY);
...@@ -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.
*/ */
......
...@@ -145,6 +145,7 @@ public: ...@@ -145,6 +145,7 @@ public:
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);
......
/**************************************************************************** /****************************************************************************
** 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!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment