<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][16349] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=16349">16349</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2010-01-17 20:43:48 -0600 (Sun, 17 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre><a href="http://jira.freeswitch.org/browse/FSCOMM-1">FSCOMM-1</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkfscommcallcpp">freeswitch/trunk/fscomm/call.cpp</a></li>
<li><a href="#freeswitchtrunkfscommcallh">freeswitch/trunk/fscomm/call.h</a></li>
<li><a href="#freeswitchtrunkfscommfshostcpp">freeswitch/trunk/fscomm/fshost.cpp</a></li>
<li><a href="#freeswitchtrunkfscommfshosth">freeswitch/trunk/fscomm/fshost.h</a></li>
<li><a href="#freeswitchtrunkfscommmainwindowcpp">freeswitch/trunk/fscomm/mainwindow.cpp</a></li>
<li><a href="#freeswitchtrunkfscommmainwindowh">freeswitch/trunk/fscomm/mainwindow.h</a></li>
<li><a href="#freeswitchtrunkfscommmainwindowui">freeswitch/trunk/fscomm/mainwindow.ui</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkfscommcallcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/call.cpp (16348 => 16349)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/call.cpp        2010-01-18 00:29:03 UTC (rev 16348)
+++ freeswitch/trunk/fscomm/call.cpp        2010-01-18 02:43:48 UTC (rev 16349)
</span><span class="lines">@@ -41,4 +41,29 @@
</span><span class="cx"> _direction(direction),
</span><span class="cx"> _uuid (uuid)
</span><span class="cx"> {
</span><ins>+ _isActive = false;
</ins><span class="cx"> }
</span><ins>+
+switch_status_t Call::toggleRecord(bool startRecord)
+{
+ QDir conf_dir = QDir::home();
+ QString result;
+ switch_status_t status;
+
+ if (startRecord)
+ {
+ _recording_filename = QString("%1/.fscomm/recordings/%2_%3.wav").arg(
+ conf_dir.absolutePath(),
+ QDateTime::currentDateTime().toString("yyyyMMddhhmmss"),
+ _cid_number);
+ status = g_FSHost.sendCmd("uuid_record", QString("%1 start %2").arg(_uuid, _recording_filename).toAscii().data(),&result);
+ }
+ else
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping call recording on call [%s]\n",
+ _uuid.toAscii().data());
+ status = g_FSHost.sendCmd("uuid_record", QString("%1 stop %2").arg(_uuid, _recording_filename).toAscii().data(),&result);
+ }
+
+ return status;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkfscommcallh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/call.h (16348 => 16349)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/call.h        2010-01-18 00:29:03 UTC (rev 16348)
+++ freeswitch/trunk/fscomm/call.h        2010-01-18 02:43:48 UTC (rev 16349)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx">
</span><span class="cx"> #include <QtCore>
</span><span class="cx"> #include <QString>
</span><ins>+#include <switch.h>
</ins><span class="cx">
</span><span class="cx"> typedef enum {
</span><span class="cx"> FSCOMM_CALL_STATE_RINGING = 0,
</span><span class="lines">@@ -59,6 +60,9 @@
</span><span class="cx"> void setState(fscomm_call_state_t state) { _state = state; }
</span><span class="cx"> void setCause(QString cause) { _cause = cause; }
</span><span class="cx"> QString getCause() { return _cause; }
</span><ins>+ void setActive(bool isActive) { _isActive = isActive; }
+ bool isActive() { return _isActive == true; }
+ switch_status_t toggleRecord(bool);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> int _call_id;
</span><span class="lines">@@ -68,6 +72,8 @@
</span><span class="cx"> fscomm_call_direction_t _direction;
</span><span class="cx"> QString _uuid;
</span><span class="cx"> QString _buuid;
</span><ins>+ bool _isActive;
+ QString _recording_filename;
</ins><span class="cx"> fscomm_call_state_t _state;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="freeswitchtrunkfscommfshostcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/fshost.cpp (16348 => 16349)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/fshost.cpp        2010-01-18 00:29:03 UTC (rev 16348)
+++ freeswitch/trunk/fscomm/fshost.cpp        2010-01-18 02:43:48 UTC (rev 16349)
</span><span class="lines">@@ -51,17 +51,18 @@
</span><span class="cx"> /* Create directory structure for softphone with default configs */
</span><span class="cx"> QDir conf_dir = QDir::home();
</span><span class="cx"> if (!conf_dir.exists(".fscomm"))
</span><del>- {
- conf_dir.mkpath(".fscomm/conf/accounts");
</del><ins>+ conf_dir.mkpath(".fscomm");
+ if (!conf_dir.exists(".fscomm/recordings"))
+ conf_dir.mkpath(".fscomm/recordings");
+ if (!conf_dir.exists(".fscomm/sounds")) {
</ins><span class="cx"> conf_dir.mkpath(".fscomm/sounds");
</span><span class="cx"> QFile::copy(":/sounds/test.wav", QString("%1/.fscomm/sounds/test.wav").arg(QDir::homePath()));
</span><ins>+ }
+ if(!QFile::exists(QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath()))) {
+ conf_dir.mkdir(".fscomm/conf");
</ins><span class="cx"> QFile rootXML(":/confs/freeswitch.xml");
</span><span class="cx"> QString dest = QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath());
</span><span class="cx"> rootXML.copy(dest);
</span><del>-
- QFile defaultAccount(":/confs/template.xml");
- dest = QString("%1/.fscomm/conf/accounts/template.xml").arg(conf_dir.absolutePath());
- defaultAccount.copy(dest);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* Set all directories to the home user directory */
</span><span class="lines">@@ -351,6 +352,7 @@
</span><span class="cx"> switch_status_t status = SWITCH_STATUS_FALSE;
</span><span class="cx"> switch_stream_handle_t stream = { 0 };
</span><span class="cx"> SWITCH_STANDARD_STREAM(stream);
</span><ins>+ qDebug() << "Sending command: " << cmd << args << endl;
</ins><span class="cx"> status = switch_api_execute(cmd, args, NULL, &stream);
</span><span class="cx"> *res = switch_str_nil((char *) stream.data);
</span><span class="cx"> switch_safe_free(stream.data);
</span><span class="lines">@@ -358,6 +360,16 @@
</span><span class="cx"> return status;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+QSharedPointer<Call> FSHost::getCurrentActiveCall()
+{
+ foreach(QSharedPointer<Call> call, _active_calls.values())
+ {
+ if (call.data()->isActive())
+ return call;
+ }
+ return QSharedPointer<Call>();
+}
+
</ins><span class="cx"> void FSHost::printEventHeaders(switch_event_t *event)
</span><span class="cx"> {
</span><span class="cx"> switch_event_header_t *hp;
</span></span></pre></div>
<a id="freeswitchtrunkfscommfshosth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/fshost.h (16348 => 16349)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/fshost.h        2010-01-18 00:29:03 UTC (rev 16348)
+++ freeswitch/trunk/fscomm/fshost.h        2010-01-18 02:43:48 UTC (rev 16349)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx"> switch_status_t sendCmd(const char *cmd, const char *args, QString *res);
</span><span class="cx"> void generalEventHandler(switch_event_t *event);
</span><span class="cx"> QSharedPointer<Call> getCallByUUID(QString uuid) { return _active_calls.value(uuid); }
</span><ins>+ QSharedPointer<Call> getCurrentActiveCall();
</ins><span class="cx"> QString getGwStateName(int id) { return fscomm_gw_state_names[id]; }
</span><span class="cx">
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="freeswitchtrunkfscommmainwindowcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/mainwindow.cpp (16348 => 16349)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/mainwindow.cpp        2010-01-18 00:29:03 UTC (rev 16348)
+++ freeswitch/trunk/fscomm/mainwindow.cpp        2010-01-18 02:43:48 UTC (rev 16349)
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx"> connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
</span><span class="cx"> connect(ui->answerBtn, SIGNAL(clicked()), this, SLOT(paAnswer()));
</span><span class="cx"> connect(ui->hangupBtn, SIGNAL(clicked()), this, SLOT(paHangup()));
</span><ins>+ connect(ui->recoredCallBtn, SIGNAL(toggled(bool)), SLOT(recordCall(bool)));
</ins><span class="cx"> connect(ui->listCalls, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(callListDoubleClick(QListWidgetItem*)));
</span><span class="cx"> connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefTriggered()));
</span><span class="cx"> connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close()));
</span><span class="lines">@@ -153,6 +154,7 @@
</span><span class="cx">
</span><span class="cx"> void MainWindow::callListDoubleClick(QListWidgetItem *item)
</span><span class="cx"> {
</span><ins>+ QSharedPointer<Call> lastCall = g_FSHost.getCurrentActiveCall();
</ins><span class="cx"> QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
</span><span class="cx"> QString switch_str = QString("switch %1").arg(call.data()->getCallID());
</span><span class="cx"> QString result;
</span><span class="lines">@@ -161,6 +163,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> ui->hangupBtn->setEnabled(true);
</span><ins>+ lastCall.data()->setActive(false);
+ call.data()->setActive(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MainWindow::makeCall()
</span><span class="lines">@@ -220,6 +224,31 @@
</span><span class="cx"> ui->hangupBtn->setEnabled(false);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MainWindow::recordCall(bool pressed)
+{
+ QSharedPointer<Call> call = g_FSHost.getCurrentActiveCall();
+
+ if (call.isNull())
+ {
+ QMessageBox::warning(this,tr("Record call"),
+ tr("<p>FSComm reports that there are no active calls to be recorded."
+ "<p>Please report this bug."),
+ QMessageBox::Ok);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not record call because there is not current active call!.\n");
+ return;
+ }
+
+ if (call.data()->toggleRecord(pressed) != SWITCH_STATUS_SUCCESS)
+ {
+ QMessageBox::warning(this,tr("Record call"),
+ tr("<p>Could not get active call to start/stop recording."
+ "<p>Please report this bug."),
+ QMessageBox::Ok);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not record call [%s].\n", call.data()->getUUID().toAscii().data());
+ return;
+ }
+}
+
</ins><span class="cx"> void MainWindow::newOutgoingCall(QSharedPointer<Call> call)
</span><span class="cx"> {
</span><span class="cx"> ui->textEdit->setText(QString("Calling %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
</span><span class="lines">@@ -227,6 +256,7 @@
</span><span class="cx"> item->setData(Qt::UserRole, call.data()->getUUID());
</span><span class="cx"> ui->listCalls->addItem(item);
</span><span class="cx"> ui->hangupBtn->setEnabled(true);
</span><ins>+ call.data()->setActive(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MainWindow::ringing(QSharedPointer<Call> call)
</span><span class="lines">@@ -248,6 +278,7 @@
</span><span class="cx"> item->setData(Qt::UserRole, call.data()->getUUID());
</span><span class="cx"> ui->listCalls->addItem(item);
</span><span class="cx"> ui->answerBtn->setEnabled(true);
</span><ins>+ call.data()->setActive(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MainWindow::answered(QSharedPointer<Call> call)
</span><span class="lines">@@ -301,6 +332,7 @@
</span><span class="cx"> ui->textEdit->setText(tr("Call with %1 (%2) failed with reason %3.").arg(call.data()->getCidName(),
</span><span class="cx"> call.data()->getCidNumber(),
</span><span class="cx"> call.data()->getCause()));
</span><ins>+ call.data()->setActive(false);
</ins><span class="cx"> /* TODO: Will cause problems if 2 calls are received at the same time */
</span><span class="cx"> ui->answerBtn->setEnabled(false);
</span><span class="cx"> ui->hangupBtn->setEnabled(false);
</span><span class="lines">@@ -334,6 +366,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ call.data()->setActive(false);
</ins><span class="cx"> ui->textEdit->setText(tr("Call with %1 (%2) hungup.").arg(call.data()->getCidName(), call.data()->getCidNumber()));
</span><span class="cx"> /* TODO: Will cause problems if 2 calls are received at the same time */
</span><span class="cx"> ui->answerBtn->setEnabled(false);
</span></span></pre></div>
<a id="freeswitchtrunkfscommmainwindowh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/mainwindow.h (16348 => 16349)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/mainwindow.h        2010-01-18 00:29:03 UTC (rev 16348)
+++ freeswitch/trunk/fscomm/mainwindow.h        2010-01-18 02:43:48 UTC (rev 16349)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx"> void answered(QSharedPointer<Call>);
</span><span class="cx"> void hungup(QSharedPointer<Call>);
</span><span class="cx"> void callFailed(QSharedPointer<Call>);
</span><ins>+ void recordCall(bool);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> Ui::MainWindow *ui;
</span></span></pre></div>
<a id="freeswitchtrunkfscommmainwindowui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/mainwindow.ui (16348 => 16349)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/mainwindow.ui        2010-01-18 00:29:03 UTC (rev 16348)
+++ freeswitch/trunk/fscomm/mainwindow.ui        2010-01-18 02:43:48 UTC (rev 16349)
</span><span class="lines">@@ -39,6 +39,19 @@
</span><span class="cx"> </property>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><ins>+ <item>
+ <widget class="QPushButton" name="recoredCallBtn">
+ <property name="text">
+ <string>Record</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
</ins><span class="cx"> </layout>
</span><span class="cx"> </item>
</span><span class="cx"> <item>
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>