Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1044)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1098)
@@ -145,6 +145,5 @@
     puts  ("  --outbound=url      Set the URL of global outbound proxy server");
     puts  ("                      May be specified multiple times");
-    puts  ("  --use-stun1=FORMAT  where FORMAT=host[:port]");
-    puts  ("  --use-stun2=FORMAT  Resolve local IP with the specified STUN servers");
+    puts  ("  --stun-srv=name     Set STUN server host or domain");
     puts  ("");
     puts  ("TLS Options:");
@@ -160,4 +159,5 @@
     puts  ("");
     puts  ("Media Options:");
+    puts  ("  --use-ice           Enable ICE (default:no)");
     puts  ("  --add-codec=name    Manually add codec (default is to enable all)");
     puts  ("  --clock-rate=N      Override sound device clock rate");
@@ -326,8 +326,8 @@
 	   OPT_REGISTRAR, OPT_REG_TIMEOUT, OPT_PUBLISH, OPT_ID, OPT_CONTACT,
 	   OPT_REALM, OPT_USERNAME, OPT_PASSWORD,
-	   OPT_NAMESERVER, OPT_USE_STUN1, OPT_USE_STUN2, 
+	   OPT_NAMESERVER, OPT_STUN_SRV,
 	   OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE,
 	   OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP,
-	   OPT_AUTO_CONF, OPT_CLOCK_RATE,
+	   OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_USE_ICE,
 	   OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 
 	   OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC,
@@ -367,6 +367,5 @@
 	{ "password",	1, 0, OPT_PASSWORD},
 	{ "nameserver", 1, 0, OPT_NAMESERVER},
-	{ "use-stun1",  1, 0, OPT_USE_STUN1},
-	{ "use-stun2",  1, 0, OPT_USE_STUN2},
+	{ "stun-srv",   1, 0, OPT_STUN_SRV},
 	{ "add-buddy",  1, 0, OPT_ADD_BUDDY},
 	{ "offer-x-ms-msg",0,0,OPT_OFFER_X_MS_MSG},
@@ -382,4 +381,5 @@
 	{ "rec-file",   1, 0, OPT_REC_FILE},
 	{ "rtp-port",	1, 0, OPT_RTP_PORT},
+	{ "use-ice",    0, 0, OPT_USE_ICE},
 	{ "add-codec",  1, 0, OPT_ADD_CODEC},
 	{ "complexity",	1, 0, OPT_COMPLEXITY},
@@ -442,5 +442,4 @@
     pj_optind = 0;
     while((c=pj_getopt_long(argc,argv, "", long_options,&option_index))!=-1) {
-	char *p;
 	pj_str_t tmp;
 	long lval;
@@ -633,39 +632,6 @@
 	    break;
 
-	case OPT_USE_STUN1:   /* STUN server 1 */
-	    p = pj_ansi_strchr(pj_optarg, ':');
-	    if (p) {
-		*p = '\0';
-		cfg->udp_cfg.stun_config.stun_srv1 = pj_str(pj_optarg);
-		cfg->udp_cfg.stun_config.stun_port1 = pj_strtoul(pj_cstr(&tmp, p+1));
-		if (cfg->udp_cfg.stun_config.stun_port1 < 1 || cfg->udp_cfg.stun_config.stun_port1 > 65535) {
-		    PJ_LOG(1,(THIS_FILE, 
-			      "Error: expecting port number with "
-			      "option --use-stun1"));
-		    return PJ_EINVAL;
-		}
-	    } else {
-		cfg->udp_cfg.stun_config.stun_port1 = 3478;
-		cfg->udp_cfg.stun_config.stun_srv1 = pj_str(pj_optarg);
-	    }
-	    cfg->udp_cfg.use_stun = PJ_TRUE;
-	    break;
-
-	case OPT_USE_STUN2:   /* STUN server 2 */
-	    p = pj_ansi_strchr(pj_optarg, ':');
-	    if (p) {
-		*p = '\0';
-		cfg->udp_cfg.stun_config.stun_srv2 = pj_str(pj_optarg);
-		cfg->udp_cfg.stun_config.stun_port2 = pj_strtoul(pj_cstr(&tmp,p+1));
-		if (cfg->udp_cfg.stun_config.stun_port2 < 1 || cfg->udp_cfg.stun_config.stun_port2 > 65535) {
-		    PJ_LOG(1,(THIS_FILE, 
-			      "Error: expecting port number with "
-			      "option --use-stun2"));
-		    return PJ_EINVAL;
-		}
-	    } else {
-		cfg->udp_cfg.stun_config.stun_port2 = 3478;
-		cfg->udp_cfg.stun_config.stun_srv2 = pj_str(pj_optarg);
-	    }
+	case OPT_STUN_SRV:   /* STUN server */
+	    cfg->cfg.stun_srv = pj_str(pj_optarg);
 	    break;
 
@@ -727,4 +693,8 @@
 	case OPT_REC_FILE:
 	    cfg->rec_file = pj_str(pj_optarg);
+	    break;
+
+	case OPT_USE_ICE:
+	    cfg->media_cfg.enable_ice = PJ_TRUE;
 	    break;
 
@@ -1114,19 +1084,11 @@
 
     /* STUN */
-    if (config->udp_cfg.stun_config.stun_port1) {
-	pj_ansi_sprintf(line, "--use-stun1 %.*s:%d\n",
-			(int)config->udp_cfg.stun_config.stun_srv1.slen, 
-			config->udp_cfg.stun_config.stun_srv1.ptr, 
-			config->udp_cfg.stun_config.stun_port1);
+    if (config->cfg.stun_srv.slen) {
+	pj_ansi_sprintf(line, "--stun-srv %.*s\n",
+			(int)config->cfg.stun_srv.slen, 
+			config->cfg.stun_srv.ptr);
 	pj_strcat2(&cfg, line);
     }
 
-    if (config->udp_cfg.stun_config.stun_port2) {
-	pj_ansi_sprintf(line, "--use-stun2 %.*s:%d\n",
-			(int)config->udp_cfg.stun_config.stun_srv2.slen, 
-			config->udp_cfg.stun_config.stun_srv2.ptr, 
-			config->udp_cfg.stun_config.stun_port2);
-	pj_strcat2(&cfg, line);
-    }
 
     /* TLS */
@@ -1175,4 +1137,6 @@
 
     /* Media */
+    if (config->media_cfg.enable_ice)
+	pj_strcat2(&cfg, "--use-ice\n");
     if (config->null_audio)
 	pj_strcat2(&cfg, "--null-audio\n");
@@ -2963,9 +2927,4 @@
 	return status;
 
-    /* Copy udp_cfg STUN config to rtp_cfg */
-    app_config.rtp_cfg.use_stun = app_config.udp_cfg.use_stun;
-    app_config.rtp_cfg.stun_config = app_config.udp_cfg.stun_config;
-
-
     /* Initialize application callbacks */
     app_config.cfg.cb.on_call_state = &on_call_state;
