提交 7dfe65b7 authored 作者: Jeff Lenk's avatar Jeff Lenk

change implicit construction of FSHost - now occurs after QApplication - for…

change implicit construction of FSHost - now occurs after QApplication - for some reason Windows QT didnt like this.
上级 170404a4
...@@ -69,13 +69,13 @@ switch_status_t Call::toggleRecord(bool startRecord) ...@@ -69,13 +69,13 @@ switch_status_t Call::toggleRecord(bool startRecord)
conf_dir.absolutePath(), conf_dir.absolutePath(),
QDateTime::currentDateTime().toString("yyyyMMddhhmmss"), QDateTime::currentDateTime().toString("yyyyMMddhhmmss"),
getCidNumber()); 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 else
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping call recording on call [%s]\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping call recording on call [%s]\n",
getUuid().toAscii().data()); 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; return status;
...@@ -85,7 +85,7 @@ void Call::sendDTMF(QString digit) ...@@ -85,7 +85,7 @@ void Call::sendDTMF(QString digit)
{ {
QString result; QString result;
QString dtmf_string = QString("dtmf %1").arg(digit); 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()); 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); QMessageBox::critical(0, QWidget::tr("DTMF Error"), QWidget::tr("There was an error sending DTMF, please report this bug."), QMessageBox::Ok);
} }
......
...@@ -54,7 +54,7 @@ ConsoleWindow::ConsoleWindow(QWidget *parent) : ...@@ -54,7 +54,7 @@ ConsoleWindow::ConsoleWindow(QWidget *parent) :
connect(ui->filterReverseCheckBox, SIGNAL(toggled(bool)), connect(ui->filterReverseCheckBox, SIGNAL(toggled(bool)),
this, SLOT(reverseFilterChecked())); 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() ...@@ -104,7 +104,7 @@ void ConsoleWindow::cmdSendClicked()
} }
QString res; 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()) if (!res.isEmpty())
{ {
/* Remove \r\n */ /* Remove \r\n */
......
...@@ -6,7 +6,7 @@ StateDebugDialog::StateDebugDialog(QWidget *parent) : ...@@ -6,7 +6,7 @@ StateDebugDialog::StateDebugDialog(QWidget *parent) :
ui(new Ui::StateDebugDialog) ui(new Ui::StateDebugDialog)
{ {
ui->setupUi(this); 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->listUUID, SIGNAL(itemSelectionChanged()), this, SLOT(currentUuidChanged()));
connect(ui->listEvents, SIGNAL(itemSelectionChanged()), this, SLOT(currentEventsChanged())); connect(ui->listEvents, SIGNAL(itemSelectionChanged()), this, SLOT(currentEventsChanged()));
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "mod_qsettings/mod_qsettings.h" #include "mod_qsettings/mod_qsettings.h"
/* Declare it globally */ /* Declare it globally */
FSHost g_FSHost; FSHost *g_FSHost;
FSHost::FSHost(QObject *parent) : FSHost::FSHost(QObject *parent) :
QThread(parent) QThread(parent)
...@@ -472,7 +472,7 @@ void FSHost::accountReloadCmd(QSharedPointer<Account> acc) ...@@ -472,7 +472,7 @@ void FSHost::accountReloadCmd(QSharedPointer<Account> acc)
connect(this, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountReloadSlot(QSharedPointer<Account>))); 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", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not killgw %s from profile softphone.\n",
acc.data()->getName().toAscii().data()); acc.data()->getName().toAscii().data());
...@@ -486,7 +486,7 @@ void FSHost::accountReloadSlot(QSharedPointer<Account> acc) ...@@ -486,7 +486,7 @@ void FSHost::accountReloadSlot(QSharedPointer<Account> acc)
{ {
_reloading_Accounts.takeAt(_reloading_Accounts.indexOf(acc.data()->getName(), 0)); _reloading_Accounts.takeAt(_reloading_Accounts.indexOf(acc.data()->getName(), 0));
QString res; 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"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
return; return;
......
...@@ -122,7 +122,7 @@ private: ...@@ -122,7 +122,7 @@ private:
QList<QString> _loadedModules; 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 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) ...@@ -133,7 +133,7 @@ static void eventHandlerCallback(switch_event_t *event)
switch_event_t *clone = NULL; switch_event_t *clone = NULL;
if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
QSharedPointer<switch_event_t> e(clone); 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 ...@@ -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); switch_log_node_t *clone = switch_log_node_dup(node);
QSharedPointer<switch_log_node_t> l(clone); QSharedPointer<switch_log_node_t> l(clone);
g_FSHost.generalLoggerHandler(l, level); g_FSHost->generalLoggerHandler(l, level);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
...@@ -43,11 +43,13 @@ int main(int argc, char *argv[]) ...@@ -43,11 +43,13 @@ int main(int argc, char *argv[])
splash->show(); splash->show();
splash->showMessage("Loading core, please wait...", Qt::AlignRight|Qt::AlignBottom, Qt::blue); 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; MainWindow w;
QObject::connect(&g_FSHost, SIGNAL(ready()), &w, SLOT(show())); QObject::connect(g_FSHost, SIGNAL(ready()), &w, SLOT(show()));
g_FSHost.start(); g_FSHost->start();
return a.exec(); return a.exec();
} }
...@@ -84,16 +84,16 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -84,16 +84,16 @@ MainWindow::MainWindow(QWidget *parent) :
connect(dialpadMapper, SIGNAL(mapped(QString)), this, SLOT(sendDTMF(QString))); connect(dialpadMapper, SIGNAL(mapped(QString)), this, SLOT(sendDTMF(QString)));
/* Connect events related to FreeSWITCH */ /* Connect events related to FreeSWITCH */
connect(&g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady())); connect(g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady()));
connect(&g_FSHost, SIGNAL(ringing(QSharedPointer<Call>)), this, SLOT(ringing(QSharedPointer<Call>))); 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(answered(QSharedPointer<Call>)), this, SLOT(answered(QSharedPointer<Call>)));
connect(&g_FSHost, SIGNAL(hungup(QSharedPointer<Call>)), this, SLOT(hungup(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(newOutgoingCall(QSharedPointer<Call>)), this, SLOT(newOutgoingCall(QSharedPointer<Call>)));
connect(&g_FSHost, SIGNAL(callFailed(QSharedPointer<Call>)), this, SLOT(callFailed(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(accountStateChange(QSharedPointer<Account>)), this, SLOT(accountStateChanged(QSharedPointer<Account>)));
connect(&g_FSHost, SIGNAL(newAccount(QSharedPointer<Account>)), this, SLOT(accountAdd(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(delAccount(QSharedPointer<Account>)), this, SLOT(accountDel(QSharedPointer<Account>)));
connect(&g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString))); connect(g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));
/* Connect call commands */ /* Connect call commands */
connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall())); connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
...@@ -128,8 +128,8 @@ MainWindow::~MainWindow() ...@@ -128,8 +128,8 @@ MainWindow::~MainWindow()
{ {
delete ui; delete ui;
QString res; QString res;
g_FSHost.sendCmd("fsctl", "shutdown", &res); g_FSHost->sendCmd("fsctl", "shutdown", &res);
g_FSHost.wait(); g_FSHost->wait();
} }
void MainWindow::updateCallTimers() void MainWindow::updateCallTimers()
...@@ -137,7 +137,7 @@ void MainWindow::updateCallTimers() ...@@ -137,7 +137,7 @@ void MainWindow::updateCallTimers()
for(int row=0; row<ui->tableCalls->rowCount(); row++) for(int row=0; row<ui->tableCalls->rowCount(); row++)
{ {
QTableWidgetItem* item = ui->tableCalls->item(row, 2); 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(); QTime time = call.data()->getCurrentStateTime();
item->setText(time.toString("hh:mm:ss")); item->setText(time.toString("hh:mm:ss"));
item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
...@@ -182,8 +182,8 @@ void MainWindow::debugConsoleTriggered() ...@@ -182,8 +182,8 @@ void MainWindow::debugConsoleTriggered()
void MainWindow::applyPreprocessors(QStringList cmds) void MainWindow::applyPreprocessors(QStringList cmds)
{ {
if (g_FSHost.getCurrentActiveCall().isNull()) return; if (g_FSHost->getCurrentActiveCall().isNull()) return;
QString uuid = g_FSHost.getCurrentActiveCall().data()->getUuid(); QString uuid = g_FSHost->getCurrentActiveCall().data()->getUuid();
foreach(QString cmd, cmds) foreach(QString cmd, cmds)
{ {
switch_stream_handle_t stream = { 0 }; switch_stream_handle_t stream = { 0 };
...@@ -259,16 +259,16 @@ void MainWindow::accountStateChanged(QSharedPointer<Account> acc) ...@@ -259,16 +259,16 @@ void MainWindow::accountStateChanged(QSharedPointer<Account> acc)
void MainWindow::sendDTMF(QString dtmf) void MainWindow::sendDTMF(QString dtmf)
{ {
g_FSHost.getCurrentActiveCall().data()->sendDTMF(dtmf); g_FSHost->getCurrentActiveCall().data()->sendDTMF(dtmf);
} }
void MainWindow::callTableDoubleClick(QTableWidgetItem *item) void MainWindow::callTableDoubleClick(QTableWidgetItem *item)
{ {
QSharedPointer<Call> lastCall = g_FSHost.getCurrentActiveCall(); QSharedPointer<Call> lastCall = g_FSHost->getCurrentActiveCall();
QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString()); QSharedPointer<Call> call = g_FSHost->getCallByUUID(item->data(Qt::UserRole).toString());
QString switch_str = QString("switch %1").arg(call.data()->getCallID()); QString switch_str = QString("switch %1").arg(call.data()->getCallID());
QString result; 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())); ui->textEdit->setText(QString("Error switching to call %1").arg(call.data()->getCallID()));
return; return;
} }
...@@ -285,7 +285,7 @@ void MainWindow::makeCall() ...@@ -285,7 +285,7 @@ void MainWindow::makeCall()
QString dialstring = QInputDialog::getText(this, tr("Make new call"), QString dialstring = QInputDialog::getText(this, tr("Make new call"),
tr("Number to dial:"), QLineEdit::Normal, NULL,&ok); tr("Number to dial:"), QLineEdit::Normal, NULL,&ok);
QSharedPointer<Account> acc = g_FSHost.getCurrentDefaultAccount(); QSharedPointer<Account> acc = g_FSHost->getCurrentDefaultAccount();
if (!acc.isNull()) { if (!acc.isNull()) {
QSettings settings; QSettings settings;
settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways/"); settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways/");
...@@ -329,13 +329,13 @@ void MainWindow::fshostReady() ...@@ -329,13 +329,13 @@ void MainWindow::fshostReady()
sysTray->show(); sysTray->show();
sysTray->showMessage(tr("Status"), tr("FSComm has initialized!"), QSystemTrayIcon::Information, 5000); 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"), QMessageBox::warning(this, tr("SIP not available"),
tr("Sofia could not be loaded, therefore, SIP will not be available."), tr("Sofia could not be loaded, therefore, SIP will not be available."),
QMessageBox::Ok); QMessageBox::Ok);
} }
if (!g_FSHost.isModuleLoaded("mod_portaudio")) if (!g_FSHost->isModuleLoaded("mod_portaudio"))
{ {
QMessageBox::warning(this, tr("Audio not available"), QMessageBox::warning(this, tr("Audio not available"),
tr("Portaudio could not be loaded. Please check if mod_portaudio is properly compiled."), tr("Portaudio could not be loaded. Please check if mod_portaudio is properly compiled."),
...@@ -347,7 +347,7 @@ void MainWindow::fshostReady() ...@@ -347,7 +347,7 @@ void MainWindow::fshostReady()
void MainWindow::paAnswer() void MainWindow::paAnswer()
{ {
QString result; 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"); ui->textEdit->setText("Error sending that command");
} }
...@@ -362,7 +362,7 @@ void MainWindow::paCall(QString dialstring) ...@@ -362,7 +362,7 @@ void MainWindow::paCall(QString dialstring)
QString callstring = QString("call %1").arg(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"); ui->textEdit->setText("Error sending that command");
} }
...@@ -372,7 +372,7 @@ void MainWindow::paCall(QString dialstring) ...@@ -372,7 +372,7 @@ void MainWindow::paCall(QString dialstring)
void MainWindow::paHangup() void MainWindow::paHangup()
{ {
QString result; 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"); ui->textEdit->setText("Error sending that command");
} }
...@@ -384,7 +384,7 @@ void MainWindow::paHangup() ...@@ -384,7 +384,7 @@ void MainWindow::paHangup()
void MainWindow::holdCall(bool pressed) void MainWindow::holdCall(bool pressed)
{ {
QSharedPointer<Call> call = g_FSHost.getCurrentActiveCall(); QSharedPointer<Call> call = g_FSHost->getCurrentActiveCall();
if (call.isNull()) if (call.isNull())
{ {
...@@ -406,7 +406,7 @@ void MainWindow::holdCall(bool pressed) ...@@ -406,7 +406,7 @@ void MainWindow::holdCall(bool pressed)
void MainWindow::recordCall(bool pressed) void MainWindow::recordCall(bool pressed)
{ {
QSharedPointer<Call> call = g_FSHost.getCurrentActiveCall(); QSharedPointer<Call> call = g_FSHost->getCurrentActiveCall();
if (call.isNull()) if (call.isNull())
{ {
...@@ -649,7 +649,7 @@ void MainWindow::changeEvent(QEvent *e) ...@@ -649,7 +649,7 @@ void MainWindow::changeEvent(QEvent *e)
void MainWindow::showAbout() void MainWindow::showAbout()
{ {
QString result; QString result;
g_FSHost.sendCmd("version", "", &result); g_FSHost->sendCmd("version", "", &result);
QMessageBox::about(this, tr("About FSComm"), QMessageBox::about(this, tr("About FSComm"),
tr("<h2>FSComm</h2>" tr("<h2>FSComm</h2>"
......
...@@ -128,10 +128,10 @@ void AccountDialog::readConfig() ...@@ -128,10 +128,10 @@ void AccountDialog::readConfig()
void AccountDialog::writeConfig() void AccountDialog::writeConfig()
{ {
QSharedPointer<Account> acc = g_FSHost.getAccountByUUID(_accId); QSharedPointer<Account> acc = g_FSHost->getAccountByUUID(_accId);
if (!acc.isNull()) if (!acc.isNull())
{ {
g_FSHost.accountReloadCmd(acc); g_FSHost->accountReloadCmd(acc);
} }
_settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways"); _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
......
...@@ -20,7 +20,7 @@ void PrefAccounts::addAccountBtnClicked() ...@@ -20,7 +20,7 @@ void PrefAccounts::addAccountBtnClicked()
if (!_accDlg) if (!_accDlg)
{ {
QString uuid; 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()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create UUID for account. Reason: %s\n", uuid.toAscii().constData());
return; return;
...@@ -31,7 +31,7 @@ void PrefAccounts::addAccountBtnClicked() ...@@ -31,7 +31,7 @@ void PrefAccounts::addAccountBtnClicked()
else else
{ {
QString uuid; 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()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create UUID for account. Reason: %s\n", uuid.toAscii().constData());
return; return;
...@@ -89,13 +89,13 @@ void PrefAccounts::remAccountBtnClicked() ...@@ -89,13 +89,13 @@ void PrefAccounts::remAccountBtnClicked()
/* Fire event to remove account */ /* Fire event to remove account */
switch_event_t *event; switch_event_t *event;
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FSCOMM_EVENT_ACC_REMOVED) == SWITCH_STATUS_SUCCESS) { 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()) if (!acc.isNull())
{ {
QString res; QString res;
QString arg = QString("profile softphone killgw %1").arg(acc.data()->getName()); 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", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not killgw %s from profile softphone.\n",
acc.data()->getName().toAscii().data()); acc.data()->getName().toAscii().data());
...@@ -149,7 +149,7 @@ void PrefAccounts::readConfig(bool reload) ...@@ -149,7 +149,7 @@ void PrefAccounts::readConfig(bool reload)
if (reload) if (reload)
{ {
QString res; 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"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
return; return;
......
...@@ -42,7 +42,7 @@ void PrefPortaudio::applyPreprocessors(bool state) ...@@ -42,7 +42,7 @@ void PrefPortaudio::applyPreprocessors(bool state)
void PrefPortaudio::ringdevTest() void PrefPortaudio::ringdevTest()
{ {
QString result; 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", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error testing ringdev on mod_portaudio! %s\n",
result.toAscii().constData()); result.toAscii().constData());
...@@ -53,7 +53,7 @@ void PrefPortaudio::loopTest() ...@@ -53,7 +53,7 @@ void PrefPortaudio::loopTest()
{ {
QString result; QString result;
_ui->PaLoopTestBtn->setEnabled(false); _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", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running looptest on mod_portaudio! %s\n",
result.toAscii().constData()); result.toAscii().constData());
...@@ -64,7 +64,7 @@ void PrefPortaudio::loopTest() ...@@ -64,7 +64,7 @@ void PrefPortaudio::loopTest()
void PrefPortaudio::refreshDevList() void PrefPortaudio::refreshDevList()
{ {
QString result; 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", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error rescaning sound device on mod_portaudio! %s\n",
result.toAscii().constData()); result.toAscii().constData());
...@@ -80,7 +80,7 @@ void PrefPortaudio::indevChangeDev(int index) ...@@ -80,7 +80,7 @@ void PrefPortaudio::indevChangeDev(int index)
{ {
QString result; QString result;
int dev = _ui->PaIndevCombo->itemData(index, Qt::UserRole).toInt(); 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); 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."), QMessageBox::critical(0, tr("Unable to change device."),
...@@ -94,7 +94,7 @@ void PrefPortaudio::ringdevChangeDev(int index) ...@@ -94,7 +94,7 @@ void PrefPortaudio::ringdevChangeDev(int index)
{ {
QString result; QString result;
int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt(); 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); 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."), QMessageBox::critical(0, tr("Unable to change device."),
...@@ -108,7 +108,7 @@ void PrefPortaudio::outdevChangeDev(int index) ...@@ -108,7 +108,7 @@ void PrefPortaudio::outdevChangeDev(int index)
{ {
QString result; QString result;
int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt(); 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); 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."), QMessageBox::critical(0, tr("Unable to change device."),
...@@ -173,7 +173,7 @@ void PrefPortaudio::writeConfig() ...@@ -173,7 +173,7 @@ void PrefPortaudio::writeConfig()
sample_rate != nsample_rate|| sample_rate != nsample_rate||
codec_ms != ncodec_ms) 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-name", ncid_name);
_settings->setValue("cid-num", ncid_num); _settings->setValue("cid-num", ncid_num);
...@@ -201,7 +201,7 @@ void PrefPortaudio::writeConfig() ...@@ -201,7 +201,7 @@ void PrefPortaudio::writeConfig()
if (nindev != indev) 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); _settings->setValue("indev", nindev);
} }
...@@ -252,7 +252,7 @@ void PrefPortaudio::getPaDevlist() ...@@ -252,7 +252,7 @@ void PrefPortaudio::getPaDevlist()
int errorLine, errorColumn; int errorLine, errorColumn;
QString errorMsg; 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" ), QMessageBox::critical(0, tr("PortAudio error" ),
tr("Error querying audio devices."), tr("Error querying audio devices."),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论