<!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 <fshost.h>
</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()->getProgressEpoch() == 0 ? time = _channel.data()->getProgressMediaEpoch() : time = _channel.data()->getProgressEpoch();
+ }
+ else
+ _otherLegChannel.data()->getProgressEpoch() == 0 ? time = _otherLegChannel.data()->getProgressMediaEpoch() : time = _otherLegChannel.data()->getProgressEpoch();
+ }
+
+ int now = QDateTime::fromTime_t(time).secsTo(QDateTime::currentDateTime());
</ins><span class="cx"> return QTime::fromString(QString::number(now), "s");
</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<switch_event_t>event)
</ins><span class="cx"> {
</span><del>- QString uuid = switch_event_get_header_nil(event, "Unique-ID");
</del><ins>+ QString uuid = switch_event_get_header_nil(event.data(), "Unique-ID");
</ins><span class="cx">
</span><del>- switch(event->event_id) {
</del><ins>+ switch(event.data()->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->subclass_name, "sofia::gateway_state") == 0)
</del><ins>+ if (strcmp(event.data()->subclass_name, "sofia::gateway_state") == 0)
</ins><span class="cx"> {
</span><del>- QString state = switch_event_get_header_nil(event, "State");
- QString gw = switch_event_get_header_nil(event, "Gateway");
</del><ins>+ QString state = switch_event_get_header_nil(event.data(), "State");
+ QString gw = switch_event_get_header_nil(event.data(), "Gateway");
</ins><span class="cx"> QSharedPointer<Account> 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 == "TRYING") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_TRYING);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state == "REGISTER") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_REGISTER);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state == "REGED") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_REGED);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state == "UNREGED") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_UNREGED);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state == "UNREGISTER") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_UNREGISTER);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state =="FAILED") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_FAILED);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state == "FAIL_WAIT") {
</span><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_FAIL_WAIT);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state == "EXPIRED") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->setState(FSCOMM_GW_STATE_EXPIRED);
</span><span class="cx"> emit accountStateChange(acc);
</span><span class="cx"> } else if (state == "NOREG") {
</span><del>- acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
</del><ins>+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event.data(), "Phrase"));
</ins><span class="cx"> acc.data()->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->subclass_name, "sofia::gateway_add") == 0)
</del><ins>+ else if (strcmp(event.data()->subclass_name, "sofia::gateway_add") == 0)
</ins><span class="cx"> {
</span><del>- QString gw = switch_event_get_header_nil(event, "Gateway");
</del><ins>+ QString gw = switch_event_get_header_nil(event.data(), "Gateway");
</ins><span class="cx"> Account * accPtr = new Account(gw);
</span><span class="cx"> QSharedPointer<Account> acc = QSharedPointer<Account>(accPtr);
</span><span class="cx"> acc.data()->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->subclass_name, "sofia::gateway_delete") == 0)
</del><ins>+ else if (strcmp(event.data()->subclass_name, "sofia::gateway_delete") == 0)
</ins><span class="cx"> {
</span><del>- QSharedPointer<Account> acc = _accounts.take(switch_event_get_header_nil(event, "Gateway"));
</del><ins>+ QSharedPointer<Account> acc = _accounts.take(switch_event_get_header_nil(event.data(), "Gateway"));
</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, "type");
- QString modKey = switch_event_get_header_nil(event, "key");
</del><ins>+ QString modType = switch_event_get_header_nil(event.data(), "type");
+ QString modKey = switch_event_get_header_nil(event.data(), "key");
</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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {
</span><span class="cx"> Channel *channelPtr = new Channel(uuid);
</span><span class="cx"> QSharedPointer<Channel>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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {
</span><del>- _channels.value(uuid).data()->setDestinatinonNumber(switch_event_get_header_nil(event, "Caller-Destination-Number"));
</del><ins>+ _channels.value(uuid).data()->setDestinatinonNumber(switch_event_get_header_nil(event.data(), "Caller-Destination-Number"));
</ins><span class="cx"> if (_active_calls.contains(uuid))
</span><span class="cx"> {
</span><del>- _active_calls.value(uuid).data()->setAnsweredEpoch(QString(switch_event_get_header_nil(event, "Caller-Channel-Answered-Time")).toULongLong());
</del><ins>+ _active_calls.value(uuid).data()->setAnsweredEpoch(QString(switch_event_get_header_nil(event.data(), "Caller-Channel-Answered-Time")).toULongLong());
+ _active_calls.value(uuid).data()->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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelExecute(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelExecute(QSharedPointer<switch_event_t>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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {
</span><ins>+ _channels.value(uuid).data()->setPaCallId(atoi(switch_event_get_header_nil(event.data(), "variable_pa_call_id")));
+}
+void FSHost::eventChannelOutgoing(QSharedPointer<switch_event_t>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, "Caller-Source"), "mod_portaudio") == 0 )
</del><ins>+ if ( strcmp(switch_event_get_header_nil(event.data(), "Caller-Source"), "mod_portaudio") == 0 )
</ins><span class="cx"> {
</span><span class="cx"> Call *callPtr = new Call();
</span><span class="cx">
</span><span class="cx"> callPtr->setCallDirection(FSCOMM_CALL_DIRECTION_OUTBOUND);
</span><span class="cx"> callPtr->setChannel(_channels.value(uuid));
</span><del>- callPtr->setOtherLegChannel(_channels.value(switch_event_get_header_nil(event, "Other-Leg-Unique-ID")));
</del><ins>+ callPtr->setOtherLegChannel(_channels.value(switch_event_get_header_nil(event.data(), "Other-Leg-Unique-ID")));
</ins><span class="cx"> QSharedPointer<Call> call(callPtr);
</span><span class="cx"> _active_calls.insert(uuid, call);
</span><span class="cx"> call.data()->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->setCallDirection(FSCOMM_CALL_DIRECTION_INBOUND);
</span><del>- callPtr->setChannel(_channels.value(switch_event_get_header_nil(event, "Other-Leg-Unique-ID")));
</del><ins>+ callPtr->setChannel(_channels.value(switch_event_get_header_nil(event.data(), "Other-Leg-Unique-ID")));
</ins><span class="cx"> callPtr->setOtherLegChannel(_channels.value(uuid));
</span><span class="cx"> QSharedPointer<Call> call(callPtr);
</span><del>- _active_calls.insert(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"), call);
</del><ins>+ _active_calls.insert(switch_event_get_header_nil(event.data(), "Other-Leg-Unique-ID"), call);
</ins><span class="cx"> call.data()->setState(FSCOMM_CALL_STATE_RINGING);
</span><span class="cx"> emit ringing(call);
</span><del>- qDebug() << _channels.value(uuid).data()->getCidName() << _channels.value(uuid).data()->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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelProgressMedia(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelProgress(QSharedPointer<switch_event_t>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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {
</span><ins>+ _channels.value(uuid).data()->setProgressEpoch(QString(switch_event_get_header_nil(event.data(), "Caller-Channel-Progress-Time")).toULongLong());
</ins><span class="cx"> if (_active_calls.contains(uuid))
</span><span class="cx"> {
</span><ins>+ _active_calls.value(uuid).data()->setState(FSCOMM_CALL_STATE_RINGING);
+ emit ringing(_active_calls.value(uuid));
+ }
+}
+void FSHost::eventChannelBridge(QSharedPointer<switch_event_t>event, QString uuid)
+{
+ QString time;
+ time = switch_event_get_header_nil(event.data(), "Caller-Channel-Progress-Time");
+ if (time.toULongLong() > 0) _channels.value(uuid).data()->setProgressEpoch(time.toULongLong());
+ time = switch_event_get_header_nil(event.data(), "Caller-Channel-Progress-Media-Time");
+ if (time.toULongLong() > 0) _channels.value(uuid).data()->setProgressMediaEpoch(time.toULongLong());
+}
+void FSHost::eventChannelHangup(QSharedPointer<switch_event_t>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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelHangupComplete(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelHangupComplete(QSharedPointer<switch_event_t>event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventChannelDestroy(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventChannelDestroy(QSharedPointer<switch_event_t>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<switch_event_t>event, QString uuid)
</ins><span class="cx"> {
</span><del>- _channels.value(uuid).data()->setCidName(switch_event_get_header_nil(event, "Caller-Caller-ID-Name"));
- _channels.value(uuid).data()->setCidNumber(switch_event_get_header_nil(event, "Caller-Caller-ID-Number"));
</del><ins>+ _channels.value(uuid).data()->setCidName(switch_event_get_header_nil(event.data(), "Caller-Caller-ID-Name"));
+ _channels.value(uuid).data()->setCidNumber(switch_event_get_header_nil(event.data(), "Caller-Caller-ID-Number"));
</ins><span class="cx"> }
</span><del>-void FSHost::eventCallUpdate(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventCallUpdate(QSharedPointer<switch_event_t>event, QString uuid)
</ins><span class="cx"> {}
</span><del>-void FSHost::eventRecvInfo(switch_event_t *event, QString uuid)
</del><ins>+void FSHost::eventRecvInfo(QSharedPointer<switch_event_t>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<Call>();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void FSHost::printEventHeaders(switch_event_t *event)
</del><ins>+void FSHost::printEventHeaders(QSharedPointer<switch_event_t>event)
</ins><span class="cx"> {
</span><span class="cx"> switch_event_header_t *hp;
</span><del>- qDebug() << QString("Received event: %1(%2)").arg(switch_event_name(event->event_id), switch_event_get_header_nil(event, "Event-Subclass"));
- for (hp = event->headers; hp; hp = hp->next) {
</del><ins>+ qDebug() << QString("Received event: %1(%2)").arg(switch_event_name(event.data()->event_id), switch_event_get_header_nil(event.data(), "Event-Subclass"));
+ for (hp = event.data()->headers; hp; hp = hp->next) {
</ins><span class="cx"> qDebug() << hp->name << "=" << hp->value;
</span><span class="cx"> }
</span><span class="cx"> qDebug() << "\n\n";
</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<switch_event_t>event);
</ins><span class="cx"> QSharedPointer<Call> getCallByUUID(QString uuid) { return _active_calls.value(uuid); }
</span><span class="cx"> QSharedPointer<Call> getCurrentActiveCall();
</span><span class="cx"> QList<QSharedPointer<Account> > 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<switch_event_t>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<switch_event_t> event, QString uuid);
+ void eventChannelAnswer(QSharedPointer<switch_event_t> event, QString uuid);
+ void eventChannelState(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelExecute(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelExecuteComplete(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelOutgoing(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelOriginate(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelProgress(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelProgressMedia(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelBridge(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelHangup(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelUnbridge(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelHangupComplete(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventChannelDestroy(QSharedPointer<switch_event_t>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<switch_event_t>event, QString uuid);
+ void eventCallUpdate(QSharedPointer<switch_event_t>event, QString uuid);
+ void eventRecvInfo(QSharedPointer<switch_event_t>event, QString uuid);
</ins><span class="cx">
</span><span class="cx"> /* Structures to keep track of things */
</span><span class="cx"> QHash<QString, QSharedPointer<Call> > _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(&clone, event) == SWITCH_STATUS_SUCCESS) {
</span><del>- g_FSHost.generalEventHandler(clone);
</del><ins>+ QSharedPointer<switch_event_t> 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<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
</span><span class="cx"> QTime time = call.data()->getCurrentStateTime();
</span><span class="cx"> item->setText(time.toString("hh:mm:ss"));
</span><del>- item->setTextAlignment(Qt::AlignRight);
</del><ins>+ item->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("fscomm_caller_id_name", cidName.toAscii().data());
</span><span class="cx"> switch_core_set_variable("fscomm_caller_id_num", cidNum.toAscii().data());
</span><span class="cx">
</span><del>- qDebug() << "Name:" << cidName << "Num:" << cidNum;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (ok && !dialstring.isEmpty())
</span><span class="lines">@@ -396,12 +395,18 @@
</span><span class="cx"> if (item->data(Qt::UserRole).toString() == call.data()->getUuid())
</span><span class="cx"> {
</span><span class="cx"> item->setText(tr("Ringing"));
</span><del>- ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
</del><ins>+ if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+ ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+ else
+ ui->textEdit->setText(QString("Call to %1 is ringing.").arg(call.data()->getDestinationNumber()));
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
</del><ins>+ if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+ ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+ else
+ ui->textEdit->setText(QString("Call to %1 is ringing.").arg(call.data()->getDestinationNumber()));
</ins><span class="cx">
</span><span class="cx"> ui->tableCalls->setRowCount(ui->tableCalls->rowCount()+1);
</span><span class="cx"> QTableWidgetItem *item0 = new QTableWidgetItem(QString("%1 (%2)").arg(call.data()->getCidName(), call.data()->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->textEdit->setText(tr("Call with %1 hungup.").arg(call.data()->getCidNumber()));
</del><ins>+ ui->textEdit->setText(tr("Call with %1 hungup.").arg(call.data()->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->recoredCallBtn->setEnabled(false);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>