Index: pjproject/branches/projects/sipit24/pjnath/include/pjnath/ice_strans.h
===================================================================
--- pjproject/branches/projects/sipit24/pjnath/include/pjnath/ice_strans.h	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjnath/include/pjnath/ice_strans.h	(revision 2707)
@@ -198,4 +198,11 @@
 
     /**
+     * This contains various STUN session options. Once the ICE stream
+     * transport is created, application may also change the options
+     * with #pj_ice_strans_set_options().
+     */
+    pj_ice_sess_options	 opt;
+
+    /**
      * STUN and local transport settings. This specifies the 
      * settings for local UDP socket, which will be resolved
Index: pjproject/branches/projects/sipit24/pjnath/src/pjnath/ice_session.c
===================================================================
--- pjproject/branches/projects/sipit24/pjnath/src/pjnath/ice_session.c	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjnath/src/pjnath/ice_session.c	(revision 2707)
@@ -438,4 +438,6 @@
     PJ_ASSERT_RETURN(ice && opt, PJ_EINVAL);
     pj_memcpy(&ice->opt, opt, sizeof(*opt));
+    LOG5((ice->obj_name, "ICE nomination type set to %s",
+	  (ice->opt.aggressive ? "aggressive" : "regular")));
     return PJ_SUCCESS;
 }
@@ -1410,5 +1412,5 @@
 	     * flag set.
 	     */
-	    LOG5((ice->obj_name, 
+	    LOG4((ice->obj_name, 
 		  "All checks have completed, starting nominated checks now"));
 	    start_nominated_check(ice);
@@ -1440,5 +1442,5 @@
 	}
 
-	LOG5((ice->obj_name, 
+	LOG4((ice->obj_name, 
 	      "Scheduling nominated check in %d ms",
 	      ice->opt.nominated_check_delay));
Index: pjproject/branches/projects/sipit24/pjnath/src/pjnath/ice_strans.c
===================================================================
--- pjproject/branches/projects/sipit24/pjnath/src/pjnath/ice_strans.c	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjnath/src/pjnath/ice_strans.c	(revision 2707)
@@ -159,5 +159,4 @@
     pj_ice_strans_cb	     cb;	/**< Application callback.	*/
     pj_lock_t		    *init_lock; /**< Initialization mutex.	*/
-    pj_ice_sess_options	     opt;	/**< ICE session options	*/
 
     pj_ice_sess		    *ice;	/**< ICE session.		*/
@@ -198,4 +197,6 @@
     pj_stun_sock_cfg_default(&cfg->stun.cfg);
     pj_turn_alloc_param_default(&cfg->turn.alloc_param);
+
+    pj_ice_sess_options_default(&cfg->opt);
 
     cfg->af = pj_AF_INET();
@@ -449,6 +450,4 @@
     ice_st->obj_name = pool->obj_name;
     ice_st->user_data = user_data;
-
-    pj_ice_sess_options_default(&ice_st->opt);
 
     PJ_LOG(4,(ice_st->obj_name, 
@@ -661,5 +660,5 @@
 {
     PJ_ASSERT_RETURN(ice_st && opt, PJ_EINVAL);
-    pj_memcpy(opt, &ice_st->opt, sizeof(*opt));
+    pj_memcpy(opt, &ice_st->cfg.opt, sizeof(*opt));
     return PJ_SUCCESS;
 }
@@ -672,7 +671,7 @@
 {
     PJ_ASSERT_RETURN(ice_st && opt, PJ_EINVAL);
-    pj_memcpy(&ice_st->opt, opt, sizeof(*opt));
+    pj_memcpy(&ice_st->cfg.opt, opt, sizeof(*opt));
     if (ice_st->ice)
-	pj_ice_sess_set_options(ice_st->ice, &ice_st->opt);
+	pj_ice_sess_set_options(ice_st->ice, &ice_st->cfg.opt);
     return PJ_SUCCESS;
 }
@@ -715,5 +714,5 @@
 
     /* Set options */
-    pj_ice_sess_set_options(ice_st->ice, &ice_st->opt);
+    pj_ice_sess_set_options(ice_st->ice, &ice_st->cfg.opt);
 
     /* If default candidate for components are SRFLX one, upload a custom
Index: pjproject/branches/projects/sipit24/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- pjproject/branches/projects/sipit24/pjsip-apps/src/pjsua/pjsua_app.c	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjsip-apps/src/pjsua/pjsua_app.c	(revision 2707)
@@ -265,5 +265,6 @@
     puts  ("Media Transport Options:");
     puts  ("  --use-ice           Enable ICE (default:no)");
-    puts  ("  --ice-no-host       Disable ICE host candidates (default: no)");
+    puts  ("  --ice-regular       Use ICE regular nomination (default: aggressive)");
+    puts  ("  --ice-max-hosts=N   Set maximum number of ICE host candidates");
     puts  ("  --ice-no-rtcp       Disable RTCP component in ICE (default: no)");
     puts  ("  --rtp-port=N        Base port to try for RTP (default=4000)");
@@ -477,6 +478,6 @@
 	   OPT_AUTO_ANSWER, OPT_AUTO_PLAY, OPT_AUTO_PLAY_HANGUP, OPT_AUTO_LOOP,
 	   OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_SND_CLOCK_RATE, OPT_STEREO,
-	   OPT_USE_ICE, OPT_USE_SRTP, OPT_SRTP_SECURE,
-	   OPT_USE_TURN, OPT_ICE_NO_HOST, OPT_ICE_NO_RTCP, OPT_TURN_SRV, 
+	   OPT_USE_ICE, OPT_ICE_REGULAR, OPT_USE_SRTP, OPT_SRTP_SECURE,
+	   OPT_USE_TURN, OPT_ICE_MAX_HOSTS, OPT_ICE_NO_RTCP, OPT_TURN_SRV, 
 	   OPT_TURN_TCP, OPT_TURN_USER, OPT_TURN_PASSWD,
 	   OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 
@@ -554,6 +555,7 @@
 
 	{ "use-ice",    0, 0, OPT_USE_ICE},
+	{ "ice-regular",0, 0, OPT_ICE_REGULAR},
 	{ "use-turn",	0, 0, OPT_USE_TURN},
-	{ "ice-no-host",0, 0, OPT_ICE_NO_HOST},
+	{ "ice-max-hosts",1, 0, OPT_ICE_MAX_HOSTS},
 	{ "ice-no-rtcp",0, 0, OPT_ICE_NO_RTCP},
 	{ "turn-srv",	1, 0, OPT_TURN_SRV},
@@ -993,10 +995,14 @@
 	    break;
 
+	case OPT_ICE_REGULAR:
+	    cfg->media_cfg.ice_opt.aggressive = PJ_FALSE;
+	    break;
+
 	case OPT_USE_TURN:
 	    cfg->media_cfg.enable_turn = PJ_TRUE;
 	    break;
 
-	case OPT_ICE_NO_HOST:
-	    cfg->media_cfg.ice_no_host_cands = PJ_TRUE;
+	case OPT_ICE_MAX_HOSTS:
+	    cfg->media_cfg.ice_max_host_cands = my_atoi(pj_optarg);
 	    break;
 
@@ -1645,9 +1651,15 @@
 	pj_strcat2(&cfg, "--use-ice\n");
 
+    if (config->media_cfg.ice_opt.aggressive == PJ_FALSE)
+	pj_strcat2(&cfg, "--ice-regular\n");
+
     if (config->media_cfg.enable_turn)
 	pj_strcat2(&cfg, "--use-turn\n");
 
-    if (config->media_cfg.ice_no_host_cands)
-	pj_strcat2(&cfg, "--ice-no-host\n");
+    if (config->media_cfg.ice_max_host_cands >= 0) {
+	pj_ansi_sprintf(line, "--ice_max_host_cands %d\n",
+			config->media_cfg.ice_max_host_cands);
+	pj_strcat2(&cfg, line);
+    }
 
     if (config->media_cfg.ice_no_rtcp)
@@ -1886,5 +1898,5 @@
     }
 
-    if (config->cfg.force_lr) {
+    if (!config->cfg.force_lr) {
 	pj_strcat2(&cfg, "--no-force-lr\n");
     }
Index: pjproject/branches/projects/sipit24/pjsip-apps/src/samples/debug.c
===================================================================
--- pjproject/branches/projects/sipit24/pjsip-apps/src/samples/debug.c	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjsip-apps/src/samples/debug.c	(revision 2707)
@@ -29,4 +29,4 @@
  *  #include "playfile.c"
  */
-#include "auddemo.c"
+#include "icedemo.c"
 
Index: pjproject/branches/projects/sipit24/pjsip-apps/src/samples/icedemo.c
===================================================================
--- pjproject/branches/projects/sipit24/pjsip-apps/src/samples/icedemo.c	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjsip-apps/src/samples/icedemo.c	(revision 2707)
@@ -312,4 +312,10 @@
 	icedemo.ice_cfg.stun.max_host_cands = icedemo.opt.max_host;
 
+    /* Nomination strategy */
+    if (icedemo.opt.regular)
+	icedemo.ice_cfg.opt.aggressive = PJ_FALSE;
+    else
+	icedemo.ice_cfg.opt.aggressive = PJ_TRUE;
+
     /* Configure STUN/srflx candidate resolution */
     if (icedemo.opt.stun_srv.slen) {
@@ -377,5 +383,4 @@
 {
     pj_ice_strans_cb icecb;
-    pj_ice_sess_options opt;
     pj_status_t status;
 
@@ -402,15 +407,4 @@
     else
 	PJ_LOG(3,(THIS_FILE, "ICE instance successfully created"));
-
-    status = pj_ice_strans_get_options(icedemo.icest, &opt);
-    pj_assert(status == PJ_SUCCESS);
-
-    if (icedemo.opt.regular)
-	opt.aggressive = PJ_FALSE;
-    else
-	opt.aggressive = PJ_TRUE;
-
-    status = pj_ice_strans_set_options(icedemo.icest, &opt);
-    pj_assert(status == PJ_SUCCESS);
 }
 
Index: pjproject/branches/projects/sipit24/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- pjproject/branches/projects/sipit24/pjsip/include/pjsua-lib/pjsua.h	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjsip/include/pjsua-lib/pjsua.h	(revision 2707)
@@ -4261,7 +4261,14 @@
 
     /**
-     * Disable ICE host candidates.
-     */
-    pj_bool_t		ice_no_host_cands;
+     * Set the maximum number of host candidates.
+     *
+     * Default: -1 (maximum not set)
+     */
+    int			ice_max_host_cands;
+
+    /**
+     * ICE session options.
+     */
+    pj_ice_sess_options	ice_opt;
 
     /**
Index: pjproject/branches/projects/sipit24/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- pjproject/branches/projects/sipit24/pjsip/src/pjsua-lib/pjsua_core.c	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjsip/src/pjsua-lib/pjsua_core.c	(revision 2707)
@@ -182,4 +182,7 @@
     cfg->jb_init = cfg->jb_min_pre = cfg->jb_max_pre = cfg->jb_max = -1;
     cfg->snd_auto_close_time = 1;
+
+    cfg->ice_max_host_cands = -1;
+    pj_ice_sess_options_default(&cfg->ice_opt);
 
     cfg->turn_conn_type = PJ_TURN_TP_UDP;
Index: pjproject/branches/projects/sipit24/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- pjproject/branches/projects/sipit24/pjsip/src/pjsua-lib/pjsua_media.c	(revision 2706)
+++ pjproject/branches/projects/sipit24/pjsip/src/pjsua-lib/pjsua_media.c	(revision 2707)
@@ -811,6 +811,6 @@
 	ice_cfg.stun.port = pj_sockaddr_get_port(&pjsua_var.stun_srv);
     }
-    if (pjsua_var.media_cfg.ice_no_host_cands)
-	ice_cfg.stun.max_host_cands = 0;
+    if (pjsua_var.media_cfg.ice_max_host_cands >= 0)
+	ice_cfg.stun.max_host_cands = pjsua_var.media_cfg.ice_max_host_cands;
 
     /* Configure TURN settings */
