From 2666a40a122e074ddc3384311fab2d6638a6cadb Mon Sep 17 00:00:00 2001 From: Joao Mesquita Date: Thu, 8 Apr 2010 23:15:29 -0300 Subject: [PATCH] Lets test preprocessors --- fscomm/mainwindow.cpp | 16 + fscomm/mainwindow.h | 1 + fscomm/preferences/prefdialog.cpp | 1 + fscomm/preferences/prefdialog.h | 3 + fscomm/preferences/prefdialog.ui | 2098 ++++++++++++++------------ fscomm/preferences/prefportaudio.cpp | 22 + fscomm/preferences/prefportaudio.h | 5 + 7 files changed, 1173 insertions(+), 973 deletions(-) diff --git a/fscomm/mainwindow.cpp b/fscomm/mainwindow.cpp index b4720f5034..0cfb076f3e 100644 --- a/fscomm/mainwindow.cpp +++ b/fscomm/mainwindow.cpp @@ -179,10 +179,26 @@ void MainWindow::debugConsoleTriggered() } +void MainWindow::applyPreprocessors(QStringList cmds) +{ + if (g_FSHost.getCurrentActiveCall().isNull()) return; + QString uuid = g_FSHost.getCurrentActiveCall().data()->getUuid(); + foreach(QString cmd, cmds) + { + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_preprocess", QString("%1 %2").arg(uuid, cmd).toAscii().data(), NULL, &stream); + switch_safe_free(stream.data); + } +} + void MainWindow::prefTriggered() { if (!preferences) + { preferences = new PrefDialog(); + connect(preferences, SIGNAL(preprocessorsApplied(QStringList)), this, SLOT(applyPreprocessors(QStringList))); + } preferences->raise(); preferences->show(); diff --git a/fscomm/mainwindow.h b/fscomm/mainwindow.h index e7348c13d6..3b87da18ed 100644 --- a/fscomm/mainwindow.h +++ b/fscomm/mainwindow.h @@ -85,6 +85,7 @@ private slots: void updateCallTimers(); void debugConsoleTriggered(); void debugEventsTriggered(); + void applyPreprocessors(QStringList); private: Ui::MainWindow *ui; diff --git a/fscomm/preferences/prefdialog.cpp b/fscomm/preferences/prefdialog.cpp index c615411591..233de4eb1b 100644 --- a/fscomm/preferences/prefdialog.cpp +++ b/fscomm/preferences/prefdialog.cpp @@ -15,6 +15,7 @@ PrefDialog::PrefDialog(QWidget *parent) : _pref_accounts = new PrefAccounts(ui); _mod_portaudio = new PrefPortaudio(ui, this); + connect(_mod_portaudio, SIGNAL(preprocessorsApplied(QStringList)), this, SIGNAL(preprocessorsApplied(QStringList))); _mod_sofia = new PrefSofia(ui, this); readConfig(); } diff --git a/fscomm/preferences/prefdialog.h b/fscomm/preferences/prefdialog.h index 7c9907f5c2..2704a501a8 100644 --- a/fscomm/preferences/prefdialog.h +++ b/fscomm/preferences/prefdialog.h @@ -26,6 +26,9 @@ protected: private slots: void writeConfig(); +signals: + void preprocessorsApplied(QStringList); + private: void readConfig(); QSettings *_settings; diff --git a/fscomm/preferences/prefdialog.ui b/fscomm/preferences/prefdialog.ui index 1192631e70..1aaef60118 100644 --- a/fscomm/preferences/prefdialog.ui +++ b/fscomm/preferences/prefdialog.ui @@ -6,1006 +6,1158 @@ 0 0 - 839 - 613 + 803 + 667 Preferences - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - false - - - QAbstractItemView::NoDragDrop - - - - 96 - 84 - - - - QListView::Static - - - QListView::LeftToRight - - - true - - - 12 - - - QListView::IconMode - + + + - - General - - - - :/images/pref_general.jpg:/images/pref_general.jpg - - - - - Accounts - - - - :/images/pref_accounts.jpg:/images/pref_accounts.jpg - - - - - Sofia - - - - :/images/pref_sip.png:/images/pref_sip.png - - - - - PortAudio - - - - :/images/pref_audio.gif:/images/pref_audio.gif - - - - - - - - 0 - - - + + + + 120 + 0 + + + + + 120 + 16777215 + + + + false + + + QAbstractItemView::NoDragDrop + + + + 96 + 84 + + + + QListView::Static + + + QListView::LeftToRight + + + true + + + 12 + + + QListView::IconMode + - - - User Information - - - - - - CallerID Name: - - - - - - - - - - CallerID Number: - - - - - - - - - - - - - - - - - QAbstractItemView::NoEditTriggers - - - QAbstractItemView::SelectRows - - - - Name - - - - - Username - - - + + General + + + + :/images/pref_general.jpg:/images/pref_general.jpg + - + + Accounts + + + + :/images/pref_accounts.jpg:/images/pref_accounts.jpg + + + + + Sofia + + + + :/images/pref_sip.png:/images/pref_sip.png + + + + + Audio + + + + :/images/pref_audio.gif:/images/pref_audio.gif + + + + + + + + 0 + + + - - - Add + + + User Information + + + + + CallerID Name: + + + + + + + + + + CallerID Number: + + + + + + + - - - - Remove - - - - - - - true - - - Edit - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - 0 - - - - General - - - - - - Global - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - log-level - - - - - - - - - - auto-restart - - - - - - - - true - - - - - false - - - - - - - - debug-presence - - - - - - - - - - rewrite-multicasted-fs-path - - - - - - - - false - - - - - true - - - - - - - - - - - - 0 - 0 - - - - Profile - - - - - - user-agent-string - - - - - - - FreeSWITCH/FSComm - - - - - - - hold-music - - - - - - - localstream://moh - - - - - - - context - - - - - - - public - - - - - - - dialplan - - - - - - - XML - - - - - - - - - - - Network - - - - - - Softphone Profile - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - sip-port - - - - - - - 1 - - - 65535 - - - 12345 - - - - - - - use-rtp-timer - - - - - - - - true - - - - - false - - - - - - - - rtp-ip - - - - - - - auto - - - - - - - sip-ip - - - - - - - auto - - - - - - - apply-nat-acl - - - - - - - rfc1918 - - - - - - - ext-rtp-ip - - - - - - - stun:stun.freeswitch.org - - - - - - - ext-sip-ip - - - - - - - stun:stun.freeswitch.org - - - - - - - - - - - Codecs - - - - QFormLayout::AllNonFixedFieldsGrow + + + + + + + QAbstractItemView::NoEditTriggers - - - - inbound-codec-negotiation - - - - - - - - generous - - - - - greedy - - - - - - - - Codecs - - - - - - - - - - - Advanced - - + + QAbstractItemView::SelectRows + + + + Name + + + + + Username + + + + + + - - - Profile + + + Add - - - - - rfc2833-pt - - - - - - - 101 - - - - - - - debug - - - - - - - - - - sip-trace - - - - - - - - false - - - - - true - - - - - - - - dtmf-duration - - - - - - - 1000 - - - 100 - - - - - - - rtp-timer-name - - - - - - - soft - - - - - - - manage-presence - - - - - - - - false - - - - - true - - - - - - - - max-proceeding - - - - - - - 3 - - - - - - - nonce-ttl - - - - - - - 60 - - - - - - - rtp-timeout-sec - - - - - - - 1000 - - - 300 - - - - - - - rtp-hold-timeout-sec - - - - - - - 5000 - - - 1800 - - - - - - - auth-calls - - - - - - - - false - - - - - true - - - - - - - - auth-all-packets - - - - - - - - false - - - - - true - - - - - - - - disable-register - - - - - - - - true - - - - - false - - - - - - - - challenge-realm - - - - - - - - auto_from - - - - - auto_to - - - - - + + + + Remove + + + + + + + true + + + Edit + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + - - - - - - - - - - - - 0 - 0 - - - - Devices - - - - - - indev - + + + + + + + + + 0 + + + + General + + + + + + Global + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + log-level + + + + + + + + + + auto-restart + + + + + + + + true + + + + + false + + + + + + + + debug-presence + + + + + + + + + + rewrite-multicasted-fs-path + + + + + + + + false + + + + + true + + + + + + + + + + + + 0 + 0 + + + + Profile + + + + + + user-agent-string + + + + + + + FreeSWITCH/FSComm + + + + + + + hold-music + + + + + + + localstream://moh + + + + + + + context + + + + + + + public + + + + + + + dialplan + + + + + + + XML + + + + + + + - - - - - - - - outdev - + + + Network + + + + + + Softphone Profile + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + sip-port + + + + + + + 1 + + + 65535 + + + 12345 + + + + + + + use-rtp-timer + + + + + + + + true + + + + + false + + + + + + + + rtp-ip + + + + + + + auto + + + + + + + sip-ip + + + + + + + auto + + + + + + + apply-nat-acl + + + + + + + rfc1918 + + + + + + + ext-rtp-ip + + + + + + + stun:stun.freeswitch.org + + + + + + + ext-sip-ip + + + + + + + stun:stun.freeswitch.org + + + + + + + - - - - - - - - - - false - - - - 86 - 27 - - - - Test - - - - - - - - - rindgev - + + + Codecs + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + inbound-codec-negotiation + + + + + + + + generous + + + + + greedy + + + + + + + + Codecs + + + + + + + - - - - - - - - - - true - - - - 86 - 27 - - - - Test - - - - - - - - - - - Loop Test - - - - - - - Refresh DevList - - - - - - - - - Sample Rate - + + + Advanced + + + + + + Profile + + + + + + rfc2833-pt + + + + + + + 101 + + + + + + + debug + + + + + + + + + + sip-trace + + + + + + + + false + + + + + true + + + + + + + + dtmf-duration + + + + + + + 1000 + + + 100 + + + + + + + rtp-timer-name + + + + + + + soft + + + + + + + manage-presence + + + + + + + + false + + + + + true + + + + + + + + max-proceeding + + + + + + + 3 + + + + + + + nonce-ttl + + + + + + + 60 + + + + + + + rtp-timeout-sec + + + + + + + 1000 + + + 300 + + + + + + + rtp-hold-timeout-sec + + + + + + + 5000 + + + 1800 + + + + + + + auth-calls + + + + + + + + false + + + + + true + + + + + + + + auth-all-packets + + + + + + + + false + + + + + true + + + + + + + + disable-register + + + + + + + + true + + + + + false + + + + + + + + challenge-realm + + + + + + + + auto_from + + + + + auto_to + + + + + + + + - - - - - 16000 - + + + + + + + + + + 1 + + + + General + + + + + + + 0 + 0 + + + + Devices + + + + + + indev + + + + + + + + + + outdev + + + + + + + + + + + + false + + + + 86 + 27 + + + + Test + + + + + + + + + rindgev + + + + + + + + + + + + true + + + + 86 + 27 + + + + Test + + + + + + + + + + + Loop Test + + + + + + + Refresh DevList + + + + + + + + + Sample Rate + + + + + + + 16000 + + + + + + + Codec MS + + + + + + + 10 + + + + + + + + + + + 0 + 0 + + + + Files + + + + + + ring-file + + + + + + + + + tone_stream://%(2000,4000,440.0,480.0);loops=20 + + + + + + + Open + + + + + + + + + ring-interval + + + + + + + 5 + + + + + + + hold-file + + + + + + + + + true + + + + + + + Open + + + + + + + + + - - - - - Codec MS - + + + Preprocessor + + + + + + Echo canceller + + + + + + + read + + + + + + + write + + + + + + + Tail + + + + + + + + + + Echo Suppressor + + + + + + + read + + + + + + + write + + + + + + + Db + + + + + + + + + + Noise Supressor + + + + + + + read + + + + + + + write + + + + + + + Db + + + + + + + + + + read + + + + + + + write + + + + + + + + + + AGC + + + + + + + Apply + + + true + + + + - - - - - 10 - - - - - - - - - - - 0 - 0 - - - - Files - - - - - - ring-file - - - - - - - - - tone_stream://%(2000,4000,440.0,480.0);loops=20 - - - - - - - Open - - - - - - - - - ring-interval - - - - - - - 5 - - - - - - - hold-file - - - - - - - - - true - - - - - - - Open - - - - - - - - - - - + + + + + + + - + Qt::Horizontal diff --git a/fscomm/preferences/prefportaudio.cpp b/fscomm/preferences/prefportaudio.cpp index 14137956f1..8328c500b0 100644 --- a/fscomm/preferences/prefportaudio.cpp +++ b/fscomm/preferences/prefportaudio.cpp @@ -15,6 +15,28 @@ PrefPortaudio::PrefPortaudio(Ui::PrefDialog *ui, QObject *parent) : connect(_ui->PaRingdevTestBtn, SIGNAL(clicked()), this, SLOT(ringdevTest())); connect(_ui->PaLoopTestBtn, SIGNAL(clicked()), this, SLOT(loopTest())); connect(_ui->PaRefreshDevListBtn, SIGNAL(clicked()), this, SLOT(refreshDevList())); + connect(_ui->btnApplyPreprocessor, SIGNAL(toggled(bool)), this, SLOT(applyPreprocessors(bool))); +} + +void PrefPortaudio::applyPreprocessors(bool state) +{ + QStringList cmds; + if (!state) + { + cmds.append("stop"); + } + else + { + if (_ui->checkAECRead->isChecked()) cmds.append(QString("recho_cancel=%1").arg(_ui->spinAECTail->value())); + if (_ui->checkAECWrite->isChecked()) cmds.append(QString("wecho_cancel=%1").arg(_ui->spinAECTail->value())); + if (_ui->checkESRead->isChecked()) cmds.append(QString("recho_suppress=%1").arg(_ui->spinESDb->value())); + if (_ui->checkESWrite->isChecked()) cmds.append(QString("wecho_suppress=%1").arg(_ui->spinESDb->value())); + if (_ui->checkNSRead->isChecked()) cmds.append(QString("rnoise_suppress=%1").arg(_ui->spinNSDb->value())); + if (_ui->checkNSWrite->isChecked()) cmds.append(QString("wnoise_suppress=%1").arg(_ui->spinNSDb->value())); + if (_ui->checkAGCRead->isChecked()) cmds.append(QString("ragc=%1").arg(_ui->spinAGC->value())); + if (_ui->checkAGCWrite->isChecked()) cmds.append(QString("wagc=%1").arg(_ui->spinAGC->value())); + } + emit preprocessorsApplied(cmds); } void PrefPortaudio::ringdevTest() diff --git a/fscomm/preferences/prefportaudio.h b/fscomm/preferences/prefportaudio.h index 9ffd285636..d12750ab65 100644 --- a/fscomm/preferences/prefportaudio.h +++ b/fscomm/preferences/prefportaudio.h @@ -24,6 +24,11 @@ private slots: void ringdevTest(); void loopTest(); void refreshDevList(); + void applyPreprocessors(bool); + +signals: + void preprocessorsApplied(QStringList); + private: void getPaDevlist(void); QSettings *_settings;