提交 2efcd100 authored 作者: João Mesquita's avatar João Mesquita

Button to answer and hangup call

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@16105 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 aaeebc8a
......@@ -9,8 +9,9 @@ MainWindow::MainWindow(QWidget *parent) :
connect(&g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady()));
connect(&g_FSHost, SIGNAL(ringing(QString,QString,QString)), this, SLOT(ringing(QString,QString,QString)));
connect(ui->answerBtn, SIGNAL(clicked()), this, SLOT(paAnswer()));
connect(ui->hangupBtn, SIGNAL(clicked()), this, SLOT(paHangup()));
connect(ui->paDevlistBtn, SIGNAL(clicked()), this, SLOT(paDevlist()));
connect(ui->showCodecsBtn, SIGNAL(clicked()), this, SLOT(showCodecs()));
g_FSHost.start();
}
......@@ -26,6 +27,8 @@ MainWindow::~MainWindow()
void MainWindow::fshostReady()
{
ui->statusBar->showMessage("FreeSWITCH is ready!", 0);
ui->paDevlistBtn->setEnabled(true);
ui->textEdit->setEnabled(true);
}
void MainWindow::paDevlist()
......@@ -38,19 +41,33 @@ void MainWindow::paDevlist()
ui->textEdit->setText(result);
}
void MainWindow::showCodecs()
void MainWindow::paAnswer()
{
QString result;
if (g_FSHost.sendCmd("show", "codecs as xml", &result) == SWITCH_STATUS_FALSE) {
if (g_FSHost.sendCmd("pa", "answer", &result) == SWITCH_STATUS_FALSE) {
ui->textEdit->setText("Error sending that command");
}
ui->textEdit->setText(result);
ui->textEdit->setText("Talking...");
ui->hangupBtn->setEnabled(true);
ui->answerBtn->setEnabled(false);
}
void MainWindow::paHangup()
{
QString result;
if (g_FSHost.sendCmd("pa", "hangup", &result) == SWITCH_STATUS_FALSE) {
ui->textEdit->setText("Error sending that command");
}
ui->textEdit->setText("Hungup ...");
ui->hangupBtn->setEnabled(false);
}
void MainWindow::ringing(QString uuid, QString caller_id_number, QString caller_id_name)
{
ui->textEdit->setText(QString("call_id: %1, Number: %2, Name: %3").arg(uuid, caller_id_number, caller_id_name));
ui->textEdit->setText(QString("Number: %1\nName: %3").arg(caller_id_number, caller_id_name));
ui->answerBtn->setEnabled(true);
}
void MainWindow::changeEvent(QEvent *e)
......
......@@ -53,7 +53,8 @@ protected:
private slots:
void fshostReady();
void paDevlist();
void showCodecs();
void paAnswer();
void paHangup();
void ringing(QString, QString, QString);
private:
......
......@@ -6,31 +6,51 @@
<rect>
<x>0</x>
<y>0</y>
<width>691</width>
<height>334</height>
<width>287</width>
<height>304</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="textEdit"/>
<widget class="QTextEdit" name="textEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="answerBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Answer</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="paDevlistBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>pa devlist</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="showCodecsBtn">
<widget class="QPushButton" name="hangupBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>show codecs</string>
<string>Hangup</string>
</property>
</widget>
</item>
......@@ -43,7 +63,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>691</width>
<width>287</width>
<height>24</height>
</rect>
</property>
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论