Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/Makefile
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/Makefile	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/Makefile	(revision 4471)
@@ -0,0 +1,6 @@
+QMAKE_TARGET  = PjsuaBB
+PROJECT_DIR	  := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
+I18N_DIR	  := $(PROJECT_DIR)/translations
+
+include mk/cs-base.mk
+
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/PjsuaBB.pro
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/PjsuaBB.pro	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/PjsuaBB.pro	(revision 4471)
@@ -0,0 +1,30 @@
+APP_NAME = PjsuaBB
+
+CONFIG += qt warn_on cascades10
+
+include(config.pri)
+
+SOURCES +=  ../../pjsua_app.c \
+            ../../pjsua_cli_cmd.c \
+            ../../pjsua_cli.c \
+            ../../pjsua_common.c \
+            ../../pjsua_config.c \
+            ../../pjsua_legacy.c
+
+device {
+    CONFIG(debug, debug|release) {
+        # Device-Debug custom configuration
+        include(../../../../pjsip.pri)
+        LIBS += -lbb
+    }
+
+    CONFIG(release, debug|release) {
+        # Device-Release custom configuration
+    }
+}
+
+simulator {
+    CONFIG(debug, debug|release) {
+        # Simulator-Debug custom configuration
+    }
+}
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/assets/.assets.index
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/assets/.assets.index	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/assets/.assets.index	(revision 4471)
@@ -0,0 +1,4 @@
+1
+2
+main.qml
+images/teluu-logo.png
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/assets/main.qml
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/assets/main.qml	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/assets/main.qml	(revision 4471)
@@ -0,0 +1,41 @@
+// Default empty project template
+import bb.cascades 1.0
+
+// creates one page with a label
+Page {
+    Container {
+        layout: StackLayout {
+        }
+        background: Color.Black
+        Label {
+            text: qsTr("")
+            horizontalAlignment: HorizontalAlignment.Center
+        }
+        ImageView {
+            imageSource: "asset:///images/teluu-logo.png"
+            topMargin: 200
+            preferredWidth: 500
+            preferredHeight: 500
+            verticalAlignment: VerticalAlignment.Center
+            horizontalAlignment: HorizontalAlignment.Center
+        }
+        Label {
+            text: qsTr("pjsua BB10")
+            textStyle.base: SystemDefaults.TextStyles.BigText
+            horizontalAlignment: HorizontalAlignment.Center
+            textStyle {
+                color: Color.White
+            }
+        }
+        Label {
+            objectName: "telnetMsg"
+            text: qsTr("Starting..")
+            topMargin: 200
+            horizontalAlignment: HorizontalAlignment.Center
+            textStyle {
+                color: Color.White
+            }
+        }
+    }
+}
+
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/bar-descriptor.xml
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/bar-descriptor.xml	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/bar-descriptor.xml	(revision 4471)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!--
+  
+   Copyright (c) 2011, 2012, 2013 Research In Motion Limited.
+  
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+  
+   http://www.apache.org/licenses/LICENSE-2.0
+  
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  
+-->
+<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
+
+<!-- BlackBerry Tablet OS application descriptor file.
+
+    Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.
+
+-->
+
+    <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
+         Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
+    <id>com.example.PjsuaBB</id>
+
+    <!-- The name that is displayed in the BlackBerry Tablet OS application installer. 
+         May have multiple values for each language. See samples or xsd schema file. Optional. -->
+    <name>PjsuaBB</name>
+    
+    <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade. 
+         Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
+         An updated version of application must have a versionNumber value higher than the previous version. Required. -->
+    <versionNumber>1.0.0</versionNumber>
+
+    <!-- Fourth digit segment of the package version. First three segments are taken from the 
+         <versionNumber> element.  Must be an integer from 0 to 2^16-1 -->
+    <buildId>1</buildId>
+                 
+    <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
+    <!-- <versionLabel></versionLabel> -->
+
+    <!-- Description, displayed in the BlackBerry Tablet OS application installer.
+         May have multiple values for each language. See samples or xsd schema file. Optional. -->
+    <description>Teluu Ltd. pjsua Demo App</description>
+
+    <!-- Copyright information. Optional. -->
+    <!-- <copyright></copyright> -->
+
+    <!--  Name of author which is used for signing. Must match the developer name of your development certificate. -->
+    <author>Teluu Ltd.</author>
+    
+    <!--  Unique author ID assigned by signing authority. Required if using debug tokens. -->
+    <!-- <authorId>ABC1234YjsnUk235h</authorId> -->
+   
+    <initialWindow>
+        <autoOrients>true</autoOrients>
+        <systemChrome>none</systemChrome>
+        <transparent>false</transparent>
+    </initialWindow>
+    
+    <!--  The category where the application appears. Either core.games or core.media. -->
+    <category>core.media</category>
+    <configuration name="Device-Debug">
+       <platformArchitecture>armle-v7</platformArchitecture>
+       <asset path="arm/o.le-v7-g/PjsuaBB" entry="true" type="Qnx/Elf">PjsuaBB</asset>
+    </configuration>
+    <configuration name="Device-Release">
+       <entryPointType>Qnx/Cascades</entryPointType>
+       <platformArchitecture>armle-v7</platformArchitecture>
+       <asset path="arm/o.le-v7/PjsuaBB.so" entry="true" type="Qnx/Elf">PjsuaBB.so</asset>
+    </configuration>
+    <configuration name="Device-Profile">
+       <platformArchitecture>armle-v7</platformArchitecture>
+       <asset path="arm-p/o.le-v7-g/PjsuaBB" entry="true" type="Qnx/Elf">PjsuaBB</asset>
+    </configuration>
+    <configuration name="Simulator-Debug">
+       <platformArchitecture>x86</platformArchitecture>
+       <asset path="x86/o-g/PjsuaBB" entry="true" type="Qnx/Elf">PjsuaBB</asset>
+    </configuration>
+    
+    <!--  The icon for the application -->
+    <icon>
+        <image>icon.png</image>
+    </icon>
+
+    <asset path="icon.png">icon.png</asset>
+    <asset path="assets">assets</asset>
+    
+    <!-- Locale support -->
+    
+    <!-- Request permission to execute native code.  Required for native applications. -->
+    <permission system="true">run_native</permission>
+    <permission>access_internet</permission>
+    <permission>record_audio</permission>
+    <permission>run_when_backgrounded</permission>
+    <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
+
+</qnx>
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/config.pri
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/config.pri	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/config.pri	(revision 4471)
@@ -0,0 +1,52 @@
+# Auto-generated by IDE. Any changes made by user will be lost!
+BASEDIR =  $$quote($$_PRO_FILE_PWD_)
+
+device {
+    CONFIG(debug, debug|release) {
+        SOURCES +=  $$quote($$BASEDIR/src/applicationui.cpp) \
+                 $$quote($$BASEDIR/src/main.cpp)
+
+        HEADERS +=  $$quote($$BASEDIR/src/applicationui.h)
+    }
+
+    CONFIG(release, debug|release) {
+        SOURCES +=  $$quote($$BASEDIR/src/applicationui.cpp) \
+                 $$quote($$BASEDIR/src/main.cpp)
+
+        HEADERS +=  $$quote($$BASEDIR/src/applicationui.h)
+    }
+}
+
+simulator {
+    CONFIG(debug, debug|release) {
+        SOURCES +=  $$quote($$BASEDIR/src/applicationui.cpp) \
+                 $$quote($$BASEDIR/src/main.cpp)
+
+        HEADERS +=  $$quote($$BASEDIR/src/applicationui.h)
+    }
+}
+
+INCLUDEPATH +=  $$quote($$BASEDIR/src)
+
+CONFIG += precompile_header
+
+PRECOMPILED_HEADER =  $$quote($$BASEDIR/precompiled.h)
+
+lupdate_inclusion {
+    SOURCES +=  $$quote($$BASEDIR/../src/*.c) \
+             $$quote($$BASEDIR/../src/*.c++) \
+             $$quote($$BASEDIR/../src/*.cc) \
+             $$quote($$BASEDIR/../src/*.cpp) \
+             $$quote($$BASEDIR/../src/*.cxx) \
+             $$quote($$BASEDIR/../assets/*.qml) \
+             $$quote($$BASEDIR/../assets/*.js) \
+             $$quote($$BASEDIR/../assets/*.qs)
+
+    HEADERS +=  $$quote($$BASEDIR/../src/*.h) \
+             $$quote($$BASEDIR/../src/*.h++) \
+             $$quote($$BASEDIR/../src/*.hh) \
+             $$quote($$BASEDIR/../src/*.hpp) \
+             $$quote($$BASEDIR/../src/*.hxx)
+}
+
+TRANSLATIONS =  $$quote($${TARGET}.ts)
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/precompiled.h
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/precompiled.h	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/precompiled.h	(revision 4471)
@@ -0,0 +1,2 @@
+// This file is used to store precompiled headers.
+// It is intentionally left blank. It is up to you to decide which headers should be included here. 
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/applicationui.cpp
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/applicationui.cpp	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/applicationui.cpp	(revision 4471)
@@ -0,0 +1,147 @@
+// Default empty project template
+#include "applicationui.h"
+
+#include <bb/cascades/Application>
+#include <bb/cascades/QmlDocument>
+#include <bb/cascades/AbstractPane>
+#include <bb/cascades/Label>
+
+#define THIS_FILE	"applicationui.cpp"
+
+using namespace bb::cascades;
+
+#include "../../pjsua_common.h"
+
+extern pj_cli_telnet_on_started on_started_cb;
+extern pj_cli_on_quit           on_quit_cb;
+
+extern "C" int main_func(int argc, char *argv[]);
+
+ApplicationUI *ApplicationUI::instance_;
+
+class CliThread : public QThread
+{
+    Q_OBJECT
+public:
+    virtual ~CliThread() {}
+protected:
+     void run();
+};
+
+static void bb10_show_msg(const char *msg)
+{
+    /* Qt's way to invoke method from "foreign" thread */
+    QMetaObject::invokeMethod((QObject*)ApplicationUI::instance(), "displayMsg",
+			      Qt::QueuedConnection,
+			      Q_ARG(QString,msg));
+}
+
+static void bb10_telnet_started(pj_cli_telnet_info *telnet_info)
+{
+    char msg[64];
+
+    pj_ansi_snprintf(msg, sizeof(msg),
+		     "Telnet to %.*s:%d",
+	    	     (int)telnet_info->ip_address.slen,
+	    	     telnet_info->ip_address.ptr,
+	    	     telnet_info->port);
+
+    PJ_LOG(3,(THIS_FILE, "Started: %s", msg));
+
+    bb10_show_msg(msg);
+}
+
+static void bb10_on_quit (pj_bool_t is_restarted)
+{
+    PJ_LOG(3,("ipjsua", "CLI quit, restart(%d)", is_restarted));
+    if (!is_restarted) {
+	bb10_show_msg("Shutting down..");
+	ApplicationUI::instance()->isShuttingDown = true;
+	bb::cascades::Application *app = bb::cascades::Application::instance();
+	app->quit();
+    }
+}
+
+void CliThread::run()
+{
+    // TODO: read from config?
+    char *argv[] = { (char*)"pjsuabb",
+		     (char*)"--use-cli",
+		     (char*)"--no-cli-console",
+		     (char*)"--cli-telnet-port=2323",
+		     (char*)"--dis-codec=*",
+		     (char*)"--add-codec=g722",
+		      NULL };
+    int argc = PJ_ARRAY_SIZE(argv) -1;
+    pj_thread_desc thread_desc;
+    pj_thread_t *thread;
+
+    pj_thread_register("CliThread", thread_desc, &thread);
+    // Wait UI to be created
+    pj_thread_sleep(100);
+
+    on_started_cb = &bb10_telnet_started;
+    on_quit_cb = &bb10_on_quit;
+    main_func(argc, argv);
+}
+
+ApplicationUI::ApplicationUI(bb::cascades::Application *app)
+: QObject(app), isShuttingDown(false)
+{
+    instance_ = this;
+
+    // create scene document from main.qml asset
+    // set parent to created document to ensure it exists for the whole application lifetime
+    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
+
+    // create root object for the UI
+    AbstractPane *root = qml->createRootObject<AbstractPane>();
+    // set created root object as a scene
+    app->setScene(root);
+
+    app->setAutoExit(true);
+    connect(app, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
+
+    pj_init();
+
+    // Run CLI
+    cliThread = new CliThread;
+    cliThread->start();
+}
+
+ApplicationUI::~ApplicationUI()
+{
+    pj_shutdown();
+    instance_ = NULL;
+}
+
+ApplicationUI* ApplicationUI::instance()
+{
+    return instance_;
+}
+
+void ApplicationUI::aboutToQuit()
+{
+    static pj_thread_desc thread_desc;
+    pj_thread_t *thread;
+
+    if (!pj_thread_is_registered())
+	pj_thread_register("UIThread", thread_desc, &thread);
+
+    if (!isShuttingDown) {
+	isShuttingDown = true;
+	PJ_LOG(3,(THIS_FILE, "Quit signal from GUI, shutting down pjsua.."));
+	pjsua_destroy();
+    }
+}
+
+void ApplicationUI::displayMsg(const QString &msg)
+{
+    bb::cascades::Application *app = bb::cascades::Application::instance();
+    Label *telnetMsg = app->scene()->findChild<Label*>("telnetMsg");
+    if (telnetMsg) {
+	telnetMsg->setText(msg);
+    }
+}
+
+#include "applicationui.moc"
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/applicationui.h
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/applicationui.h	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/applicationui.h	(revision 4471)
@@ -0,0 +1,37 @@
+// Default empty project template
+#ifndef ApplicationUI_HPP_
+#define ApplicationUI_HPP_
+
+#include <QObject>
+
+namespace bb { namespace cascades { class Application; }}
+
+class CliThread;
+
+/*!
+ * @brief Application pane object
+ *
+ *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
+ */
+class ApplicationUI : public QObject
+{
+    Q_OBJECT
+public:
+    ApplicationUI(bb::cascades::Application *app);
+    virtual ~ApplicationUI();
+
+    bool isShuttingDown;
+    static ApplicationUI *instance();
+
+public slots:
+    void aboutToQuit();
+
+    Q_INVOKABLE void displayMsg(const QString &msg);
+
+private:
+    CliThread *cliThread;
+    static ApplicationUI *instance_;
+};
+
+
+#endif /* ApplicationUI_HPP_ */
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/main.cpp
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/main.cpp	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/src/main.cpp	(revision 4471)
@@ -0,0 +1,32 @@
+// Default empty project template
+#include <bb/cascades/Application>
+
+#include <QLocale>
+#include <QTranslator>
+#include "applicationui.h"
+
+// include JS Debugger / CS Profiler enabler
+// this feature is enabled by default in the debug build only
+#include <Qt/qdeclarativedebug.h>
+
+using namespace bb::cascades;
+
+Q_DECL_EXPORT int main(int argc, char **argv)
+{
+    // this is where the server is started etc
+    Application app(argc, argv);
+
+    // localization support
+    QTranslator translator;
+    QString locale_string = QLocale().name();
+    QString filename = QString( "PjsuaBB_%1" ).arg( locale_string );
+    if (translator.load(filename, "app/native/qm")) {
+        app.installTranslator( &translator );
+    }
+
+    new ApplicationUI(&app);
+
+    // we complete the transaction started in the app constructor and start the client event loop here
+    return Application::exec();
+    // when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
+}
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/Makefile
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/Makefile	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/Makefile	(revision 4471)
@@ -0,0 +1,12 @@
+QMAKE_TARGET  = PjsuaBB
+LUPDATE       = $(QNX_HOST)/usr/bin/lupdate
+LRELEASE      = $(QNX_HOST)/usr/bin/lrelease
+
+update: $(QMAKE_TARGET).pro FORCE
+	$(LUPDATE) $(QMAKE_TARGET).pro
+
+release: $(QMAKE_TARGET).pro $(QMAKE_TARGET).ts
+	$(LRELEASE) $(QMAKE_TARGET).pro
+
+FORCE:
+
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/PjsuaBB.pro
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/PjsuaBB.pro	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/PjsuaBB.pro	(revision 4471)
@@ -0,0 +1,1 @@
+include (../PjsuaBB.pro)
Index: /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/PjsuaBB.ts
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/PjsuaBB.ts	(revision 4471)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/bb10/translations/PjsuaBB.ts	(revision 4471)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+    <name>main</name>
+    <message>
+        <location filename="../assets/main.qml" line="11"/>
+        <source></source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../assets/main.qml" line="23"/>
+        <source>pjsua BB10</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../assets/main.qml" line="32"/>
+        <source>Starting..</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+</TS>
