-- REWRITE OF PJSUA API --

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@503 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/pjsua/main.c b/pjsip-apps/src/pjsua/main.c
index b5774e7..7775687 100644
--- a/pjsip-apps/src/pjsua/main.c
+++ b/pjsip-apps/src/pjsua/main.c
@@ -17,62 +17,24 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
  */
 #include <pjsua-lib/pjsua.h>
-#include <pjsua-lib/pjsua_console_app.h>
-
 
 #define THIS_FILE	"main.c"
 
-/*****************************************************************************
- * main():
+
+/*
+ * These are defined in pjsua.c.
  */
+pj_status_t app_init(int argc, char *argv[]);
+pj_status_t app_main(void);
+pj_status_t app_destroy(void);
+
 int main(int argc, char *argv[])
 {
-    pjsua_config cfg;
-    pj_str_t uri_to_call = { NULL, 0 };
-
-    /* Init default settings. */
-    pjsua_default_config(&cfg);
-
-
-    /* Create PJLIB and memory pool */
-    pjsua_create();
-
-
-    /* Parse command line arguments: */
-    if (pjsua_parse_args(argc, argv, &cfg, &uri_to_call) != PJ_SUCCESS)
+    if (app_init(argc, argv) != PJ_SUCCESS)
 	return 1;
 
-
-    /* Init pjsua */
-    if (pjsua_init(&cfg, &console_callback) != PJ_SUCCESS)
-	return 1;
-
-
-    /* Start pjsua! */
-    if (pjsua_start() != PJ_SUCCESS) {
-	pjsua_destroy();
-	return 1;
-    }
-
-
-    /* Sleep for a while, let any messages get printed to console: */
-    pj_thread_sleep(500);
-
-
-    /* Start UI console main loop: */
-    pjsua_console_app_main(&uri_to_call);
-
-
-    /* Destroy pjsua: */
-    pjsua_destroy();
-
-    /* This is for internal testing, to make sure that pjsua_destroy()
-     * can be called multiple times. 
-     */
-    pjsua_destroy();
-
-
-    /* Exit... */
+    app_main();
+    app_destroy();
 
     return 0;
 }