<!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][14542] </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=14542">14542</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-08-16 23:22:03 -0500 (Sun, 16 Aug 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Major esl cleanup and initial channel state machine. New realtime statistics (still buggy) on console plugin.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcfsguiappmanagercpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectioncpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectionh">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfacesinterfacespro">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsoleplugincentralWidgetui">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoleplugincpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginh">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginpro">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgeth">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetui">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfacesesleventcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfacesesleventh">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfacesmonitorstatemachinecpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfacesmonitorstatemachineh">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogh">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogui">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.ui</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribjmesquitafsguisrcfsguiappmanagercpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -210,7 +210,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!reallyClose)
</span><span class="cx">     {
</span><del>-        reallyClose = new QMessageBox();
</del><ins>+        reallyClose = new QMessageBox(settingsDialog);
</ins><span class="cx">         reallyClose-&gt;setText(&quot;Do you really want to close FsGui?&quot;);
</span><span class="cx">         reallyClose-&gt;setStandardButtons(QMessageBox::Yes | QMessageBox::No);
</span><span class="cx">         reallyClose-&gt;setDefaultButton(QMessageBox::Yes);
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectioncpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -49,13 +49,24 @@
</span><span class="cx"> 
</span><span class="cx"> ESLconnection::ESLconnection(const char *host, const char *port, const char *password, const char *name)
</span><span class="cx">         : handle(NULL),_host(new QString(host)), _port(new QString(port)),
</span><del>-        _pass(new QString(password)), _name(new QString(name)){}
</del><ins>+        _pass(new QString(password)), _name(new QString(name))
+{
+    qRegisterMetaType&lt;ESLevent&gt;(&quot;ESLevent&quot;);
+}
+
</ins><span class="cx"> ESLconnection::~ESLconnection()
</span><span class="cx"> {
</span><span class="cx">     if (isConnected()) {
</span><ins>+
+        {
+            QMutexLocker locker(&amp;_commandQueueMutex);
+            while(!_commandQueue.isEmpty())
+                _commandQueue.dequeue();
+        }
+
</ins><span class="cx">         esl_disconnect(handle);
</span><span class="cx">     }
</span><del>-
</del><ins>+    wait();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> QString ESLconnection::getName()
</span><span class="lines">@@ -107,12 +118,13 @@
</span><span class="cx">     if (esl_send_recv(handle, cmd) == ESL_SUCCESS) {
</span><span class="cx">         esl_event_t *event;
</span><span class="cx">         esl_event_dup(&amp;event, handle-&gt;last_sr_event);
</span><del>-        return new ESLevent(event, 1);
</del><ins>+        return new ESLevent(event);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return NULL;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/*
</ins><span class="cx"> void ESLconnection::api(QString cmd)
</span><span class="cx"> {
</span><span class="cx">     if (cmd.isEmpty()) {
</span><span class="lines">@@ -125,18 +137,20 @@
</span><span class="cx">         emit gotEvent(new ESLevent(event, 1));
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+*/
</ins><span class="cx"> 
</span><del>-void ESLconnection::bgapi(QString cmd)
</del><ins>+ESLevent * ESLconnection::bgapi(QString cmd)
</ins><span class="cx"> {
</span><span class="cx">     if (cmd.isEmpty()) {
</span><del>-        return;
</del><ins>+        return NULL;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (esl_send_recv(handle, QString(&quot;bgapi %1&quot;).arg(cmd).toAscii()) == ESL_SUCCESS) {
</span><span class="cx">         esl_event_t *event;
</span><span class="cx">         esl_event_dup(&amp;event, handle-&gt;last_sr_event);
</span><del>-        emit gotEvent(new ESLevent(event, 1));
</del><ins>+        return new ESLevent(event);;
</ins><span class="cx">     }
</span><ins>+    return NULL;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ESLevent *ESLconnection::getInfo()
</span><span class="lines">@@ -144,7 +158,7 @@
</span><span class="cx">     if (handle-&gt;connected &amp;&amp; handle-&gt;info_event) {
</span><span class="cx">         esl_event_t *event;
</span><span class="cx">         esl_event_dup(&amp;event, handle-&gt;info_event);
</span><del>-        return new ESLevent(event, 1);
</del><ins>+        return new ESLevent(event);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return NULL;
</span><span class="lines">@@ -184,46 +198,38 @@
</span><span class="cx">     return r;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/*
</ins><span class="cx"> int ESLconnection::sendEvent(ESLevent *send_me)
</span><span class="cx"> {
</span><span class="cx">     return esl_sendevent(handle, send_me-&gt;event);
</span><span class="cx"> }
</span><ins>+*/
</ins><span class="cx"> 
</span><span class="cx"> ESLevent *ESLconnection::recvEvent()
</span><span class="cx"> {
</span><del>-    if (last_event_obj) {
-        delete last_event_obj;
-    }
</del><span class="cx"> 
</span><span class="cx">     if (esl_recv_event(handle, 1, NULL) == ESL_SUCCESS) {
</span><span class="cx">         esl_event_t *e = handle-&gt;last_ievent ? handle-&gt;last_ievent : handle-&gt;last_event;
</span><span class="cx">         if (e) {
</span><span class="cx">             esl_event_t *event;
</span><span class="cx">             esl_event_dup(&amp;event, e);
</span><del>-            last_event_obj = new ESLevent(event, 1);
-            return last_event_obj;
</del><ins>+            return new ESLevent(event);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    last_event_obj = new ESLevent(&quot;server_disconnected&quot;);
</del><ins>+    //last_event_obj = new ESLevent(&quot;server_disconnected&quot;);
</ins><span class="cx"> 
</span><del>-    return last_event_obj;
</del><ins>+    return NULL;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ESLevent *ESLconnection::recvEventTimed(int ms)
</span><span class="cx"> {
</span><del>-    if (last_event_obj) {
-        delete last_event_obj;
-        last_event_obj = NULL;
-    }
-
</del><span class="cx">     if (esl_recv_event_timed(handle, ms, 1, NULL) == ESL_SUCCESS) {
</span><span class="cx">         esl_event_t *e = handle-&gt;last_ievent ? handle-&gt;last_ievent : handle-&gt;last_event;
</span><span class="cx">         if (e) {
</span><span class="cx">             esl_event_t *event;
</span><span class="cx">             esl_event_dup(&amp;event, e);
</span><del>-            last_event_obj = new ESLevent(event, 1);
-            return last_event_obj;
</del><ins>+            return new ESLevent(event);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -237,7 +243,7 @@
</span><span class="cx">     if (status == ESL_SUCCESS &amp;&amp; handle-&gt;last_sr_event) {
</span><span class="cx">         esl_event_t *event;
</span><span class="cx">         esl_event_dup(&amp;event, handle-&gt;last_sr_event);
</span><del>-        return new ESLevent(event, 1);
</del><ins>+        return new ESLevent(event);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return NULL;
</span><span class="lines">@@ -255,26 +261,49 @@
</span><span class="cx">     return esl_events(handle, type_id, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ESLconnection::addCommand(CommandTransaction *commandT)
+{
+    QMutexLocker locker(&amp;_commandQueueMutex);
+    _commandQueue.enqueue(commandT);
+}
+
</ins><span class="cx"> void ESLconnection::run(void)
</span><span class="cx"> {
</span><span class="cx"> 
</span><span class="cx">     handle = new esl_handle_t;
</span><span class="cx">     memset(handle, 0, sizeof(esl_handle_t));
</span><del>-    last_event_obj = NULL;
</del><ins>+
+    CommandTransaction *commandTransaction = 0;
+    ESLevent * event = NULL;
+
</ins><span class="cx">     if (esl_connect(handle, _host-&gt;toAscii(), _port-&gt;toInt(), _pass-&gt;toAscii()) == ESL_SUCCESS)
</span><span class="cx">     {
</span><del>-        send(&quot;event plain ALL&quot;);
</del><ins>+        events(&quot;plain&quot;, &quot;all&quot;);
</ins><span class="cx">         send(&quot;log 7&quot;);
</span><span class="cx">         emit connected();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     while(isConnected())
</span><span class="cx">     {
</span><del>-        ESLevent * event = recvEventTimed(10);
</del><ins>+        // Process 1 received event
+        event = recvEventTimed(10);
</ins><span class="cx">         if (event)
</span><span class="cx">         {
</span><del>-            ESLevent * e = new ESLevent(event);
-            emit gotEvent(e);
</del><ins>+            processReceivedEvent(event);
</ins><span class="cx">         }
</span><ins>+
+        // Process all pending commands
+        {
+            QMutexLocker locker(&amp;_commandQueueMutex);
+            while (!_commandQueue.isEmpty())
+            {
+                commandTransaction = _commandQueue.dequeue();
+                event = bgapi(commandTransaction-&gt;getCommand());
+                qDebug() &lt;&lt; &quot;Sent a command and got this response : &quot; &lt;&lt; event;
+                if (event)
+                    _commandHash.insert(event-&gt;_headers.value(&quot;Job-UUID&quot;), commandTransaction);
+            }
+        }
</ins><span class="cx">     }
</span><span class="cx">     if (!QString(handle-&gt;err).isEmpty())
</span><span class="cx">     {
</span><span class="lines">@@ -286,193 +315,37 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// ESLevent
-///////////////////////////////////////////////////////////////////////
-
-ESLevent::ESLevent(const char *type, const char *subclass_name)
</del><ins>+void ESLconnection::processReceivedEvent(ESLevent *event)
</ins><span class="cx"> {
</span><del>-    esl_event_types_t event_id;
-
-    event_construct_common();
-
-    if (esl_name_event(type, &amp;event_id) != ESL_SUCCESS) {
-        event_id = ESL_EVENT_MESSAGE;
</del><ins>+    CommandTransaction *commandTransaction = 0;
+    /* Process all log messages */
+    if (QString(event-&gt;_headers.value(&quot;Content-Type&quot;)) == QString(&quot;log/data&quot;))
+    {
+        emit receivedLogMessage(*event);
</ins><span class="cx">     }
</span><del>-
-    if (!esl_strlen_zero(subclass_name) &amp;&amp; event_id != ESL_EVENT_CUSTOM) {
-        esl_log(ESL_LOG_WARNING, &quot;Changing event type to custom because you specified a subclass name!\n&quot;);
-        event_id = ESL_EVENT_CUSTOM;
</del><ins>+    /* Process command responses */
+    if (event-&gt;_headers.value(&quot;Job-UUID&quot;) != NULL)
+    {
+        if(_commandHash.contains(event-&gt;_headers.value(&quot;Job-UUID&quot;)))
+        {
+            commandTransaction = _commandHash.value(event-&gt;_headers.value(&quot;Job-UUID&quot;));
+            commandTransaction-&gt;setResponse(*event);
+        }
+        else
+        {
+            qDebug() &lt;&lt; &quot;Something went wrong... We should log this...&quot;;
+        }
</ins><span class="cx">     }
</span><del>-
-    if (esl_event_create_subclass(&amp;event, event_id, subclass_name) != ESL_SUCCESS) {
-        esl_log(ESL_LOG_ERROR, &quot;Failed to create event!\n&quot;);
-        event = NULL;
-    }
-
-    serialized_string = NULL;
-    mine = 1;
</del><ins>+    /* Process all other events*/
+    emit receivedChannelEvent(*event);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ESLevent::ESLevent(esl_event_t *wrap_me, int free_me)
</del><ins>+CommandTransaction::CommandTransaction(QString command)
</ins><span class="cx"> {
</span><del>-    event_construct_common();
-    event = wrap_me;
-    mine = free_me;
-    serialized_string = NULL;
</del><ins>+    _command = command;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-ESLevent::ESLevent(ESLevent *me)
</del><ins>+void CommandTransaction::setResponse(ESLevent e)
</ins><span class="cx"> {
</span><del>-    /* workaround for silly php thing */
-    event = me-&gt;event;
-    mine = me-&gt;mine;
-    serialized_string = NULL;
-    me-&gt;event = NULL;
-    me-&gt;mine = 0;
-    esl_safe_free(me-&gt;serialized_string);
</del><ins>+    emit gotResponse(e);
</ins><span class="cx"> }
</span><del>-
-ESLevent::~ESLevent()
-{
-
-    if (serialized_string) {
-        free(serialized_string);
-    }
-
-    if (event &amp;&amp; mine) {
-        esl_event_destroy(&amp;event);
-    }
-}
-
-const char *ESLevent::nextHeader(void)
-{
-    const char *name = NULL;
-
-    if (hp) {
-        name = hp-&gt;name;
-        hp = hp-&gt;next;
-    }
-
-    return name;
-}
-
-const char *ESLevent::firstHeader(void)
-{
-    if (event) {
-        hp = event-&gt;headers;
-    }
-
-    return nextHeader();
-}
-
-const char *ESLevent::serialize()
-{
-    this_check(&quot;&quot;);
-
-    esl_safe_free(serialized_string);
-
-    if (!event) {
-        return &quot;&quot;;
-    }
-
-    if (esl_event_serialize(event, &amp;serialized_string, ESL_TRUE) == ESL_SUCCESS) {
-        return serialized_string;
-    }
-
-    return &quot;&quot;;
-
-}
-
-bool ESLevent::setPriority(esl_priority_t priority)
-{
-    this_check(false);
-
-    if (event) {
-        esl_event_set_priority(event, priority);
-        return true;
-    } else {
-        esl_log(ESL_LOG_ERROR, &quot;Trying to setPriority an event that does not exist!\n&quot;);
-    }
-    return false;
-}
-
-const char *ESLevent::getHeader(const char *header_name)
-{
-    this_check(&quot;&quot;);
-
-    if (event) {
-        return esl_event_get_header(event, header_name);
-    } else {
-        esl_log(ESL_LOG_ERROR, &quot;Trying to getHeader an event that does not exist!\n&quot;);
-    }
-    return NULL;
-}
-
-bool ESLevent::addHeader(const char *header_name, const char *value)
-{
-    this_check(false);
-
-    if (event) {
-        return esl_event_add_header_string(event, ESL_STACK_BOTTOM, header_name, value) == ESL_SUCCESS ? true : false;
-    } else {
-        esl_log(ESL_LOG_ERROR, &quot;Trying to addHeader an event that does not exist!\n&quot;);
-    }
-
-    return false;
-}
-
-bool ESLevent::delHeader(const char *header_name)
-{
-    this_check(false);
-
-    if (event) {
-        return esl_event_del_header(event, header_name) == ESL_SUCCESS ? true : false;
-    } else {
-        esl_log(ESL_LOG_ERROR, &quot;Trying to delHeader an event that does not exist!\n&quot;);
-    }
-
-    return false;
-}
-
-
-bool ESLevent::addBody(const char *value)
-{
-    this_check(false);
-
-    if (event) {
-        return esl_event_add_body(event, &quot;%s&quot;, value) == ESL_SUCCESS ? true : false;
-    } else {
-        esl_log(ESL_LOG_ERROR, &quot;Trying to addBody an event that does not exist!\n&quot;);
-    }
-
-    return false;
-}
-
-char *ESLevent::getBody(void)
-{
-
-    this_check((char *)&quot;&quot;);
-
-    if (event) {
-        return esl_event_get_body(event);
-    } else {
-        esl_log(ESL_LOG_ERROR, &quot;Trying to getBody an event that does not exist!\n&quot;);
-    }
-
-    return NULL;
-}
-
-const char *ESLevent::getType(void)
-{
-    this_check(&quot;&quot;);
-
-    if (event) {
-        return esl_event_name(event-&gt;event_id);
-    } else {
-        esl_log(ESL_LOG_ERROR, &quot;Trying to getType an event that does not exist!\n&quot;);
-    }
-
-    return (char *) &quot;invalid&quot;;
-}
-
</del></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectionh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -41,33 +41,20 @@
</span><span class="cx"> #include &lt;QThread&gt;
</span><span class="cx"> #include &lt;QtGui&gt;
</span><span class="cx"> #include &lt;esl.h&gt;
</span><ins>+#include &quot;eslevent.h&quot;
</ins><span class="cx"> 
</span><del>-#define this_check(x) do { if (!this) { esl_log(ESL_LOG_ERROR, &quot;object is not initalized\n&quot;); return x;}} while(0)
-#define this_check_void() do { if (!this) { esl_log(ESL_LOG_ERROR, &quot;object is not initalized\n&quot;); return;}} while(0)
-
-
-class ESLevent {
- private:
-        esl_event_header_t *hp;
- public:
-        esl_event_t *event;
-        char *serialized_string;
-        int mine;
-
-        ESLevent(const char *type, const char *subclass_name = NULL);
-        ESLevent(esl_event_t *wrap_me, int free_me = 0);
-        ESLevent(ESLevent *me);
-        virtual ~ESLevent();
-        const char *serialize();
-        bool setPriority(esl_priority_t priority = ESL_PRIORITY_NORMAL);
-        const char *getHeader(const char *header_name);
-        char *getBody(void);
-        const char *getType(void);
-        bool addBody(const char *value);
-        bool addHeader(const char *header_name, const char *value);
-        bool delHeader(const char *header_name);
-        const char *firstHeader(void);
-        const char *nextHeader(void);
</del><ins>+class CommandTransaction : public QObject
+{
+    Q_OBJECT
+public:
+    CommandTransaction(QString command);
+    QString getCommand() { return _command; }
+    void setCommand(QString command) { _command = command; }
+    void setResponse(ESLevent e);
+signals:
+    void gotResponse(ESLevent);
+private:
+    QString _command;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class ESLconnection : public QThread
</span><span class="lines">@@ -75,38 +62,44 @@
</span><span class="cx">     Q_OBJECT
</span><span class="cx">  private:
</span><span class="cx">     esl_handle_t *handle;
</span><del>-    ESLevent *last_event_obj;
</del><span class="cx">     QString *_host;
</span><span class="cx">     QString *_port;
</span><span class="cx">     QString *_pass;
</span><span class="cx">     QString *_name;
</span><ins>+    QQueue&lt;CommandTransaction *&gt; _commandQueue;
+    QHash&lt;QString, CommandTransaction *&gt; _commandHash;
+    QMutex _commandQueueMutex;
+
+    void processReceivedEvent(ESLevent *);
+    ESLevent *sendRecv(const char *cmd);
+    //int sendEvent(ESLevent *send_me);
+    ESLevent *recvEvent();
+    ESLevent *recvEventTimed(int ms);
+    bool setConsoleLogLevel(int);
+    /*void api(QString cmd);*/
+    ESLevent* bgapi(QString cmd);
+    void send(QString cmd);
+    ESLevent *filter(const char *header, const char *value);
+    int events(const char *etype, const char *value);
</ins><span class="cx">  public:
</span><span class="cx">     ESLconnection(const char *host, const char *port, const char *password, const char *name);
</span><span class="cx">     virtual ~ESLconnection();
</span><ins>+    void addCommand(CommandTransaction *);
</ins><span class="cx">     int isConnected();
</span><span class="cx">     void connect();
</span><span class="cx">     ESLevent *getInfo();
</span><del>-    ESLevent *sendRecv(const char *cmd);
-    int sendEvent(ESLevent *send_me);
-    ESLevent *recvEvent();
-    ESLevent *recvEventTimed(int ms);
-    ESLevent *filter(const char *header, const char *value);
-    int events(const char *etype, const char *value);
</del><span class="cx">     int execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
</span><span class="cx">     int executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL);
</span><span class="cx">     int setAsyncExecute(const char *val);
</span><span class="cx">     int setEventLock(const char *val);
</span><span class="cx">     int disconnect(void);
</span><del>-    bool setConsoleLogLevel(int);
-    void api(QString cmd);
-    void bgapi(QString cmd);
-    void send(QString cmd);
</del><span class="cx">     QString getName();
</span><span class="cx"> signals:
</span><span class="cx">     void connected(void);
</span><span class="cx">     void disconnected(void);
</span><span class="cx">     void connectionFailed(QString);
</span><del>-    void gotEvent(ESLevent*);
</del><ins>+    void receivedLogMessage(ESLevent);
+    void receivedChannelEvent(ESLevent);
</ins><span class="cx"> protected:
</span><span class="cx">     void run();
</span><span class="cx"> };
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfacesesleventcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.cpp (0 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.cpp                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.cpp        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+#include &lt;QtGui&gt;
+#include &quot;eslevent.h&quot;
+
+
+ESLevent::ESLevent()
+{
+}
+
+ESLevent::ESLevent(esl_event_t *e)
+{
+    for (esl_event_header_t *hp = e-&gt;headers; hp; hp = hp-&gt;next)
+    {
+        _headers[hp-&gt;name] = hp-&gt;value;
+    }
+    _body = e-&gt;body;
+    _event_id = e-&gt;event_id;
+    _event_name = esl_event_name(e-&gt;event_id);
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfacesesleventh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.h (0 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.h                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslevent.h        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+#ifndef ESLEVENT_H
+#define ESLEVENT_H
+
+#include &lt;QtGui&gt;
+#include &quot;esl_event.h&quot;
+
+class ESLevent
+{
+private:
+    QString _body;
+    int _event_id;
+    QString _event_name;
+public:
+    ESLevent();
+    ESLevent(esl_event_t *e);
+    QString getBody() { return _body; }
+    int getID() { return _event_id; }
+    QString getType() { return _event_name; }
+
+    QHash&lt;QString, QString&gt; _headers;
+};
+
+Q_DECLARE_METATYPE(ESLevent)
+
+#endif // ESLEVENT_H
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfacesinterfacespro"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -1,39 +1,30 @@
</span><del>-######################################
</del><ins>+# #####################################
</ins><span class="cx"> # version check qt
</span><del>-######################################
-contains(QT_VERSION, ^4\.[0-4]\..*) {
</del><ins>+# #####################################
+contains(QT_VERSION, ^4\.[0-4]\..*) { 
</ins><span class="cx">     message(&quot;Cannot build FsGui with Qt version $$QT_VERSION.&quot;)
</span><span class="cx">     error(&quot;Use at least Qt 4.5.&quot;)
</span><span class="cx"> }
</span><del>-######################################
</del><span class="cx"> 
</span><del>-#####################################
</del><ins>+# #####################################
+# ####################################
</ins><span class="cx"> # Generates the version of FsGui
</span><span class="cx"> # based on SVN Revision
</span><del>-#####################################
-!win32 {
</del><ins>+# ####################################
+!win32 { 
</ins><span class="cx">     SVN_REV = $$system(svnversion -n .)
</span><del>-    isEmpty ( SVN_REV ) {
-    SVN_REV = \\&quot;Unknown or SVN not present\\&quot;
-    }
</del><ins>+    isEmpty ( SVN_REV ):SVN_REV = \\&quot;Unknown or SVN not present\\&quot;
</ins><span class="cx">     DEFINES += 'FSGUI_SVN_VERSION=\\&quot;$$SVN_REV\\&quot;'
</span><span class="cx"> }
</span><del>-win32 {
-    INCLUDEPATH += ../../../../../src/include/
-}
-######################################
</del><ins>+win32:INCLUDEPATH += ../../../../../src/include/
</ins><span class="cx"> 
</span><del>-#####################################
</del><ins>+# #####################################
+# ####################################
</ins><span class="cx"> # ESL must be compiled
</span><del>-#####################################
-!win32 {
-    !exists ( ../../../../../libs/esl/libesl.a ) {
-        error(&quot;lib esl must be compiled before FsGui&quot;)
-    }
-}
-#####################################
</del><ins>+# ####################################
+!win32:!exists ( ../../../../../libs/esl/libesl.a ):error(&quot;lib esl must be compiled before FsGui&quot;)
</ins><span class="cx"> 
</span><del>-
</del><ins>+# ####################################
</ins><span class="cx"> TEMPLATE = lib
</span><span class="cx"> CONFIG += staticlib
</span><span class="cx"> VERSION = 0.1
</span><span class="lines">@@ -42,12 +33,16 @@
</span><span class="cx"> HEADERS = interfaces.h \
</span><span class="cx">     settingsdialog.h \
</span><span class="cx">     servermanager.h \
</span><del>-    eslconnection.h
</del><ins>+    eslconnection.h \
+    monitorstatemachine.h \
+    eslevent.h
</ins><span class="cx"> SOURCES = settingsdialog.cpp \
</span><span class="cx">     servermanager.cpp \
</span><del>-    eslconnection.cpp
</del><ins>+    eslconnection.cpp \
+    monitorstatemachine.cpp \
+    eslevent.cpp
</ins><span class="cx"> FORMS += settingsdialog.ui \
</span><span class="cx">     servermanager.ui
</span><del>-LIBS+=-L../../../../../libs/esl/ \
</del><ins>+LIBS += -L../../../../../libs/esl/ \
</ins><span class="cx">     -lesl
</span><span class="cx"> RESOURCES += ../resources/resources.qrc
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfacesmonitorstatemachinecpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp (0 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+#include &quot;monitorstatemachine.h&quot;
+#include &quot;eslconnection.h&quot;
+#include &quot;esl.h&quot;
+
+MonitorStateMachine::MonitorStateMachine()
+{
+}
+
+void MonitorStateMachine::addESLconnection(ESLconnection *esl)
+{
+    _listESL.append(esl);
+    connect(esl, SIGNAL(receivedChannelEvent(ESLevent)),
+            this, SLOT(processEvent(ESLevent)));
+}
+
+void MonitorStateMachine::delESLconnection(ESLconnection *esl)
+{
+    int i = _listESL.indexOf(esl);
+    if (i != -1)
+        _listESL.removeAt(i);
+}
+
+void MonitorStateMachine::processEvent(ESLevent e)
+{
+    switch(e.getID())
+    {
+        case (ESL_EVENT_CHANNEL_CREATE):
+        {
+            if (_channels.contains(e._headers.value(&quot;Unique-ID&quot;)))
+            {
+                qDebug() &lt;&lt; &quot;How on earth can we have 2 channels with same UUID? : &quot; &lt;&lt; e._headers.value(&quot;Unique-ID&quot;);
+            }
+            else
+            {
+                _channels[e._headers.value(&quot;Unique-ID&quot;)] = new Channel(e._headers.value(&quot;Unique-ID&quot;), e._headers);
+                emit channelCreated(_channels.value(e._headers.value(&quot;Unique-ID&quot;)));
+            }
+            break;
+        }
+        case (ESL_EVENT_CHANNEL_STATE) :
+        {
+            if (!_channels.contains(e._headers.value(&quot;Unique-ID&quot;)))
+            {
+                qDebug() &lt;&lt; &quot;Something went wrong because we do not have this UUID: &quot; &lt;&lt; e._headers.value(&quot;Unique-ID&quot;);
+            }
+            else
+            {
+                _channels[e._headers.value(&quot;Unique-ID&quot;)]-&gt;stateChanged(e._headers);
+                emit channelStateChanged(_channels.value(e._headers.value(&quot;Unique-ID&quot;)));
+            }
+
+            break;
+        }
+        case (ESL_EVENT_CHANNEL_DESTROY):
+        {
+            if (!_channels.contains(e._headers.value(&quot;Unique-ID&quot;)))
+            {
+                qDebug() &lt;&lt; &quot;Something went wrong because we do not have this UUID: &quot; &lt;&lt; e._headers.value(&quot;Unique-ID&quot;);
+            }
+            else
+            {
+                _channels[e._headers.value(&quot;Unique-ID&quot;)]-&gt;stateChanged(e._headers);
+                emit channelDestroyed(_channels.value(e._headers.value(&quot;Unique-ID&quot;)));
+            }
+            break;
+        }
+        default:
+        {
+            if (e.getType() != &quot;COMMAND&quot;)
+                qDebug() &lt;&lt; &quot;Event not treated: &quot; &lt;&lt; e.getType();
+        }
+    }
+
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfacesmonitorstatemachineh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.h (0 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.h                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.h        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+#ifndef MONITORSTATEMACHINE_H
+#define MONITORSTATEMACHINE_H
+
+#include &lt;QObject&gt;
+#include &lt;QtCore&gt;
+#include &quot;eslevent.h&quot;
+
+class ESLconnection;
+
+class Channel
+{
+private:
+    QString _uuid;
+    QHash&lt;QString, QString&gt; _variables;
+public:
+    Channel() {}
+    Channel(QString uuid, QHash&lt;QString, QString&gt; variables) : _uuid(uuid), _variables(variables) {}
+    QHash&lt;QString, QString&gt; getVariables() { return _variables; }
+    QString getUUID() { return _uuid; }
+    QString getHeader(QString header) { return _variables.value(header, &quot;&quot;); }
+    void stateChanged(QHash&lt;QString, QString&gt; variables) { _variables = variables; }
+};
+
+class MonitorStateMachine : public QObject
+{
+    Q_OBJECT
+private:
+    QList&lt;ESLconnection *&gt; _listESL;
+    QHash &lt;QString, Channel *&gt; _channels;
+public:
+    MonitorStateMachine();
+    void addESLconnection(ESLconnection *);
+    void delESLconnection(ESLconnection *);
+    int channelCount() { return _channels.count(); }
+    QList&lt;Channel *&gt; getChannels() { return _channels.values(); }
+    Channel * getChannel(QString uuid) { return _channels.value(uuid, NULL); }
+private slots:
+    void processEvent(ESLevent);
+signals:
+    void channelStateChanged(Channel *);
+    void channelCreated(Channel *);
+    void channelDestroyed(Channel *);
+};
+
+#endif // MONITORSTATEMACHINE_H
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsoleplugincentralWidgetui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -77,6 +77,8 @@
</span><span class="cx">      &lt;string&gt;&amp;amp;Console&lt;/string&gt;
</span><span class="cx">     &lt;/property&gt;
</span><span class="cx">     &lt;addaction name=&quot;actionAutomatic_Scroll&quot;/&gt;
</span><ins>+    &lt;addaction name=&quot;separator&quot;/&gt;
+    &lt;addaction name=&quot;actionRealtime_Statistics&quot;/&gt;
</ins><span class="cx">    &lt;/widget&gt;
</span><span class="cx">    &lt;addaction name=&quot;menu_File&quot;/&gt;
</span><span class="cx">    &lt;addaction name=&quot;menu_Edit&quot;/&gt;
</span><span class="lines">@@ -129,6 +131,11 @@
</span><span class="cx">     &lt;string&gt;&amp;amp;Automatic Scroll&lt;/string&gt;
</span><span class="cx">    &lt;/property&gt;
</span><span class="cx">   &lt;/action&gt;
</span><ins>+  &lt;action name=&quot;actionRealtime_Statistics&quot;&gt;
+   &lt;property name=&quot;text&quot;&gt;
+    &lt;string&gt;Realtime &amp;amp;Statistics&lt;/string&gt;
+   &lt;/property&gt;
+  &lt;/action&gt;
</ins><span class="cx">  &lt;/widget&gt;
</span><span class="cx">  &lt;resources&gt;
</span><span class="cx">   &lt;include location=&quot;../../resources/resources.qrc&quot;/&gt;
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoleplugincpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx">                      this, SLOT(disconnect()));
</span><span class="cx">     QObject::connect(consoleWindow-&gt;action_Clear, SIGNAL(triggered()),
</span><span class="cx">                      this, SLOT(clearLogContents()));
</span><ins>+    QObject::connect(consoleWindow-&gt;actionRealtime_Statistics, SIGNAL(triggered()),
+                     this, SLOT(showRealtimeStats()));
</ins><span class="cx">     QObject::connect(consoleWindow-&gt;actionAutomatic_Scroll, SIGNAL(toggled(bool)),
</span><span class="cx">                      this, SLOT(setAutoScroll(bool)));
</span><span class="cx"> }
</span><span class="lines">@@ -147,6 +149,13 @@
</span><span class="cx">         tab-&gt;clearConsoleContents();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ConsolePlugin::showRealtimeStats()
+{
+    ConsoleTabWidget *tab = qobject_cast&lt;ConsoleTabWidget*&gt;(consoleWindow-&gt;tabConsole-&gt;currentWidget());
+    if (tab)
+        tab-&gt;showRealtimeStats();
+}
+
</ins><span class="cx"> void ConsolePlugin::connectionStateChanged()
</span><span class="cx"> {
</span><span class="cx">     tabChanged(consoleWindow-&gt;tabConsole-&gt;currentIndex());
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">     void disconnect();
</span><span class="cx">     void newConnection();
</span><span class="cx">     void clearLogContents();
</span><ins>+    void showRealtimeStats();
</ins><span class="cx">     void changeConsoleBackgroundColor();
</span><span class="cx">     void changeAlertBackgroundColor();
</span><span class="cx">     void changeCriticalBackgroundColor();
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginpro"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -1,46 +1,45 @@
</span><del>-######################################
</del><ins>+# #####################################
</ins><span class="cx"> # version check qt
</span><del>-######################################
-contains(QT_VERSION, ^4\.[0-4]\..*) {
</del><ins>+# #####################################
+contains(QT_VERSION, ^4\.[0-4]\..*) { 
</ins><span class="cx">     message(&quot;Cannot build FsGui with Qt version $$QT_VERSION.&quot;)
</span><span class="cx">     error(&quot;Use at least Qt 4.5.&quot;)
</span><span class="cx"> }
</span><del>-######################################
</del><span class="cx"> 
</span><del>-#####################################
</del><ins>+# #####################################
+# ####################################
</ins><span class="cx"> # Generates the version of FsGui
</span><span class="cx"> # based on SVN Revision
</span><del>-#####################################
-!win32 {
</del><ins>+# ####################################
+!win32 { 
</ins><span class="cx">     SVN_REV = $$system(svnversion -n .)
</span><del>-    isEmpty ( SVN_REV ) {
-    SVN_REV = \\&quot;Unknown or SVN not present\\&quot;
-    }
</del><ins>+    isEmpty ( SVN_REV ):SVN_REV = \\&quot;Unknown or SVN not present\\&quot;
</ins><span class="cx">     DEFINES += 'FSGUI_SVN_VERSION=\\&quot;$$SVN_REV\\&quot;'
</span><span class="cx"> }
</span><del>-win32 {
-    INCLUDEPATH += ../../../../../src/include/
-}
-######################################
</del><ins>+win32:INCLUDEPATH += ../../../../../src/include/
</ins><span class="cx"> 
</span><del>-TEMPLATE    = lib
-TARGET      = consoleplugin
-DESTDIR     = ../../../bin/plugins/
-CONFIG     += plugin
</del><ins>+# #####################################
+TEMPLATE = lib
+TARGET = consoleplugin
+DESTDIR = ../../../bin/plugins/
+CONFIG += plugin
</ins><span class="cx"> INCLUDEPATH = ../../fsgui/ \
</span><del>-            ../../interfaces \
-            ../../../../../../libs/esl/src/include/
-HEADERS     = consoleplugin.h \
-            sortfilterproxymodel.h \
-            consoletabwidget.h
-SOURCES     = consoleplugin.cpp \
-            sortfilterproxymodel.cpp \
-            consoletabwidget.cpp
-FORMS     += centralWidget.ui \
-            console_settings.ui \
-            consoletabwidget.ui
-LIBS      += -L../../interfaces \
-            -linterfaces \
-            -L../../../../../../libs/esl/ \
-            -lesl
</del><ins>+    ../../interfaces \
+    ../../../../../../libs/esl/src/include/
+HEADERS = consoleplugin.h \
+    sortfilterproxymodel.h \
+    consoletabwidget.h \
+    realtimestatisticsdialog.h
+SOURCES = consoleplugin.cpp \
+    sortfilterproxymodel.cpp \
+    consoletabwidget.cpp \
+    realtimestatisticsdialog.cpp
+FORMS += centralWidget.ui \
+    console_settings.ui \
+    consoletabwidget.ui \
+    realtimestatisticsdialog.ui
+LIBS += -L../../interfaces \
+    -linterfaces \
+    -L../../../../../../libs/esl/ \
+    -lesl
</ins><span class="cx"> RESOURCES += ../../resources/resources.qrc
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -1,12 +1,15 @@
</span><span class="cx"> #include &quot;consoletabwidget.h&quot;
</span><span class="cx"> #include &quot;ui_consoletabwidget.h&quot;
</span><span class="cx"> #include &quot;eslconnection.h&quot;
</span><ins>+#include &quot;monitorstatemachine.h&quot;
+#include &quot;realtimestatisticsdialog.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> ConsoleTabWidget::ConsoleTabWidget(QWidget *parent, ESLconnection *eslconnection) :
</span><span class="cx">     QWidget(parent),
</span><span class="cx">     m_ui(new Ui::ConsoleTabWidget),
</span><span class="cx">     esl(eslconnection),
</span><span class="cx">     scrollTimer(new QTimer),
</span><ins>+    _rtStatsDlg(NULL),
</ins><span class="cx">     findNext(false),
</span><span class="cx">     autoScroll(true)
</span><span class="cx"> {
</span><span class="lines">@@ -51,13 +54,16 @@
</span><span class="cx">                      this, SLOT(connectionFailed(QString)));
</span><span class="cx">     QObject::connect(esl, SIGNAL(disconnected()),
</span><span class="cx">                      this, SLOT(disconnected()));
</span><del>-    QObject::connect(esl, SIGNAL(gotEvent(ESLevent*)),
-                     this, SLOT(gotEvent(ESLevent*)));
</del><ins>+    QObject::connect(esl, SIGNAL(receivedLogMessage(ESLevent)),
+                     this, SLOT(gotEvent(ESLevent)));
</ins><span class="cx"> 
</span><span class="cx">     QObject::connect(scrollTimer, SIGNAL(timeout()),
</span><span class="cx">                      this, SLOT(conditionalScroll()));
</span><span class="cx"> 
</span><span class="cx">     esl-&gt;connect();
</span><ins>+
+    msm = new MonitorStateMachine();
+    msm-&gt;addESLconnection(esl);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ConsoleTabWidget::~ConsoleTabWidget()
</span><span class="lines">@@ -158,11 +164,11 @@
</span><span class="cx">     addNewConsoleItem(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ConsoleTabWidget::gotEvent(ESLevent * event)
</del><ins>+void ConsoleTabWidget::gotEvent(ESLevent event)
</ins><span class="cx"> {
</span><del>-    if (event-&gt;getBody())
</del><ins>+    if (!event.getBody().isEmpty())
</ins><span class="cx">     {
</span><del>-        QString text(event-&gt;getBody());
</del><ins>+        QString text(event.getBody());
</ins><span class="cx"> 
</span><span class="cx">         /* Remove \r\n */
</span><span class="cx">         QStringList textList = text.split(QRegExp(&quot;(\r+)&quot;), QString::SkipEmptyParts);
</span><span class="lines">@@ -175,12 +181,11 @@
</span><span class="cx">         for (int line = 0; line &lt; lines.size(); ++line)
</span><span class="cx">         {
</span><span class="cx">             QStandardItem *item = new QStandardItem(lines[line]);
</span><del>-            item-&gt;setData(QString(event-&gt;getHeader(&quot;Log-Level&quot;)).toInt(), Qt::UserRole);
</del><ins>+            item-&gt;setData(event._headers.value(&quot;Log-Level&quot;).toInt(), Qt::UserRole);
</ins><span class="cx">             addNewConsoleItem(item);
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    delete event;
-
</del><ins>+    //delete event;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ConsoleTabWidget::addNewConsoleItem(QStandardItem *item)
</span><span class="lines">@@ -195,10 +200,25 @@
</span><span class="cx"> 
</span><span class="cx"> void ConsoleTabWidget::cmdSendClicked()
</span><span class="cx"> {
</span><del>-    esl-&gt;bgapi(m_ui-&gt;lineCmd-&gt;text());
</del><ins>+    CommandTransaction *transaction = new CommandTransaction(m_ui-&gt;lineCmd-&gt;text());
+    QObject::connect(transaction, SIGNAL(gotResponse(ESLevent)),
+                     this, SLOT(gotEvent(ESLevent)));
+    esl-&gt;addCommand(transaction);
</ins><span class="cx">     m_ui-&gt;lineCmd-&gt;clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ConsoleTabWidget::showRealtimeStats()
+{
+    if (!_rtStatsDlg)
+    {
+        _rtStatsDlg = new RealtimeStatisticsDialog(this, msm);
+    }
+
+    _rtStatsDlg-&gt;show();
+    _rtStatsDlg-&gt;raise();
+    _rtStatsDlg-&gt;activateWindow();
+}
+
</ins><span class="cx"> void ConsoleTabWidget::lineCmdChanged(QString text)
</span><span class="cx"> {
</span><span class="cx">     m_ui-&gt;btnSend-&gt;setDisabled(text.isEmpty());
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgeth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;QtGui/QWidget&gt;
</span><span class="cx"> #include &quot;sortfilterproxymodel.h&quot;
</span><ins>+#include &quot;eslevent.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace Ui {
</span><span class="cx">     class ConsoleTabWidget;
</span><span class="lines">@@ -12,7 +13,8 @@
</span><span class="cx"> class QStandardItemModel;
</span><span class="cx"> class QTimer;
</span><span class="cx"> class ESLconnection;
</span><del>-class ESLevent;
</del><ins>+class MonitorStateMachine;
+class RealtimeStatisticsDialog;
</ins><span class="cx"> 
</span><span class="cx"> class ConsoleTabWidget : public QWidget {
</span><span class="cx">     Q_OBJECT
</span><span class="lines">@@ -22,6 +24,7 @@
</span><span class="cx"> 
</span><span class="cx"> public slots:
</span><span class="cx">     void clearConsoleContents();
</span><ins>+    void showRealtimeStats();
</ins><span class="cx">     void flipScrollTimer();
</span><span class="cx">     void setAutomaticScroll(bool enabled);
</span><span class="cx">     bool getAutomaticScroll();
</span><span class="lines">@@ -36,7 +39,7 @@
</span><span class="cx">     void connected();
</span><span class="cx">     void disconnected();
</span><span class="cx">     void connectionFailed(QString);
</span><del>-    void gotEvent(ESLevent *);
</del><ins>+    void gotEvent(ESLevent);
</ins><span class="cx">     void addNewConsoleItem(QStandardItem *item);
</span><span class="cx">     void cmdSendClicked();
</span><span class="cx">     void lineCmdChanged(QString);
</span><span class="lines">@@ -55,6 +58,8 @@
</span><span class="cx">     SortFilterProxyModel *model;
</span><span class="cx">     ESLconnection *esl;
</span><span class="cx">     QTimer *scrollTimer;
</span><ins>+    MonitorStateMachine *msm;
+    RealtimeStatisticsDialog *_rtStatsDlg;
</ins><span class="cx">     bool findNext;
</span><span class="cx">     bool autoScroll;
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui (14541 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui        2009-08-17 00:32:26 UTC (rev 14541)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -6,14 +6,14 @@
</span><span class="cx">    &lt;rect&gt;
</span><span class="cx">     &lt;x&gt;0&lt;/x&gt;
</span><span class="cx">     &lt;y&gt;0&lt;/y&gt;
</span><del>-    &lt;width&gt;657&lt;/width&gt;
-    &lt;height&gt;445&lt;/height&gt;
</del><ins>+    &lt;width&gt;859&lt;/width&gt;
+    &lt;height&gt;557&lt;/height&gt;
</ins><span class="cx">    &lt;/rect&gt;
</span><span class="cx">   &lt;/property&gt;
</span><span class="cx">   &lt;property name=&quot;windowTitle&quot;&gt;
</span><span class="cx">    &lt;string&gt;Form&lt;/string&gt;
</span><span class="cx">   &lt;/property&gt;
</span><del>-  &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout_3&quot;&gt;
</del><ins>+  &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout_6&quot;&gt;
</ins><span class="cx">    &lt;item&gt;
</span><span class="cx">     &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox_2&quot;&gt;
</span><span class="cx">      &lt;property name=&quot;title&quot;&gt;
</span><span class="lines">@@ -111,112 +111,123 @@
</span><span class="cx">       &lt;/widget&gt;
</span><span class="cx">      &lt;/item&gt;
</span><span class="cx">      &lt;item&gt;
</span><del>-      &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox&quot;&gt;
-       &lt;property name=&quot;maximumSize&quot;&gt;
-        &lt;size&gt;
-         &lt;width&gt;120&lt;/width&gt;
-         &lt;height&gt;16777215&lt;/height&gt;
-        &lt;/size&gt;
-       &lt;/property&gt;
-       &lt;property name=&quot;title&quot;&gt;
-        &lt;string&gt;Log Level&lt;/string&gt;
-       &lt;/property&gt;
-       &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout&quot;&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkEmerg&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Console&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkAlert&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Alert&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkCrit&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Critical&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkError&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Error&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkWarn&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Warning&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkNotice&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Notice&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkInfo&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Info&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkDebug&quot;&gt;
-          &lt;property name=&quot;text&quot;&gt;
-           &lt;string&gt;Debug&lt;/string&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;checked&quot;&gt;
-           &lt;bool&gt;true&lt;/bool&gt;
-          &lt;/property&gt;
-         &lt;/widget&gt;
-        &lt;/item&gt;
-        &lt;item&gt;
-         &lt;spacer name=&quot;verticalSpacer&quot;&gt;
-          &lt;property name=&quot;orientation&quot;&gt;
-           &lt;enum&gt;Qt::Vertical&lt;/enum&gt;
-          &lt;/property&gt;
-          &lt;property name=&quot;sizeHint&quot; stdset=&quot;0&quot;&gt;
-           &lt;size&gt;
-            &lt;width&gt;20&lt;/width&gt;
-            &lt;height&gt;18&lt;/height&gt;
-           &lt;/size&gt;
-          &lt;/property&gt;
-         &lt;/spacer&gt;
-        &lt;/item&gt;
-       &lt;/layout&gt;
-      &lt;/widget&gt;
</del><ins>+      &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout_3&quot;&gt;
+       &lt;item&gt;
+        &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox&quot;&gt;
+         &lt;property name=&quot;maximumSize&quot;&gt;
+          &lt;size&gt;
+           &lt;width&gt;120&lt;/width&gt;
+           &lt;height&gt;16777215&lt;/height&gt;
+          &lt;/size&gt;
+         &lt;/property&gt;
+         &lt;property name=&quot;title&quot;&gt;
+          &lt;string&gt;Log Level&lt;/string&gt;
+         &lt;/property&gt;
+         &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout&quot;&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkEmerg&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Console&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkAlert&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Alert&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkCrit&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Critical&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkError&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Error&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkWarn&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Warning&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkNotice&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Notice&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkInfo&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Info&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QCheckBox&quot; name=&quot;checkDebug&quot;&gt;
+            &lt;property name=&quot;text&quot;&gt;
+             &lt;string&gt;Debug&lt;/string&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;checked&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+          &lt;item&gt;
+           &lt;spacer name=&quot;verticalSpacer&quot;&gt;
+            &lt;property name=&quot;orientation&quot;&gt;
+             &lt;enum&gt;Qt::Vertical&lt;/enum&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;sizeHint&quot; stdset=&quot;0&quot;&gt;
+             &lt;size&gt;
+              &lt;width&gt;20&lt;/width&gt;
+              &lt;height&gt;18&lt;/height&gt;
+             &lt;/size&gt;
+            &lt;/property&gt;
+           &lt;/spacer&gt;
+          &lt;/item&gt;
+         &lt;/layout&gt;
+        &lt;/widget&gt;
+       &lt;/item&gt;
+       &lt;item&gt;
+        &lt;widget class=&quot;Line&quot; name=&quot;line&quot;&gt;
+         &lt;property name=&quot;orientation&quot;&gt;
+          &lt;enum&gt;Qt::Horizontal&lt;/enum&gt;
+         &lt;/property&gt;
+        &lt;/widget&gt;
+       &lt;/item&gt;
+      &lt;/layout&gt;
</ins><span class="cx">      &lt;/item&gt;
</span><span class="cx">     &lt;/layout&gt;
</span><span class="cx">    &lt;/item&gt;
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp (0 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+#include &lt;QtGui&gt;
+#include &quot;realtimestatisticsdialog.h&quot;
+#include &quot;ui_realtimestatisticsdialog.h&quot;
+#include &quot;monitorstatemachine.h&quot;
+
+RealtimeStatisticsDialog::RealtimeStatisticsDialog(QWidget *parent, MonitorStateMachine *sm) :
+    QDialog(parent),
+    m_ui(new Ui::RealtimeStatisticsDialog),
+    _sm(sm)
+{
+    m_ui-&gt;setupUi(this);
+    connect(sm, SIGNAL(channelCreated(Channel*)),
+            this, SLOT(channelCreate(Channel*)));
+    connect(sm, SIGNAL(channelDestroyed(Channel*)),
+            this, SLOT(channelDestroy(Channel*)));
+    connect(m_ui-&gt;listActiveChannels, SIGNAL(itemClicked(QListWidgetItem*)),
+            this, SLOT(channelSelected(QListWidgetItem*)));
+    delete m_ui-&gt;tab_2;
+}
+
+RealtimeStatisticsDialog::~RealtimeStatisticsDialog()
+{
+    delete m_ui;
+}
+
+void RealtimeStatisticsDialog::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e-&gt;type()) {
+    case QEvent::LanguageChange:
+        m_ui-&gt;retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void RealtimeStatisticsDialog::channelCreate(Channel *ch)
+{
+    QListWidgetItem *item = new QListWidgetItem(QString(&quot;%1 - %2&quot;).arg(ch-&gt;getUUID(), ch-&gt;getHeader(&quot;Channel-State&quot;)),
+                                                m_ui-&gt;listActiveChannels);
+    item-&gt;setData(Qt::UserRole, ch-&gt;getUUID());
+}
+
+void RealtimeStatisticsDialog::channelDestroy(Channel *ch)
+{
+    for (int i = 0; i &lt; m_ui-&gt;listActiveChannels-&gt;count(); i++)
+    {
+        if (m_ui-&gt;listActiveChannels-&gt;item(i)-&gt;data(Qt::UserRole) == ch-&gt;getUUID())
+        {
+            if (m_ui-&gt;listActiveChannels-&gt;currentItem() == m_ui-&gt;listActiveChannels-&gt;item(i))
+                m_ui-&gt;listActiveVariables-&gt;clear();
+
+            delete m_ui-&gt;listActiveChannels-&gt;item(i);
+        }
+    }
+}
+
+void RealtimeStatisticsDialog::channelSelected(QListWidgetItem *item)
+{
+    m_ui-&gt;listActiveVariables-&gt;clear();
+
+    Channel * ch = _sm-&gt;getChannel(item-&gt;data(Qt::UserRole).toString());
+    if (!ch)
+        return;
+
+    foreach (QString key, ch-&gt;getVariables().keys())
+    {
+        m_ui-&gt;listActiveVariables-&gt;addItem(QString(&quot;%1 = %2&quot;).arg(key, ch-&gt;getVariables().value(key)));
+    }
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.h (0 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.h                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.h        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+#ifndef REALTIMESTATISTICSDIALOG_H
+#define REALTIMESTATISTICSDIALOG_H
+
+#include &lt;QtGui/QDialog&gt;
+
+namespace Ui {
+    class RealtimeStatisticsDialog;
+}
+
+class QListWidgetItem;
+class MonitorStateMachine;
+class Channel;
+
+class RealtimeStatisticsDialog : public QDialog {
+    Q_OBJECT
+public:
+    RealtimeStatisticsDialog(QWidget *parent = 0);
+    RealtimeStatisticsDialog(QWidget *parent, MonitorStateMachine *sm);
+    ~RealtimeStatisticsDialog();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void channelCreate(Channel *);
+    void channelDestroy(Channel *);
+    void channelSelected(QListWidgetItem *);
+
+private:
+    Ui::RealtimeStatisticsDialog *m_ui;
+    MonitorStateMachine *_sm;
+};
+
+#endif // REALTIMESTATISTICSDIALOG_H
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogui"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.ui (0 => 14542)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.ui                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.ui        2009-08-17 04:22:03 UTC (rev 14542)
</span><span class="lines">@@ -0,0 +1,173 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;ui version=&quot;4.0&quot;&gt;
+ &lt;class&gt;RealtimeStatisticsDialog&lt;/class&gt;
+ &lt;widget class=&quot;QDialog&quot; name=&quot;RealtimeStatisticsDialog&quot;&gt;
+  &lt;property name=&quot;geometry&quot;&gt;
+   &lt;rect&gt;
+    &lt;x&gt;0&lt;/x&gt;
+    &lt;y&gt;0&lt;/y&gt;
+    &lt;width&gt;612&lt;/width&gt;
+    &lt;height&gt;534&lt;/height&gt;
+   &lt;/rect&gt;
+  &lt;/property&gt;
+  &lt;property name=&quot;windowTitle&quot;&gt;
+   &lt;string&gt;Realtime Statistics&lt;/string&gt;
+  &lt;/property&gt;
+  &lt;property name=&quot;sizeGripEnabled&quot;&gt;
+   &lt;bool&gt;true&lt;/bool&gt;
+  &lt;/property&gt;
+  &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout_2&quot;&gt;
+   &lt;item&gt;
+    &lt;widget class=&quot;QTabWidget&quot; name=&quot;tabWidget&quot;&gt;
+     &lt;property name=&quot;currentIndex&quot;&gt;
+      &lt;number&gt;0&lt;/number&gt;
+     &lt;/property&gt;
+     &lt;widget class=&quot;QWidget&quot; name=&quot;tab&quot;&gt;
+      &lt;attribute name=&quot;title&quot;&gt;
+       &lt;string&gt;Active&lt;/string&gt;
+      &lt;/attribute&gt;
+      &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_5&quot;&gt;
+       &lt;item&gt;
+        &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout&quot;&gt;
+         &lt;item&gt;
+          &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox&quot;&gt;
+           &lt;property name=&quot;title&quot;&gt;
+            &lt;string&gt;Channels&lt;/string&gt;
+           &lt;/property&gt;
+           &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout&quot;&gt;
+            &lt;item&gt;
+             &lt;widget class=&quot;QListWidget&quot; name=&quot;listActiveChannels&quot;&gt;
+              &lt;property name=&quot;editTriggers&quot;&gt;
+               &lt;set&gt;QAbstractItemView::NoEditTriggers&lt;/set&gt;
+              &lt;/property&gt;
+              &lt;property name=&quot;alternatingRowColors&quot;&gt;
+               &lt;bool&gt;true&lt;/bool&gt;
+              &lt;/property&gt;
+             &lt;/widget&gt;
+            &lt;/item&gt;
+           &lt;/layout&gt;
+          &lt;/widget&gt;
+         &lt;/item&gt;
+         &lt;item&gt;
+          &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox_3&quot;&gt;
+           &lt;property name=&quot;title&quot;&gt;
+            &lt;string&gt;Calls&lt;/string&gt;
+           &lt;/property&gt;
+           &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_3&quot;&gt;
+            &lt;item&gt;
+             &lt;widget class=&quot;QListWidget&quot; name=&quot;listActiveCalls&quot;&gt;
+              &lt;property name=&quot;editTriggers&quot;&gt;
+               &lt;set&gt;QAbstractItemView::NoEditTriggers&lt;/set&gt;
+              &lt;/property&gt;
+              &lt;property name=&quot;alternatingRowColors&quot;&gt;
+               &lt;bool&gt;true&lt;/bool&gt;
+              &lt;/property&gt;
+             &lt;/widget&gt;
+            &lt;/item&gt;
+           &lt;/layout&gt;
+          &lt;/widget&gt;
+         &lt;/item&gt;
+        &lt;/layout&gt;
+       &lt;/item&gt;
+       &lt;item&gt;
+        &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox_2&quot;&gt;
+         &lt;property name=&quot;title&quot;&gt;
+          &lt;string&gt;Variables&lt;/string&gt;
+         &lt;/property&gt;
+         &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_2&quot;&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QListWidget&quot; name=&quot;listActiveVariables&quot;&gt;
+            &lt;property name=&quot;editTriggers&quot;&gt;
+             &lt;set&gt;QAbstractItemView::NoEditTriggers&lt;/set&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;alternatingRowColors&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;sortingEnabled&quot;&gt;
+             &lt;bool&gt;false&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+         &lt;/layout&gt;
+        &lt;/widget&gt;
+       &lt;/item&gt;
+      &lt;/layout&gt;
+     &lt;/widget&gt;
+     &lt;widget class=&quot;QWidget&quot; name=&quot;tab_2&quot;&gt;
+      &lt;attribute name=&quot;title&quot;&gt;
+       &lt;string&gt;Inactive&lt;/string&gt;
+      &lt;/attribute&gt;
+      &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_12&quot;&gt;
+       &lt;item&gt;
+        &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout_4&quot;&gt;
+         &lt;item&gt;
+          &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox_7&quot;&gt;
+           &lt;property name=&quot;title&quot;&gt;
+            &lt;string&gt;Channels&lt;/string&gt;
+           &lt;/property&gt;
+           &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_9&quot;&gt;
+            &lt;item&gt;
+             &lt;widget class=&quot;QListWidget&quot; name=&quot;listInactiveChannels&quot;&gt;
+              &lt;property name=&quot;editTriggers&quot;&gt;
+               &lt;set&gt;QAbstractItemView::NoEditTriggers&lt;/set&gt;
+              &lt;/property&gt;
+              &lt;property name=&quot;alternatingRowColors&quot;&gt;
+               &lt;bool&gt;true&lt;/bool&gt;
+              &lt;/property&gt;
+             &lt;/widget&gt;
+            &lt;/item&gt;
+           &lt;/layout&gt;
+          &lt;/widget&gt;
+         &lt;/item&gt;
+         &lt;item&gt;
+          &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox_8&quot;&gt;
+           &lt;property name=&quot;title&quot;&gt;
+            &lt;string&gt;Calls&lt;/string&gt;
+           &lt;/property&gt;
+           &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_10&quot;&gt;
+            &lt;item&gt;
+             &lt;widget class=&quot;QListWidget&quot; name=&quot;listInactiveCalls&quot;&gt;
+              &lt;property name=&quot;editTriggers&quot;&gt;
+               &lt;set&gt;QAbstractItemView::NoEditTriggers&lt;/set&gt;
+              &lt;/property&gt;
+              &lt;property name=&quot;alternatingRowColors&quot;&gt;
+               &lt;bool&gt;true&lt;/bool&gt;
+              &lt;/property&gt;
+             &lt;/widget&gt;
+            &lt;/item&gt;
+           &lt;/layout&gt;
+          &lt;/widget&gt;
+         &lt;/item&gt;
+        &lt;/layout&gt;
+       &lt;/item&gt;
+       &lt;item&gt;
+        &lt;widget class=&quot;QGroupBox&quot; name=&quot;groupBox_9&quot;&gt;
+         &lt;property name=&quot;title&quot;&gt;
+          &lt;string&gt;Variables&lt;/string&gt;
+         &lt;/property&gt;
+         &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_11&quot;&gt;
+          &lt;item&gt;
+           &lt;widget class=&quot;QListWidget&quot; name=&quot;listInactiveVariables&quot;&gt;
+            &lt;property name=&quot;editTriggers&quot;&gt;
+             &lt;set&gt;QAbstractItemView::NoEditTriggers&lt;/set&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;alternatingRowColors&quot;&gt;
+             &lt;bool&gt;true&lt;/bool&gt;
+            &lt;/property&gt;
+            &lt;property name=&quot;sortingEnabled&quot;&gt;
+             &lt;bool&gt;false&lt;/bool&gt;
+            &lt;/property&gt;
+           &lt;/widget&gt;
+          &lt;/item&gt;
+         &lt;/layout&gt;
+        &lt;/widget&gt;
+       &lt;/item&gt;
+      &lt;/layout&gt;
+     &lt;/widget&gt;
+    &lt;/widget&gt;
+   &lt;/item&gt;
+  &lt;/layout&gt;
+ &lt;/widget&gt;
+ &lt;resources/&gt;
+ &lt;connections/&gt;
+&lt;/ui&gt;
</ins></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>