Modified: freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp (16104 => 16105)
--- freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp 2009-12-31 17:34:19 UTC (rev 16104)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp 2009-12-31 18:30:42 UTC (rev 16105)
@@ -9,8 +9,9 @@
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 @@
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 @@
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)
Modified: freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.h (16104 => 16105)
--- freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.h 2009-12-31 17:34:19 UTC (rev 16104)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.h 2009-12-31 18:30:42 UTC (rev 16105)
@@ -53,7 +53,8 @@
private slots:
void fshostReady();
void paDevlist();
- void showCodecs();
+ void paAnswer();
+ void paHangup();
void ringing(QString, QString, QString);
private:
Modified: freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.ui (16104 => 16105)
--- freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.ui 2009-12-31 17:34:19 UTC (rev 16104)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.ui 2009-12-31 18:30:42 UTC (rev 16105)
@@ -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>