<!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][17214] </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=17214">17214</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2010-04-05 20:03:20 -0500 (Mon, 05 Apr 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use more SharedPointers to make our lives easier.</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="#freeswitchtrunkfscommchannelcpp">freeswitch/trunk/fscomm/channel.cpp</a></li>
<li><a href="#freeswitchtrunkfscommchannelh">freeswitch/trunk/fscomm/channel.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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkfscommcallcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/call.cpp (17213 => 17214)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/call.cpp        2010-04-05 06:05:56 UTC (rev 17213)
+++ freeswitch/trunk/fscomm/call.cpp        2010-04-06 01:03:20 UTC (rev 17214)
</span><span class="lines">@@ -32,7 +32,9 @@
</span><span class="cx"> #include &lt;fshost.h&gt;
</span><span class="cx"> 
</span><span class="cx"> Call::Call()
</span><del>-{}
</del><ins>+{
+    _answeredEpoch = 0;
+}
</ins><span class="cx"> 
</span><span class="cx"> switch_status_t Call::toggleRecord(bool startRecord)
</span><span class="cx"> {
</span><span class="lines">@@ -70,6 +72,23 @@
</span><span class="cx"> 
</span><span class="cx"> QTime Call::getCurrentStateTime()
</span><span class="cx"> {
</span><del>-    int now = QDateTime::fromTime_t(_answered_epoch).secsTo(QDateTime::currentDateTime());
</del><ins>+    qulonglong time = 0;
+
+    if (_state == FSCOMM_CALL_STATE_ANSWERED)
+    {
+        time = _answeredEpoch;
+    }
+    else if(_state == FSCOMM_CALL_STATE_RINGING)
+    {
+        if (_direction == FSCOMM_CALL_DIRECTION_INBOUND)
+        {
+            /* TODO: DOESNT WORK - How do I get what time it started to ring? */
+            _channel.data()-&gt;getProgressEpoch() == 0 ? time = _channel.data()-&gt;getProgressMediaEpoch() : time = _channel.data()-&gt;getProgressEpoch();
+        }
+        else
+            _otherLegChannel.data()-&gt;getProgressEpoch() == 0 ? time = _otherLegChannel.data()-&gt;getProgressMediaEpoch() : time = _otherLegChannel.data()-&gt;getProgressEpoch();
+    }
+
+    int now = QDateTime::fromTime_t(time).secsTo(QDateTime::currentDateTime());
</ins><span class="cx">     return QTime::fromString(QString::number(now), &quot;s&quot;);
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunkfscommcallh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/call.h (17213 => 17214)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/call.h        2010-04-05 06:05:56 UTC (rev 17213)
+++ freeswitch/trunk/fscomm/call.h        2010-04-06 01:03:20 UTC (rev 17214)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">     bool isActive() { return _isActive == true; }
</span><span class="cx">     switch_status_t toggleRecord(bool);
</span><span class="cx">     void sendDTMF(QString digit);
</span><del>-    void setAnsweredEpoch(qulonglong time) { _answered_epoch = time/1000000; }
</del><ins>+    void setAnsweredEpoch(qulonglong time) { _answeredEpoch = time/1000000; }
</ins><span class="cx">     QTime getCurrentStateTime();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx">     bool _isActive;
</span><span class="cx">     QString _recording_filename;
</span><span class="cx">     fscomm_call_state_t _state;
</span><del>-    qulonglong _answered_epoch;
</del><ins>+    qulonglong _answeredEpoch;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Q_DECLARE_METATYPE(Call)
</span></span></pre></div>
<a id="freeswitchtrunkfscommchannelcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/channel.cpp (17213 => 17214)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/channel.cpp        2010-04-05 06:05:56 UTC (rev 17213)
+++ freeswitch/trunk/fscomm/channel.cpp        2010-04-06 01:03:20 UTC (rev 17214)
</span><span class="lines">@@ -3,4 +3,6 @@
</span><span class="cx"> Channel::Channel(QString uuid):
</span><span class="cx">         _uuid(uuid)
</span><span class="cx"> {
</span><ins>+    _progressEpoch = 0;
+    _progressMediaEpoch = 0;
</ins><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunkfscommchannelh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/channel.h (17213 => 17214)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/channel.h        2010-04-05 06:05:56 UTC (rev 17213)
+++ freeswitch/trunk/fscomm/channel.h        2010-04-06 01:03:20 UTC (rev 17214)
</span><span class="lines">@@ -16,14 +16,22 @@
</span><span class="cx">     void setDestinatinonNumber(QString destinationNumber) { _destinationNumber = destinationNumber; }
</span><span class="cx">     QString getDestinationNumber() { return _destinationNumber; }
</span><span class="cx"> 
</span><del>-    int getPaCallId() { return _pa_call_id; }
</del><ins>+    int getPaCallId() { return _paCallId; }
+    void setPaCallId(int paCallId) { _paCallId = paCallId;}
</ins><span class="cx"> 
</span><ins>+    void setProgressEpoch(qulonglong time) { _progressEpoch = time/1000000; }
+    qulonglong getProgressEpoch() { return _progressEpoch; }
+    void setProgressMediaEpoch(qulonglong time) { _progressMediaEpoch = time/1000000; }
+    qulonglong getProgressMediaEpoch() { return _progressMediaEpoch; }
+
</ins><span class="cx"> private:
</span><span class="cx">     QString _uuid;
</span><span class="cx">     QString _cidName;
</span><span class="cx">     QString _cidNumber;
</span><span class="cx">     QString _destinationNumber;
</span><del>-    int _pa_call_id;
</del><ins>+    int _paCallId;
+    qulonglong _progressEpoch;
+    qulonglong _progressMediaEpoch;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Q_DECLARE_METATYPE(Channel)
</span></span></pre></div>
<a id="freeswitchtrunkfscommfshostcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/fshost.cpp (17213 => 17214)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/fshost.cpp        2010-04-05 06:05:56 UTC (rev 17213)
+++ freeswitch/trunk/fscomm/fshost.cpp        2010-04-06 01:03:20 UTC (rev 17214)
</span><span class="lines">@@ -168,11 +168,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FSHost::generalEventHandler(switch_event_t *event)
</del><ins>+void FSHost::generalEventHandler(QSharedPointer&lt;switch_event_t&gt;event)
</ins><span class="cx"> {
</span><del>-    QString uuid = switch_event_get_header_nil(event, &quot;Unique-ID&quot;);
</del><ins>+    QString uuid = switch_event_get_header_nil(event.data(), &quot;Unique-ID&quot;);
</ins><span class="cx"> 
</span><del>-    switch(event-&gt;event_id) {
</del><ins>+    switch(event.data()-&gt;event_id) {
</ins><span class="cx">     case SWITCH_EVENT_CHANNEL_CREATE: /*1A - 17B*/
</span><span class="cx">         {
</span><span class="cx">             eventChannelCreate(event, uuid);
</span><span class="lines">@@ -218,6 +218,11 @@
</span><span class="cx">             eventCallUpdate(event, uuid);
</span><span class="cx">             break;
</span><span class="cx">         }
</span><ins>+    case SWITCH_EVENT_CHANNEL_PROGRESS:
+        {
+            eventChannelProgress(event, uuid);
+            break;
+        }
</ins><span class="cx">     case SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA:/*26B*/
</span><span class="cx">         {
</span><span class="cx">             eventChannelProgressMedia(event, uuid);
</span><span class="lines">@@ -256,63 +261,63 @@
</span><span class="cx">         }
</span><span class="cx">     case SWITCH_EVENT_CUSTOM:/*5A*/
</span><span class="cx">         {
</span><del>-            if (strcmp(event-&gt;subclass_name, &quot;sofia::gateway_state&quot;) == 0)
</del><ins>+            if (strcmp(event.data()-&gt;subclass_name, &quot;sofia::gateway_state&quot;) == 0)
</ins><span class="cx">             {
</span><del>-                QString state = switch_event_get_header_nil(event, &quot;State&quot;);
-                QString gw = switch_event_get_header_nil(event, &quot;Gateway&quot;);
</del><ins>+                QString state = switch_event_get_header_nil(event.data(), &quot;State&quot;);
+                QString gw = switch_event_get_header_nil(event.data(), &quot;Gateway&quot;);
</ins><span class="cx">                 QSharedPointer&lt;Account&gt; acc = _accounts.value(gw);
</span><span class="cx">                 if (acc.isNull())
</span><span class="cx">                     return;
</span><span class="cx"> 
</span><span class="cx">                 if (state == &quot;TRYING&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_TRYING);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state == &quot;REGISTER&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_REGISTER);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state == &quot;REGED&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_REGED);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state == &quot;UNREGED&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_UNREGED);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state == &quot;UNREGISTER&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_UNREGISTER);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state ==&quot;FAILED&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_FAILED);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state == &quot;FAIL_WAIT&quot;) {
</span><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_FAIL_WAIT);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state == &quot;EXPIRED&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_EXPIRED);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 } else if (state == &quot;NOREG&quot;) {
</span><del>-                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event, &quot;Phrase&quot;));
</del><ins>+                    acc.data()-&gt;setStatusPhrase(switch_event_get_header_nil(event.data(), &quot;Phrase&quot;));
</ins><span class="cx">                     acc.data()-&gt;setState(FSCOMM_GW_STATE_NOREG);
</span><span class="cx">                     emit accountStateChange(acc);
</span><span class="cx">                 }
</span><span class="cx">             }
</span><del>-            else if (strcmp(event-&gt;subclass_name, &quot;sofia::gateway_add&quot;) == 0)
</del><ins>+            else if (strcmp(event.data()-&gt;subclass_name, &quot;sofia::gateway_add&quot;) == 0)
</ins><span class="cx">             {
</span><del>-                QString gw = switch_event_get_header_nil(event, &quot;Gateway&quot;);
</del><ins>+                QString gw = switch_event_get_header_nil(event.data(), &quot;Gateway&quot;);
</ins><span class="cx">                 Account * accPtr = new Account(gw);
</span><span class="cx">                 QSharedPointer&lt;Account&gt; acc = QSharedPointer&lt;Account&gt;(accPtr);
</span><span class="cx">                 acc.data()-&gt;setState(FSCOMM_GW_STATE_NOAVAIL);
</span><span class="cx">                 _accounts.insert(gw, acc);
</span><span class="cx">                 emit newAccount(acc);
</span><span class="cx">             }
</span><del>-            else if (strcmp(event-&gt;subclass_name, &quot;sofia::gateway_delete&quot;) == 0)
</del><ins>+            else if (strcmp(event.data()-&gt;subclass_name, &quot;sofia::gateway_delete&quot;) == 0)
</ins><span class="cx">             {
</span><del>-                QSharedPointer&lt;Account&gt; acc = _accounts.take(switch_event_get_header_nil(event, &quot;Gateway&quot;));
</del><ins>+                QSharedPointer&lt;Account&gt; acc = _accounts.take(switch_event_get_header_nil(event.data(), &quot;Gateway&quot;));
</ins><span class="cx">                 if (!acc.isNull())
</span><span class="cx">                     emit delAccount(acc);
</span><span class="cx">             }
</span><span class="lines">@@ -324,8 +329,8 @@
</span><span class="cx">         }
</span><span class="cx">     case SWITCH_EVENT_MODULE_LOAD:
</span><span class="cx">         {
</span><del>-            QString modType = switch_event_get_header_nil(event, &quot;type&quot;);
-            QString modKey = switch_event_get_header_nil(event, &quot;key&quot;);
</del><ins>+            QString modType = switch_event_get_header_nil(event.data(), &quot;type&quot;);
+            QString modKey = switch_event_get_header_nil(event.data(), &quot;key&quot;);
</ins><span class="cx">             emit loadedModule(modType, modKey);
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="lines">@@ -334,38 +339,41 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FSHost::eventChannelCreate(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelCreate(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {
</span><span class="cx">     Channel *channelPtr = new Channel(uuid);
</span><span class="cx">     QSharedPointer&lt;Channel&gt;channel(channelPtr);
</span><span class="cx">     _channels.insert(uuid, channel);
</span><span class="cx"> }
</span><del>-void FSHost::eventChannelAnswer(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelAnswer(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {
</span><del>-    _channels.value(uuid).data()-&gt;setDestinatinonNumber(switch_event_get_header_nil(event, &quot;Caller-Destination-Number&quot;));
</del><ins>+    _channels.value(uuid).data()-&gt;setDestinatinonNumber(switch_event_get_header_nil(event.data(), &quot;Caller-Destination-Number&quot;));
</ins><span class="cx">     if (_active_calls.contains(uuid))
</span><span class="cx">     {
</span><del>-        _active_calls.value(uuid).data()-&gt;setAnsweredEpoch(QString(switch_event_get_header_nil(event, &quot;Caller-Channel-Answered-Time&quot;)).toULongLong());
</del><ins>+        _active_calls.value(uuid).data()-&gt;setAnsweredEpoch(QString(switch_event_get_header_nil(event.data(), &quot;Caller-Channel-Answered-Time&quot;)).toULongLong());
+        _active_calls.value(uuid).data()-&gt;setState(FSCOMM_CALL_STATE_ANSWERED);
</ins><span class="cx">         emit answered(_active_calls.value(uuid));
</span><span class="cx">     }
</span><span class="cx"> }
</span><del>-void FSHost::eventChannelState(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelState(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelExecute(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelExecute(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelExecuteComplete(switch_event_t *event, QString uuid)
-{}
-void FSHost::eventChannelOutgoing(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelExecuteComplete(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {
</span><ins>+    _channels.value(uuid).data()-&gt;setPaCallId(atoi(switch_event_get_header_nil(event.data(), &quot;variable_pa_call_id&quot;)));
+}
+void FSHost::eventChannelOutgoing(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
+{
</ins><span class="cx">     /* Checks if this is an inbound or outbound call */
</span><span class="cx">     /** Outbound call */
</span><del>-    if ( strcmp(switch_event_get_header_nil(event, &quot;Caller-Source&quot;), &quot;mod_portaudio&quot;) == 0 )
</del><ins>+    if ( strcmp(switch_event_get_header_nil(event.data(), &quot;Caller-Source&quot;), &quot;mod_portaudio&quot;) == 0 )
</ins><span class="cx">     {
</span><span class="cx">         Call *callPtr = new Call();
</span><span class="cx"> 
</span><span class="cx">         callPtr-&gt;setCallDirection(FSCOMM_CALL_DIRECTION_OUTBOUND);
</span><span class="cx">         callPtr-&gt;setChannel(_channels.value(uuid));
</span><del>-        callPtr-&gt;setOtherLegChannel(_channels.value(switch_event_get_header_nil(event, &quot;Other-Leg-Unique-ID&quot;)));
</del><ins>+        callPtr-&gt;setOtherLegChannel(_channels.value(switch_event_get_header_nil(event.data(), &quot;Other-Leg-Unique-ID&quot;)));
</ins><span class="cx">         QSharedPointer&lt;Call&gt; call(callPtr);
</span><span class="cx">         _active_calls.insert(uuid, call);
</span><span class="cx">         call.data()-&gt;setState(FSCOMM_CALL_STATE_TRYING);
</span><span class="lines">@@ -377,44 +385,58 @@
</span><span class="cx">         Call *callPtr = new Call();
</span><span class="cx"> 
</span><span class="cx">         callPtr-&gt;setCallDirection(FSCOMM_CALL_DIRECTION_INBOUND);
</span><del>-        callPtr-&gt;setChannel(_channels.value(switch_event_get_header_nil(event, &quot;Other-Leg-Unique-ID&quot;)));
</del><ins>+        callPtr-&gt;setChannel(_channels.value(switch_event_get_header_nil(event.data(), &quot;Other-Leg-Unique-ID&quot;)));
</ins><span class="cx">         callPtr-&gt;setOtherLegChannel(_channels.value(uuid));
</span><span class="cx">         QSharedPointer&lt;Call&gt; call(callPtr);
</span><del>-        _active_calls.insert(switch_event_get_header_nil(event, &quot;Other-Leg-Unique-ID&quot;), call);
</del><ins>+        _active_calls.insert(switch_event_get_header_nil(event.data(), &quot;Other-Leg-Unique-ID&quot;), call);
</ins><span class="cx">         call.data()-&gt;setState(FSCOMM_CALL_STATE_RINGING);
</span><span class="cx">         emit ringing(call);
</span><del>-        qDebug() &lt;&lt; _channels.value(uuid).data()-&gt;getCidName() &lt;&lt; _channels.value(uuid).data()-&gt;getCidNumber();
</del><span class="cx">     }
</span><span class="cx"> }
</span><del>-void FSHost::eventChannelOriginate(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelOriginate(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelProgressMedia(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelProgress(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelBridge(switch_event_t *event, QString uuid)
-{}
-void FSHost::eventChannelHangup(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelProgressMedia(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {
</span><ins>+    _channels.value(uuid).data()-&gt;setProgressEpoch(QString(switch_event_get_header_nil(event.data(), &quot;Caller-Channel-Progress-Time&quot;)).toULongLong());
</ins><span class="cx">     if (_active_calls.contains(uuid))
</span><span class="cx">     {
</span><ins>+        _active_calls.value(uuid).data()-&gt;setState(FSCOMM_CALL_STATE_RINGING);
+        emit ringing(_active_calls.value(uuid));
+    }
+}
+void FSHost::eventChannelBridge(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
+{
+    QString time;
+    time = switch_event_get_header_nil(event.data(), &quot;Caller-Channel-Progress-Time&quot;);
+    if (time.toULongLong() &gt; 0) _channels.value(uuid).data()-&gt;setProgressEpoch(time.toULongLong());
+    time = switch_event_get_header_nil(event.data(), &quot;Caller-Channel-Progress-Media-Time&quot;);
+    if (time.toULongLong() &gt; 0) _channels.value(uuid).data()-&gt;setProgressMediaEpoch(time.toULongLong());
+}
+void FSHost::eventChannelHangup(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
+{
+    if (_active_calls.contains(uuid))
+    {
</ins><span class="cx">         emit hungup(_active_calls.take(uuid));
</span><span class="cx">     }
</span><span class="cx"> }
</span><del>-void FSHost::eventChannelUnbridge(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelUnbridge(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelHangupComplete(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelHangupComplete(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelDestroy(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelDestroy(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {
</span><span class="cx">     _channels.take(uuid);
</span><span class="cx"> }
</span><del>-void FSHost::eventCodec(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventCodec(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {
</span><del>-    _channels.value(uuid).data()-&gt;setCidName(switch_event_get_header_nil(event, &quot;Caller-Caller-ID-Name&quot;));
-    _channels.value(uuid).data()-&gt;setCidNumber(switch_event_get_header_nil(event, &quot;Caller-Caller-ID-Number&quot;));
</del><ins>+    _channels.value(uuid).data()-&gt;setCidName(switch_event_get_header_nil(event.data(), &quot;Caller-Caller-ID-Name&quot;));
+    _channels.value(uuid).data()-&gt;setCidNumber(switch_event_get_header_nil(event.data(), &quot;Caller-Caller-ID-Number&quot;));
</ins><span class="cx"> }
</span><del>-void FSHost::eventCallUpdate(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventCallUpdate(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventRecvInfo(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventRecvInfo(QSharedPointer&lt;switch_event_t&gt;event, QString uuid)
</ins><span class="cx"> {}
</span><span class="cx"> 
</span><span class="cx"> void FSHost::minimalModuleLoaded(QString modType, QString modKey)
</span><span class="lines">@@ -489,11 +511,11 @@
</span><span class="cx">     return QSharedPointer&lt;Call&gt;();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FSHost::printEventHeaders(switch_event_t *event)
</del><ins>+void FSHost::printEventHeaders(QSharedPointer&lt;switch_event_t&gt;event)
</ins><span class="cx"> {
</span><span class="cx">     switch_event_header_t *hp;
</span><del>-    qDebug() &lt;&lt; QString(&quot;Received event: %1(%2)&quot;).arg(switch_event_name(event-&gt;event_id), switch_event_get_header_nil(event, &quot;Event-Subclass&quot;));
-    for (hp = event-&gt;headers; hp; hp = hp-&gt;next) {
</del><ins>+    qDebug() &lt;&lt; QString(&quot;Received event: %1(%2)&quot;).arg(switch_event_name(event.data()-&gt;event_id), switch_event_get_header_nil(event.data(), &quot;Event-Subclass&quot;));
+    for (hp = event.data()-&gt;headers; hp; hp = hp-&gt;next) {
</ins><span class="cx">         qDebug() &lt;&lt; hp-&gt;name &lt;&lt; &quot;=&quot; &lt;&lt; hp-&gt;value;
</span><span class="cx">     }
</span><span class="cx">     qDebug() &lt;&lt; &quot;\n\n&quot;;
</span></span></pre></div>
<a id="freeswitchtrunkfscommfshosth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/fshost.h (17213 => 17214)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/fshost.h        2010-04-05 06:05:56 UTC (rev 17213)
+++ freeswitch/trunk/fscomm/fshost.h        2010-04-06 01:03:20 UTC (rev 17214)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> public:
</span><span class="cx">     explicit FSHost(QObject *parent = 0);
</span><span class="cx">     switch_status_t sendCmd(const char *cmd, const char *args, QString *res);
</span><del>-    void generalEventHandler(switch_event_t *event);
</del><ins>+    void generalEventHandler(QSharedPointer&lt;switch_event_t&gt;event);
</ins><span class="cx">     QSharedPointer&lt;Call&gt; getCallByUUID(QString uuid) { return _active_calls.value(uuid); }
</span><span class="cx">     QSharedPointer&lt;Call&gt; getCurrentActiveCall();
</span><span class="cx">     QList&lt;QSharedPointer&lt;Account&gt; &gt; getAccounts() { return _accounts.values(); }
</span><span class="lines">@@ -84,28 +84,29 @@
</span><span class="cx"> private:
</span><span class="cx">     /* Helper methods */
</span><span class="cx">     void createFolders();
</span><del>-    void printEventHeaders(switch_event_t *event);
</del><ins>+    void printEventHeaders(QSharedPointer&lt;switch_event_t&gt;event);
</ins><span class="cx"> 
</span><span class="cx">     /*FSM State handlers*/
</span><span class="cx">     /** Channel Related*/
</span><del>-    void eventChannelCreate(switch_event_t *event, QString uuid);
-    void eventChannelAnswer(switch_event_t *event, QString uuid);
-    void eventChannelState(switch_event_t *event, QString uuid);
-    void eventChannelExecute(switch_event_t *event, QString uuid);
-    void eventChannelExecuteComplete(switch_event_t *event, QString uuid);
-    void eventChannelOutgoing(switch_event_t *event, QString uuid);
-    void eventChannelOriginate(switch_event_t *event, QString uuid);
-    void eventChannelProgressMedia(switch_event_t *event, QString uuid);
-    void eventChannelBridge(switch_event_t *event, QString uuid);
-    void eventChannelHangup(switch_event_t *event, QString uuid);
-    void eventChannelUnbridge(switch_event_t *event, QString uuid);
-    void eventChannelHangupComplete(switch_event_t *event, QString uuid);
-    void eventChannelDestroy(switch_event_t *event, QString uuid);
</del><ins>+    void eventChannelCreate(QSharedPointer&lt;switch_event_t&gt; event, QString uuid);
+    void eventChannelAnswer(QSharedPointer&lt;switch_event_t&gt; event, QString uuid);
+    void eventChannelState(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelExecute(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelExecuteComplete(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelOutgoing(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelOriginate(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelProgress(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelProgressMedia(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelBridge(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelHangup(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelUnbridge(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelHangupComplete(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventChannelDestroy(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
</ins><span class="cx"> 
</span><span class="cx">     /** Others*/
</span><del>-    void eventCodec(switch_event_t *event, QString uuid);
-    void eventCallUpdate(switch_event_t *event, QString uuid);
-    void eventRecvInfo(switch_event_t *event, QString uuid);
</del><ins>+    void eventCodec(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventCallUpdate(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
+    void eventRecvInfo(QSharedPointer&lt;switch_event_t&gt;event, QString uuid);
</ins><span class="cx"> 
</span><span class="cx">     /* Structures to keep track of things */
</span><span class="cx">     QHash&lt;QString, QSharedPointer&lt;Call&gt; &gt; _active_calls;
</span><span class="lines">@@ -125,9 +126,9 @@
</span><span class="cx"> {
</span><span class="cx">     switch_event_t *clone = NULL;
</span><span class="cx">     if (switch_event_dup(&amp;clone, event) == SWITCH_STATUS_SUCCESS) {
</span><del>-        g_FSHost.generalEventHandler(clone);
</del><ins>+        QSharedPointer&lt;switch_event_t&gt; e(clone);
+        g_FSHost.generalEventHandler(e);
</ins><span class="cx">     }
</span><del>-    switch_safe_free(clone);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // FSHOST_H
</span></span></pre></div>
<a id="freeswitchtrunkfscommmainwindowcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/mainwindow.cpp (17213 => 17214)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/mainwindow.cpp        2010-04-05 06:05:56 UTC (rev 17213)
+++ freeswitch/trunk/fscomm/mainwindow.cpp        2010-04-06 01:03:20 UTC (rev 17214)
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx">         QSharedPointer&lt;Call&gt; call = g_FSHost.getCallByUUID(item-&gt;data(Qt::UserRole).toString());
</span><span class="cx">         QTime time = call.data()-&gt;getCurrentStateTime();
</span><span class="cx">         item-&gt;setText(time.toString(&quot;hh:mm:ss&quot;));
</span><del>-        item-&gt;setTextAlignment(Qt::AlignRight);
</del><ins>+        item-&gt;setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -267,7 +267,6 @@
</span><span class="cx">         switch_core_set_variable(&quot;fscomm_caller_id_name&quot;, cidName.toAscii().data());
</span><span class="cx">         switch_core_set_variable(&quot;fscomm_caller_id_num&quot;, cidNum.toAscii().data());
</span><span class="cx"> 
</span><del>-        qDebug() &lt;&lt; &quot;Name:&quot; &lt;&lt; cidName &lt;&lt; &quot;Num:&quot; &lt;&lt; cidNum;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (ok &amp;&amp; !dialstring.isEmpty())
</span><span class="lines">@@ -396,12 +395,18 @@
</span><span class="cx">         if (item-&gt;data(Qt::UserRole).toString() == call.data()-&gt;getUuid())
</span><span class="cx">         {
</span><span class="cx">             item-&gt;setText(tr(&quot;Ringing&quot;));
</span><del>-            ui-&gt;textEdit-&gt;setText(QString(&quot;Call from %1 (%2)&quot;).arg(call.data()-&gt;getCidName(), call.data()-&gt;getCidNumber()));
</del><ins>+            if (call.data()-&gt;getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+                ui-&gt;textEdit-&gt;setText(QString(&quot;Call from %1 (%2)&quot;).arg(call.data()-&gt;getCidName(), call.data()-&gt;getCidNumber()));
+            else
+                ui-&gt;textEdit-&gt;setText(QString(&quot;Call to %1 is ringing.&quot;).arg(call.data()-&gt;getDestinationNumber()));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ui-&gt;textEdit-&gt;setText(QString(&quot;Call from %1 (%2)&quot;).arg(call.data()-&gt;getCidName(), call.data()-&gt;getCidNumber()));
</del><ins>+    if (call.data()-&gt;getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+        ui-&gt;textEdit-&gt;setText(QString(&quot;Call from %1 (%2)&quot;).arg(call.data()-&gt;getCidName(), call.data()-&gt;getCidNumber()));
+    else
+        ui-&gt;textEdit-&gt;setText(QString(&quot;Call to %1 is ringing.&quot;).arg(call.data()-&gt;getDestinationNumber()));
</ins><span class="cx"> 
</span><span class="cx">     ui-&gt;tableCalls-&gt;setRowCount(ui-&gt;tableCalls-&gt;rowCount()+1);
</span><span class="cx">     QTableWidgetItem *item0 = new QTableWidgetItem(QString(&quot;%1 (%2)&quot;).arg(call.data()-&gt;getCidName(), call.data()-&gt;getCidNumber()));
</span><span class="lines">@@ -521,7 +526,7 @@
</span><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><del>-        ui-&gt;textEdit-&gt;setText(tr(&quot;Call with %1 hungup.&quot;).arg(call.data()-&gt;getCidNumber()));
</del><ins>+        ui-&gt;textEdit-&gt;setText(tr(&quot;Call with %1 hungup.&quot;).arg(call.data()-&gt;getDestinationNumber()));
</ins><span class="cx">     }
</span><span class="cx">     /* TODO: Will cause problems if 2 calls are received at the same time */
</span><span class="cx">     ui-&gt;recoredCallBtn-&gt;setEnabled(false);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>