]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
change implicit construction of FSHost - now occurs after QApplication - for some...
authorJeff Lenk <jeff@jefflenk.com>
Fri, 4 Jun 2010 20:15:18 +0000 (15:15 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Fri, 4 Jun 2010 20:15:18 +0000 (15:15 -0500)
fscomm/call.cpp
fscomm/debugtools/consolewindow.cpp
fscomm/debugtools/statedebugdialog.cpp
fscomm/fshost.cpp
fscomm/fshost.h
fscomm/main.cpp
fscomm/mainwindow.cpp
fscomm/preferences/accountdialog.cpp
fscomm/preferences/prefaccounts.cpp
fscomm/preferences/prefportaudio.cpp

index 0dce6a83cd17f22295ae25d6283cc2ca08b30126..3b91d7ee90c6674692dcc762c6a73e5cbdffcac8 100644 (file)
@@ -69,13 +69,13 @@ switch_status_t Call::toggleRecord(bool startRecord)
                                          conf_dir.absolutePath(),
                                          QDateTime::currentDateTime().toString("yyyyMMddhhmmss"),
                                          getCidNumber());
-        status = g_FSHost.sendCmd("uuid_record", QString("%1 start %2").arg(getUuid(), _recording_filename).toAscii().data(),&result);
+        status = g_FSHost->sendCmd("uuid_record", QString("%1 start %2").arg(getUuid(), _recording_filename).toAscii().data(),&result);
     }
     else
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping call recording on call [%s]\n",
                           getUuid().toAscii().data());
-        status = g_FSHost.sendCmd("uuid_record", QString("%1 stop %2").arg(getUuid(), _recording_filename).toAscii().data(),&result);
+        status = g_FSHost->sendCmd("uuid_record", QString("%1 stop %2").arg(getUuid(), _recording_filename).toAscii().data(),&result);
     }
 
     return status;
@@ -85,7 +85,7 @@ void Call::sendDTMF(QString digit)
 {
     QString result;
     QString dtmf_string = QString("dtmf %1").arg(digit);
-    if (g_FSHost.sendCmd("pa", dtmf_string.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+    if (g_FSHost->sendCmd("pa", dtmf_string.toAscii(), &result) == SWITCH_STATUS_FALSE) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not send DTMF digit %s on call[%s]", digit.toAscii().data(), getUuid().toAscii().data());
         QMessageBox::critical(0, QWidget::tr("DTMF Error"), QWidget::tr("There was an error sending DTMF, please report this bug."), QMessageBox::Ok);
     }
index 25fab26df99554bdbad02ce121fbb8ccdbd6bb8b..7c68d96f11436e9c4eedeadd24679765479ed0b9 100644 (file)
@@ -54,7 +54,7 @@ ConsoleWindow::ConsoleWindow(QWidget *parent) :
     connect(ui->filterReverseCheckBox, SIGNAL(toggled(bool)),
                      this, SLOT(reverseFilterChecked()));
 
-    connect(&g_FSHost, SIGNAL(eventLog(QSharedPointer<switch_log_node_t>,switch_log_level_t)), this, SLOT(loggerHandler(QSharedPointer<switch_log_node_t>,switch_log_level_t)));
+    connect(g_FSHost, SIGNAL(eventLog(QSharedPointer<switch_log_node_t>,switch_log_level_t)), this, SLOT(loggerHandler(QSharedPointer<switch_log_node_t>,switch_log_level_t)));
 
 }
 
@@ -104,7 +104,7 @@ void ConsoleWindow::cmdSendClicked()
     }
 
     QString res;
-    g_FSHost.sendCmd(cmd.toAscii().data(), args.toAscii().data(), &res);
+    g_FSHost->sendCmd(cmd.toAscii().data(), args.toAscii().data(), &res);
     if (!res.isEmpty())
     {
          /* Remove \r\n */
index 72a24eae524c6773f524153f2a09b8a53b4f75d7..cdf72f44c46426ce901b1ee25a9c07d2b5c76df1 100644 (file)
@@ -6,7 +6,7 @@ StateDebugDialog::StateDebugDialog(QWidget *parent) :
     ui(new Ui::StateDebugDialog)
 {
     ui->setupUi(this);
-    connect(&g_FSHost, SIGNAL(newEvent(QSharedPointer<switch_event_t>)), this, SLOT(newEvent(QSharedPointer<switch_event_t>)));
+    connect(g_FSHost, SIGNAL(newEvent(QSharedPointer<switch_event_t>)), this, SLOT(newEvent(QSharedPointer<switch_event_t>)));
     connect(ui->listUUID, SIGNAL(itemSelectionChanged()), this, SLOT(currentUuidChanged()));
     connect(ui->listEvents, SIGNAL(itemSelectionChanged()), this, SLOT(currentEventsChanged()));
 }
index b37452d01d0830c9ab86364ef20d47746f2ed5f6..5bc214c343f98b74525c4ee410d1a35b965b8eae 100644 (file)
@@ -32,7 +32,7 @@
 #include "mod_qsettings/mod_qsettings.h"
 
 /* Declare it globally */
-FSHost g_FSHost;
+FSHost *g_FSHost;
 
 FSHost::FSHost(QObject *parent) :
     QThread(parent)
@@ -472,7 +472,7 @@ void FSHost::accountReloadCmd(QSharedPointer<Account> acc)
 
     connect(this, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountReloadSlot(QSharedPointer<Account>)));
 
-    if (g_FSHost.sendCmd("sofia", arg.toAscii().data() , &res) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("sofia", arg.toAscii().data() , &res) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not killgw %s from profile softphone.\n",
                           acc.data()->getName().toAscii().data());
@@ -486,7 +486,7 @@ void FSHost::accountReloadSlot(QSharedPointer<Account> acc)
     {
         _reloading_Accounts.takeAt(_reloading_Accounts.indexOf(acc.data()->getName(), 0));
         QString res;
-        if (g_FSHost.sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
+        if (g_FSHost->sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
         {
             switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
             return;
index 888dad3f30a19f11379397dd5577f7ea7947b4b1..77404eac79b6744991370345512530f6bcfcbd9d 100644 (file)
@@ -122,7 +122,7 @@ private:
     QList<QString> _loadedModules;
 };
 
-extern FSHost g_FSHost;
+extern FSHost *g_FSHost;
 
 /*
    Used to match callback from fs core. We dup the event and call the class
@@ -133,7 +133,7 @@ static void eventHandlerCallback(switch_event_t *event)
     switch_event_t *clone = NULL;
     if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
         QSharedPointer<switch_event_t> e(clone);
-        g_FSHost.generalEventHandler(e);
+        g_FSHost->generalEventHandler(e);
     }
 }
 
@@ -144,7 +144,7 @@ static switch_status_t loggerHandler(const switch_log_node_t *node, switch_log_l
 {
     switch_log_node_t *clone = switch_log_node_dup(node);
     QSharedPointer<switch_log_node_t> l(clone);
-    g_FSHost.generalLoggerHandler(l, level);
+    g_FSHost->generalLoggerHandler(l, level);
     return SWITCH_STATUS_SUCCESS;
 }
 
index 147314b66fab164592792ce809811de8ed2e8bf4..7a91762d013691f5bf96e4c51173a8516b69b5f9 100644 (file)
@@ -43,11 +43,13 @@ int main(int argc, char *argv[])
     splash->show();
     splash->showMessage("Loading core, please wait...", Qt::AlignRight|Qt::AlignBottom, Qt::blue);
 
-    QObject::connect(&g_FSHost, SIGNAL(loadingModules(QString,int,QColor)), splash, SLOT(showMessage(QString,int,QColor)));
+       g_FSHost = new FSHost();
 
-    QObject::connect(&g_FSHost, SIGNAL(ready()), splash, SLOT(close()));
+    QObject::connect(g_FSHost, SIGNAL(loadingModules(QString,int,QColor)), splash, SLOT(showMessage(QString,int,QColor)));
+
+    QObject::connect(g_FSHost, SIGNAL(ready()), splash, SLOT(close()));
     MainWindow w;    
-    QObject::connect(&g_FSHost, SIGNAL(ready()), &w, SLOT(show()));
-    g_FSHost.start();
+    QObject::connect(g_FSHost, SIGNAL(ready()), &w, SLOT(show()));
+    g_FSHost->start();
     return a.exec();
 }
index 50dca81beee47e887bbc8decf0b99875a4c54018..d2f36626a74114293bd3954007fe3664d0d5390c 100644 (file)
@@ -84,16 +84,16 @@ MainWindow::MainWindow(QWidget *parent) :
     connect(dialpadMapper, SIGNAL(mapped(QString)), this, SLOT(sendDTMF(QString)));
 
     /* Connect events related to FreeSWITCH */
-    connect(&g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady()));
-    connect(&g_FSHost, SIGNAL(ringing(QSharedPointer<Call>)), this, SLOT(ringing(QSharedPointer<Call>)));
-    connect(&g_FSHost, SIGNAL(answered(QSharedPointer<Call>)), this, SLOT(answered(QSharedPointer<Call>)));
-    connect(&g_FSHost, SIGNAL(hungup(QSharedPointer<Call>)), this, SLOT(hungup(QSharedPointer<Call>)));
-    connect(&g_FSHost, SIGNAL(newOutgoingCall(QSharedPointer<Call>)), this, SLOT(newOutgoingCall(QSharedPointer<Call>)));
-    connect(&g_FSHost, SIGNAL(callFailed(QSharedPointer<Call>)), this, SLOT(callFailed(QSharedPointer<Call>)));
-    connect(&g_FSHost, SIGNAL(accountStateChange(QSharedPointer<Account>)), this, SLOT(accountStateChanged(QSharedPointer<Account>)));
-    connect(&g_FSHost, SIGNAL(newAccount(QSharedPointer<Account>)), this, SLOT(accountAdd(QSharedPointer<Account>)));
-    connect(&g_FSHost, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountDel(QSharedPointer<Account>)));
-    connect(&g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));
+    connect(g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady()));
+    connect(g_FSHost, SIGNAL(ringing(QSharedPointer<Call>)), this, SLOT(ringing(QSharedPointer<Call>)));
+    connect(g_FSHost, SIGNAL(answered(QSharedPointer<Call>)), this, SLOT(answered(QSharedPointer<Call>)));
+    connect(g_FSHost, SIGNAL(hungup(QSharedPointer<Call>)), this, SLOT(hungup(QSharedPointer<Call>)));
+    connect(g_FSHost, SIGNAL(newOutgoingCall(QSharedPointer<Call>)), this, SLOT(newOutgoingCall(QSharedPointer<Call>)));
+    connect(g_FSHost, SIGNAL(callFailed(QSharedPointer<Call>)), this, SLOT(callFailed(QSharedPointer<Call>)));
+    connect(g_FSHost, SIGNAL(accountStateChange(QSharedPointer<Account>)), this, SLOT(accountStateChanged(QSharedPointer<Account>)));
+    connect(g_FSHost, SIGNAL(newAccount(QSharedPointer<Account>)), this, SLOT(accountAdd(QSharedPointer<Account>)));
+    connect(g_FSHost, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountDel(QSharedPointer<Account>)));
+    connect(g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));
 
     /* Connect call commands */
     connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
@@ -128,8 +128,8 @@ MainWindow::~MainWindow()
 {
     delete ui;
     QString res;
-    g_FSHost.sendCmd("fsctl", "shutdown", &res);
-    g_FSHost.wait();
+    g_FSHost->sendCmd("fsctl", "shutdown", &res);
+    g_FSHost->wait();
 }
 
 void MainWindow::updateCallTimers()
@@ -137,7 +137,7 @@ void MainWindow::updateCallTimers()
     for(int row=0; row<ui->tableCalls->rowCount(); row++)
     {
         QTableWidgetItem* item = ui->tableCalls->item(row, 2);
-        QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
+        QSharedPointer<Call> call = g_FSHost->getCallByUUID(item->data(Qt::UserRole).toString());
         QTime time = call.data()->getCurrentStateTime();
         item->setText(time.toString("hh:mm:ss"));
         item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
@@ -182,8 +182,8 @@ void MainWindow::debugConsoleTriggered()
 
 void MainWindow::applyPreprocessors(QStringList cmds)
 {
-    if (g_FSHost.getCurrentActiveCall().isNull()) return;
-    QString uuid = g_FSHost.getCurrentActiveCall().data()->getUuid();
+    if (g_FSHost->getCurrentActiveCall().isNull()) return;
+    QString uuid = g_FSHost->getCurrentActiveCall().data()->getUuid();
     foreach(QString cmd, cmds)
     {
         switch_stream_handle_t stream = { 0 };
@@ -259,16 +259,16 @@ void MainWindow::accountStateChanged(QSharedPointer<Account> acc)
 
 void MainWindow::sendDTMF(QString dtmf)
 {
-    g_FSHost.getCurrentActiveCall().data()->sendDTMF(dtmf);
+    g_FSHost->getCurrentActiveCall().data()->sendDTMF(dtmf);
 }
 
 void MainWindow::callTableDoubleClick(QTableWidgetItem *item)
 {
-    QSharedPointer<Call> lastCall = g_FSHost.getCurrentActiveCall();
-    QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
+    QSharedPointer<Call> lastCall = g_FSHost->getCurrentActiveCall();
+    QSharedPointer<Call> call = g_FSHost->getCallByUUID(item->data(Qt::UserRole).toString());
     QString switch_str = QString("switch %1").arg(call.data()->getCallID());
     QString result;
-    if (g_FSHost.sendCmd("pa", switch_str.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+    if (g_FSHost->sendCmd("pa", switch_str.toAscii(), &result) == SWITCH_STATUS_FALSE) {
         ui->textEdit->setText(QString("Error switching to call %1").arg(call.data()->getCallID()));
         return;
     }
@@ -285,7 +285,7 @@ void MainWindow::makeCall()
     QString dialstring = QInputDialog::getText(this, tr("Make new call"),
                                                tr("Number to dial:"), QLineEdit::Normal, NULL,&ok);
 
-    QSharedPointer<Account> acc = g_FSHost.getCurrentDefaultAccount();
+    QSharedPointer<Account> acc = g_FSHost->getCurrentDefaultAccount();
     if (!acc.isNull()) {
         QSettings settings;
         settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways/");
@@ -329,13 +329,13 @@ void MainWindow::fshostReady()
     sysTray->show();
     sysTray->showMessage(tr("Status"), tr("FSComm has initialized!"), QSystemTrayIcon::Information, 5000);
 
-    if (!g_FSHost.isModuleLoaded("mod_sofia"))
+    if (!g_FSHost->isModuleLoaded("mod_sofia"))
     {
         QMessageBox::warning(this, tr("SIP not available"),
                              tr("Sofia could not be loaded, therefore, SIP will not be available."),
                              QMessageBox::Ok);
     }
-    if (!g_FSHost.isModuleLoaded("mod_portaudio"))
+    if (!g_FSHost->isModuleLoaded("mod_portaudio"))
     {
         QMessageBox::warning(this, tr("Audio not available"),
                              tr("Portaudio could not be loaded. Please check if mod_portaudio is properly compiled."),
@@ -347,7 +347,7 @@ void MainWindow::fshostReady()
 void MainWindow::paAnswer()
 {
     QString result;
-    if (g_FSHost.sendCmd("pa", "answer", &result) == SWITCH_STATUS_FALSE) {
+    if (g_FSHost->sendCmd("pa", "answer", &result) == SWITCH_STATUS_FALSE) {
         ui->textEdit->setText("Error sending that command");
     }
 
@@ -362,7 +362,7 @@ void MainWindow::paCall(QString dialstring)
 
     QString callstring = QString("call %1").arg(dialstring);
 
-    if (g_FSHost.sendCmd("pa", callstring.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+    if (g_FSHost->sendCmd("pa", callstring.toAscii(), &result) == SWITCH_STATUS_FALSE) {
         ui->textEdit->setText("Error sending that command");
     }
 
@@ -372,7 +372,7 @@ void MainWindow::paCall(QString dialstring)
 void MainWindow::paHangup()
 {
     QString result;
-    if (g_FSHost.sendCmd("pa", "hangup", &result) == SWITCH_STATUS_FALSE) {
+    if (g_FSHost->sendCmd("pa", "hangup", &result) == SWITCH_STATUS_FALSE) {
         ui->textEdit->setText("Error sending that command");
     }
 
@@ -384,7 +384,7 @@ void MainWindow::paHangup()
 void MainWindow::holdCall(bool pressed)
 {
 
-    QSharedPointer<Call> call = g_FSHost.getCurrentActiveCall();
+    QSharedPointer<Call> call = g_FSHost->getCurrentActiveCall();
 
     if (call.isNull())
     {
@@ -406,7 +406,7 @@ void MainWindow::holdCall(bool pressed)
 
 void MainWindow::recordCall(bool pressed)
 {
-    QSharedPointer<Call> call = g_FSHost.getCurrentActiveCall();
+    QSharedPointer<Call> call = g_FSHost->getCurrentActiveCall();
 
     if (call.isNull())
     {
@@ -649,7 +649,7 @@ void MainWindow::changeEvent(QEvent *e)
 void MainWindow::showAbout()
 {
     QString result;
-    g_FSHost.sendCmd("version", "", &result);
+    g_FSHost->sendCmd("version", "", &result);
 
     QMessageBox::about(this, tr("About FSComm"),
                        tr("<h2>FSComm</h2>"
index 098977d8fee2ed1fb70c4d29601d35f9ce2cd9fb..0fca4c547f618d97d4ebfe5bb7c32fec6bd5f479 100644 (file)
@@ -128,10 +128,10 @@ void AccountDialog::readConfig()
 
 void AccountDialog::writeConfig()
 {
-    QSharedPointer<Account> acc = g_FSHost.getAccountByUUID(_accId);
+    QSharedPointer<Account> acc = g_FSHost->getAccountByUUID(_accId);
     if (!acc.isNull())
     {
-        g_FSHost.accountReloadCmd(acc);
+        g_FSHost->accountReloadCmd(acc);
     }
 
     _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
index 7374715a621ce34940b24445823571ad858adf26..fd8c88f22cfc215fa11f2a1c182c7bf8ea9d2cf0 100644 (file)
@@ -20,7 +20,7 @@ void PrefAccounts::addAccountBtnClicked()
     if (!_accDlg)
     {
         QString uuid;
-        if (g_FSHost.sendCmd("create_uuid", "", &uuid) != SWITCH_STATUS_SUCCESS)
+        if (g_FSHost->sendCmd("create_uuid", "", &uuid) != SWITCH_STATUS_SUCCESS)
         {
             switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create UUID for account. Reason: %s\n", uuid.toAscii().constData());
             return;
@@ -31,7 +31,7 @@ void PrefAccounts::addAccountBtnClicked()
     else
     {
         QString uuid;
-        if (g_FSHost.sendCmd("create_uuid", "", &uuid) != SWITCH_STATUS_SUCCESS)
+        if (g_FSHost->sendCmd("create_uuid", "", &uuid) != SWITCH_STATUS_SUCCESS)
         {
             switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create UUID for account. Reason: %s\n", uuid.toAscii().constData());
             return;
@@ -89,13 +89,13 @@ void PrefAccounts::remAccountBtnClicked()
             /* Fire event to remove account */
             switch_event_t *event;
             if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FSCOMM_EVENT_ACC_REMOVED) == SWITCH_STATUS_SUCCESS) {
-                QSharedPointer<Account> acc = g_FSHost.getAccountByUUID(item->data(Qt::UserRole).toString());
+                QSharedPointer<Account> acc = g_FSHost->getAccountByUUID(item->data(Qt::UserRole).toString());
                 if (!acc.isNull())
                 {
                     QString res;
                     QString arg = QString("profile softphone killgw %1").arg(acc.data()->getName());
 
-                    if (g_FSHost.sendCmd("sofia", arg.toAscii().data() , &res) != SWITCH_STATUS_SUCCESS)
+                    if (g_FSHost->sendCmd("sofia", arg.toAscii().data() , &res) != SWITCH_STATUS_SUCCESS)
                     {
                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not killgw %s from profile softphone.\n",
                                           acc.data()->getName().toAscii().data());
@@ -149,7 +149,7 @@ void PrefAccounts::readConfig(bool reload)
     if (reload)
     {
         QString res;
-        if (g_FSHost.sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
+        if (g_FSHost->sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
         {
             switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
             return;
index 8328c500b06302092f2030912d98f04cea925224..0a28174c27acdb095c6cb70c998c69707b6d7ddc 100644 (file)
@@ -42,7 +42,7 @@ void PrefPortaudio::applyPreprocessors(bool state)
 void PrefPortaudio::ringdevTest()
 {
     QString result;
-    if (g_FSHost.sendCmd("pa", QString("play %1/.fscomm/sounds/test.wav 0").arg(QDir::homePath()).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("pa", QString("play %1/.fscomm/sounds/test.wav 0").arg(QDir::homePath()).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error testing ringdev on mod_portaudio! %s\n",
                           result.toAscii().constData());
@@ -53,7 +53,7 @@ void PrefPortaudio::loopTest()
 {
     QString result;
     _ui->PaLoopTestBtn->setEnabled(false);
-    if (g_FSHost.sendCmd("pa", "looptest", &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("pa", "looptest", &result) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running looptest on mod_portaudio! %s\n",
                           result.toAscii().constData());
@@ -64,7 +64,7 @@ void PrefPortaudio::loopTest()
 void PrefPortaudio::refreshDevList()
 {
     QString result;
-    if (g_FSHost.sendCmd("pa", "rescan", &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("pa", "rescan", &result) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error rescaning sound device on mod_portaudio! %s\n",
                           result.toAscii().constData());
@@ -80,7 +80,7 @@ void PrefPortaudio::indevChangeDev(int index)
 {
     QString result;
     int dev = _ui->PaIndevCombo->itemData(index, Qt::UserRole).toInt();
-    if (g_FSHost.sendCmd("pa", QString("indev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("pa", QString("indev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev to #%d on mod_portaudio!\n", dev);
         QMessageBox::critical(0, tr("Unable to change device."),
@@ -94,7 +94,7 @@ void PrefPortaudio::ringdevChangeDev(int index)
 {
     QString result;
     int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt();
-    if (g_FSHost.sendCmd("pa", QString("ringdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("pa", QString("ringdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev to #%d on mod_portaudio!\n", dev);
         QMessageBox::critical(0, tr("Unable to change device."),
@@ -108,7 +108,7 @@ void PrefPortaudio::outdevChangeDev(int index)
 {
     QString result;
     int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt();
-    if (g_FSHost.sendCmd("pa", QString("outdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("pa", QString("outdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting outdev to #%d on mod_portaudio!\n", dev);
         QMessageBox::critical(0, tr("Unable to change device."),
@@ -173,7 +173,7 @@ void PrefPortaudio::writeConfig()
         sample_rate != nsample_rate||
         codec_ms != ncodec_ms)
     {
-        if (g_FSHost.sendCmd("reload", "mod_portaudio", &result) == SWITCH_STATUS_SUCCESS)
+        if (g_FSHost->sendCmd("reload", "mod_portaudio", &result) == SWITCH_STATUS_SUCCESS)
         {
             _settings->setValue("cid-name", ncid_name);
             _settings->setValue("cid-num", ncid_num);
@@ -201,7 +201,7 @@ void PrefPortaudio::writeConfig()
 
     if (nindev != indev)
     {
-        if (g_FSHost.sendCmd("pa", QString("indev #%1").arg(nindev).toAscii().constData(), &result) == SWITCH_STATUS_SUCCESS)
+        if (g_FSHost->sendCmd("pa", QString("indev #%1").arg(nindev).toAscii().constData(), &result) == SWITCH_STATUS_SUCCESS)
         {
             _settings->setValue("indev", nindev);
         }
@@ -252,7 +252,7 @@ void PrefPortaudio::getPaDevlist()
     int errorLine, errorColumn;
     QString errorMsg;
 
-    if (g_FSHost.sendCmd("pa", "devlist xml", &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost->sendCmd("pa", "devlist xml", &result) != SWITCH_STATUS_SUCCESS)
     {
         QMessageBox::critical(0, tr("PortAudio error" ),
                               tr("Error querying audio devices."),