Commit 64e93d5b authored by llea's avatar llea

Fix dial tone.

parent e3cb770a
......@@ -69,12 +69,15 @@ AudioRtp::createNewSession (SipCall *ca) {
}
#ifdef ALSA
if (manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver,
manager->audiodriverReadAlsa, manager, symetric);
#else
}
#endif
if (!manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager,
symetric);
#endif
}
if (RTXThread->start() != 0) {
return -1;
......@@ -111,6 +114,7 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver,
this->sym =sym;
this->audioDevice = driver;
#ifdef ALSA
if (manager->useAlsa)
this->audioDeviceRead = read_driver;
#endif
......@@ -256,18 +260,22 @@ AudioRtpRTX::run (void) {
////////////////////////////
if (!manager->mute) {
#ifdef ALSA
if (manager->useAlsa) {
i = audioDeviceRead->readBuffer (data_from_mic, 320);
#else
i = audioDevice->readBuffer (data_from_mic, 320);
}
#endif
if (!manager->useAlsa) {
i = audioDevice->readBuffer (data_from_mic, 320);
}
} else {
// When IP-phone user click on mute button, we read buffer of a
// temp buffer to avoid delay in sound.
#ifdef ALSA
if (manager->useAlsa)
i = audioDeviceRead->readBuffer (data_mute, 320);
#else
i = audioDevice->readBuffer (data_mute, 320);
#endif
if (!manager->useAlsa)
i = audioDevice->readBuffer (data_mute, 320);
}
// TODO : return an error because no sound
......
/****************************************************************************
** 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$)
**
** WARNING! All changes made in this file will be lost!
......
/****************************************************************************
** 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$)
**
** WARNING! All changes made in this file will be lost!
......
......@@ -141,10 +141,12 @@ Manager::createSettingsPath (void) {
void
Manager::selectAudioDriver (void) {
if (Config::getb("Audio", "Drivers.driverOSS")) {
useAlsa = false;
this->audiodriver = new AudioDriversOSS (AudioDrivers::ReadWrite);
}
if (Config::getb("Audio", "Drivers.driverALSA")) {
#ifdef ALSA
useAlsa = true;
this->audiodriver = new AudioDriversALSA (AudioDrivers::WriteOnly);
this->audiodriverReadAlsa = new AudioDriversALSA (AudioDrivers::ReadOnly);
#endif
......
......@@ -46,6 +46,7 @@ public:
#ifdef ALSA
AudioDrivers *audiodriverReadAlsa;
#endif
bool useAlsa;
ToneGenerator *tone;
QString *DirectCall; // from -p argv
bool mute;
......
/****************************************************************************
** 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$)
**
** WARNING! All changes made in this file will be lost!
......
/****************************************************************************
** 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$)
**
** WARNING! All changes made in this file will be lost!
......
......@@ -598,6 +598,9 @@ QtGUIMainWindow::toggleLine (int num_line) {
callmanager->phLines[busyNum]->setStateLine(ONHOLD);
callmanager->actionHandle (busyNum, ONHOLD_CALL);
if (!callmanager->phLines[currentLineNumber]->getbDial()) {
if (callmanager->sip->call[busyNum] == NULL) {
setInactiveLine(busyNum);
}
this->dialTone(true);
}
callmanager->phLines[currentLineNumber]->setState(BUSY);
......@@ -640,6 +643,10 @@ QtGUIMainWindow::toggleLine (int num_line) {
qDebug("GUI: state ON-HOLD line %d", currentLineNumber);
lcd->setStatus(ONHOLD_STATUS);
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) {
} else if (callmanager->sip->call[currentLineNumber] == NULL and
callmanager->phLines[currentLineNumber]->isOnHold()) {
// If there isn't call on the current line and state line onHold
// set free pixmap
setFreeStateLine (currentLineNumber);
this->dialTone(false);
setInactiveLine(currentLineNumber);
// Stop congestion sound
callmanager->congestion(false);
callmanager->phLines[currentLineNumber]->setbDial(false);
lcd->clear(QString("Hung up"));
}
......@@ -744,6 +749,15 @@ QtGUIMainWindow::hangupLine (void) {
#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.
*/
......
......@@ -145,9 +145,10 @@ public:
void setFreeStateLine (int);
void setCurrentLineNumber(int);
void dialTone (bool);
void setInactiveLine (int);
signals:
void keyPressed(int);
void keyPressed (int);
public slots:
void dial (void);
......
/****************************************************************************
** 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$)
**
** WARNING! All changes made in this file will be lost!
......
/****************************************************************************
** 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$)
**
** 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