Index: /pjproject/trunk/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp	(revision 1259)
+++ /pjproject/trunk/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp	(revision 1260)
@@ -16,4 +16,65 @@
 static HWND	    hwndActionButton, hwndExitButton;
 
+
+
+//
+// Basic config.
+//
+#define SIP_PORT	5060
+
+
+//
+// Destination URI (to make call, or to subscribe presence)
+//
+#define SIP_DST_URI	"sip:192.168.0.7:5061"
+
+//
+// Account
+//
+#define HAS_SIP_ACCOUNT	0	// 0 to disable registration
+#define SIP_DOMAIN	"server"
+#define SIP_REALM	"server"
+#define SIP_USER	"user"
+#define SIP_PASSWD	"secret"
+
+//
+// Outbound proxy for all accounts
+//
+#define SIP_PROXY	NULL
+//#define SIP_PROXY	"sip:192.168.0.2;lr"
+
+
+//
+// Configure nameserver if DNS SRV is to be used with both SIP
+// or STUN (for STUN see other settings below)
+//
+#define NAMESERVER	NULL
+//#define NAMESERVER	"62.241.163.201"
+
+//
+// STUN server
+#if 0
+	// Use this to have the STUN server resolved normally
+#   define STUN_DOMAIN	NULL
+#   define STUN_SERVER	"stun.fwdnet.net"
+#elif 0
+	// Use this to have the STUN server resolved with DNS SRV
+#   define STUN_DOMAIN	"iptel.org"
+#   define STUN_SERVER	NULL
+#else
+	// Use this to disable STUN
+#   define STUN_DOMAIN	NULL
+#   define STUN_SERVER	NULL
+#endif
+
+//
+// Use ICE?
+//
+#define USE_ICE		1
+
+
+//
+// Globals
+//
 static pj_pool_t   *g_pool;
 static pj_str_t	    g_local_uri;
@@ -38,6 +99,4 @@
     ID_BTN_ACTION,
 };
-
-#define DEFAULT_URI	"sip:192.168.0.7"
 
 
@@ -144,5 +203,5 @@
 
 	g_current_call = PJSUA_INVALID_ID;
-	SetURI(DEFAULT_URI, -1);
+	SetURI(SIP_DST_URI, -1);
 	SetAction(ID_MENU_CALL);
 	//SetCallStatus(call_info.state_text.ptr, call_info.state_text.slen);
@@ -277,5 +336,6 @@
     pjsua_media_config_default(&media_cfg);
     pjsua_transport_config_default(&udp_cfg);
-    udp_cfg.port = 50060;
+    udp_cfg.port = SIP_PORT;
+
     pjsua_transport_config_default(&rtp_cfg);
     rtp_cfg.port = 40000;
@@ -293,4 +353,5 @@
     media_cfg.quality = 1;
     media_cfg.ptime = 20;
+    media_cfg.enable_ice = USE_ICE;
 
     /* Initialize application callbacks */
@@ -303,4 +364,21 @@
     cfg.cb.on_typing = &on_typing;
 
+    if (SIP_PROXY) {
+	    cfg.outbound_proxy_cnt = 1;
+	    cfg.outbound_proxy[0] = pj_str(SIP_PROXY);
+    }
+    
+    if (NAMESERVER) {
+	    cfg.nameserver_count = 1;
+	    cfg.nameserver[0] = pj_str(NAMESERVER);
+    }
+    
+    if (NAMESERVER && STUN_DOMAIN) {
+	    cfg.stun_domain = pj_str(STUN_DOMAIN);
+    } else if (STUN_SERVER) {
+	    cfg.stun_host = pj_str(STUN_SERVER);
+    }
+    
+    
     /* Initialize pjsua */
     status = pjsua_init(&cfg, &log_cfg, &media_cfg);
@@ -341,4 +419,36 @@
     pjsua_acc_add_local(transport_id, PJ_TRUE, &g_current_acc);
     pjsua_acc_set_online_status(g_current_acc, PJ_TRUE);
+
+    /* Add account */
+    if (HAS_SIP_ACCOUNT) {
+	pjsua_acc_config cfg;
+
+	pjsua_acc_config_default(&cfg);
+	cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);
+	cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);
+	cfg.cred_count = 1;
+	cfg.cred_info[0].realm = pj_str(SIP_REALM);
+	cfg.cred_info[0].scheme = pj_str("digest");
+	cfg.cred_info[0].username = pj_str(SIP_USER);
+	cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
+	cfg.cred_info[0].data = pj_str(SIP_PASSWD);
+
+	status = pjsua_acc_add(&cfg, PJ_TRUE, &g_current_acc);
+	if (status != PJ_SUCCESS) {
+	    pjsua_destroy();
+	    return PJ_FALSE;
+	}
+    }
+
+    /* Add buddy */
+    if (SIP_DST_URI) {
+    	pjsua_buddy_config bcfg;
+    
+    	pjsua_buddy_config_default(&bcfg);
+    	bcfg.uri = pj_str(SIP_DST_URI);
+    	bcfg.subscribe = PJ_FALSE;
+    	
+    	pjsua_buddy_add(&bcfg, NULL);
+    }
 
     /* Start pjsua */
@@ -535,5 +645,5 @@
     SetCallStatus("Ready", 5);
     SetAction(ID_MENU_CALL);
-    SetURI(DEFAULT_URI, -1);
+    SetURI(SIP_DST_URI, -1);
     SetFocus(hWnd);
 
