<!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][16101] </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=16101">16101</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-12-30 22:09:22 -0600 (Wed, 30 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>This is really fun. We can run freeswitch under the loop of this small application. Lets start hacking the softphone!</pre>

<h3>Added Paths</h3>
<ul>
<li>freeswitch/trunk/contrib/jmesquita/FSPhone/</li>
<li><a href="#freeswitchtrunkcontribjmesquitaFSPhoneFSPhonepro">freeswitch/trunk/contrib/jmesquita/FSPhone/FSPhone.pro</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitaFSPhonefshostcpp">freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitaFSPhonefshosth">freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitaFSPhonemaincpp">freeswitch/trunk/contrib/jmesquita/FSPhone/main.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitaFSPhonemainwindowcpp">freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitaFSPhonemainwindowh">freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitaFSPhonemainwindowui">freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.ui</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribjmesquitaFSPhoneFSPhonepro"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/FSPhone/FSPhone.pro (0 => 16101)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/FSPhone/FSPhone.pro                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/FSPhone.pro        2009-12-31 04:09:22 UTC (rev 16101)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+# #####################################
+# version check qt
+# #####################################
+contains(QT_VERSION, ^4\.[0-4]\..*) {
+    message(&quot;Cannot build FsGui with Qt version $$QT_VERSION.&quot;)
+    error(&quot;Use at least Qt 4.5.&quot;)
+}
+
+QT += xml
+TARGET = fsphone
+TEMPLATE = app
+INCLUDEPATH = ../../../src/include \
+    ../../../libs/apr/include \
+    ../../../libs/libteletone/src
+LIBS = -L../../../.libs \
+    -lfreeswitch \
+    -lm \
+    -lcrypt \
+    -lrt
+
+# This is here to comply with the default freeswitch installation
+QMAKE_LFLAGS += -Wl,-rpath,/usr/local/freeswitch/lib
+SOURCES += main.cpp \
+    mainwindow.cpp \
+    fshost.cpp
+HEADERS += mainwindow.h \
+    fshost.h
+FORMS += mainwindow.ui
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitaFSPhonefshostcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.cpp (0 => 16101)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.cpp                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.cpp        2009-12-31 04:09:22 UTC (rev 16101)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+#include &quot;fshost.h&quot;
+
+FSHost::FSHost(QObject *parent) :
+    QThread(parent)
+{
+    /* Initialize libs &amp; globals */
+    printf(&quot;Initializing globals...\n&quot;);
+    switch_core_setrlimits();
+    switch_core_set_globals();
+}
+
+FSHost::~FSHost()
+{
+    switch_status_t destroy_status;
+    /* When the runtime loop exits, its time to shutdown */
+    destroy_status = switch_core_destroy();
+    wait();
+}
+
+void FSHost::run(void)
+{
+    switch_core_flag_t flags = SCF_USE_SQL;
+    const char *err = NULL;
+    switch_bool_t console = SWITCH_FALSE;
+
+    /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
+    printf(&quot;Initializing core...\n&quot;);
+    /* Initialize the core and load modules, that will startup FS completely */
+    if (switch_core_init_and_modload(flags, console, &amp;err) != SWITCH_STATUS_SUCCESS) {
+            fprintf(stderr, &quot;Failed to initialize FreeSWITCH's core: %s\n&quot;, err);
+            return;
+    }
+
+    printf(&quot;Everything OK, Entering runtime loop.\n&quot;);
+
+    /* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set
+     * If its false, it initializes the libedit for the console, then does the same thing
+     */
+    switch_core_runtime_loop(!console);
+
+    fflush(stdout);
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitaFSPhonefshosth"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.h (0 => 16101)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.h                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.h        2009-12-31 04:09:22 UTC (rev 16101)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+#ifndef FSHOST_H
+#define FSHOST_H
+
+#include &lt;QThread&gt;
+#include &lt;switch.h&gt;
+
+class FSHost : public QThread
+{
+Q_OBJECT
+public:
+    explicit FSHost(QObject *parent = 0);
+    ~FSHost(void);
+
+protected:
+    void run(void);
+
+signals:
+
+public slots:
+
+};
+
+#endif // FSHOST_H
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitaFSPhonemaincpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/FSPhone/main.cpp (0 => 16101)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/FSPhone/main.cpp                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/main.cpp        2009-12-31 04:09:22 UTC (rev 16101)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+#include &lt;QtGui/QApplication&gt;
+#include &quot;mainwindow.h&quot;
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+    return a.exec();
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitaFSPhonemainwindowcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp (0 => 16101)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp        2009-12-31 04:09:22 UTC (rev 16101)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+#include &quot;mainwindow.h&quot;
+#include &quot;ui_mainwindow.h&quot;
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+    ui-&gt;setupUi(this);
+    this-&gt;fshost = new FSHost();
+    this-&gt;fshost-&gt;start();
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+    QMainWindow::changeEvent(e);
+    switch (e-&gt;type()) {
+    case QEvent::LanguageChange:
+        ui-&gt;retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitaFSPhonemainwindowh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.h (0 => 16101)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.h                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.h        2009-12-31 04:09:22 UTC (rev 16101)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II &lt;anthm@freeswitch.org&gt;
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the &quot;License&quot;); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an &quot;AS IS&quot; basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II &lt;anthm@freeswitch.org&gt;
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita &lt;jmesquita@freeswitch.org&gt;
+ *
+ *
+ *
+ */
+
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include &lt;QMainWindow&gt;
+#include &lt;fshost.h&gt;
+
+namespace Ui {
+    class MainWindow;
+}
+
+class MainWindow : public QMainWindow {
+    Q_OBJECT
+public:
+    MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private:
+    Ui::MainWindow *ui;
+    FSHost *fshost;
+};
+
+#endif // MAINWINDOW_H
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitaFSPhonemainwindowui"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.ui (0 => 16101)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.ui                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.ui        2009-12-31 04:09:22 UTC (rev 16101)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;ui version=&quot;4.0&quot;&gt;
+ &lt;class&gt;MainWindow&lt;/class&gt;
+ &lt;widget class=&quot;QMainWindow&quot; name=&quot;MainWindow&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;600&lt;/width&gt;
+    &lt;height&gt;400&lt;/height&gt;
+   &lt;/rect&gt;
+  &lt;/property&gt;
+  &lt;property name=&quot;windowTitle&quot; &gt;
+   &lt;string&gt;MainWindow&lt;/string&gt;
+  &lt;/property&gt;
+  &lt;widget class=&quot;QMenuBar&quot; name=&quot;menuBar&quot; /&gt;
+  &lt;widget class=&quot;QToolBar&quot; name=&quot;mainToolBar&quot; /&gt;
+  &lt;widget class=&quot;QWidget&quot; name=&quot;centralWidget&quot; /&gt;
+  &lt;widget class=&quot;QStatusBar&quot; name=&quot;statusBar&quot; /&gt;
+ &lt;/widget&gt;
+ &lt;layoutDefault spacing=&quot;6&quot; margin=&quot;11&quot; /&gt;
+ &lt;pixmapfunction&gt;&lt;/pixmapfunction&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>