Integration of Sipit24 branch, many tickets involved:
 - #793: AMR encoder should regard 'mode-set' param specified by remote decoder.
 - #831: Automatically switch to TCP transport when sending large request
 - #832: Support for outbound proxy setting without using Route header
 - #849: Modify conference audio switch behavior in connecting ports.
 - #850: Remove 'Require=replaces' param in 'Refer-To' header (in call transfer with replaces).
 - #851: Support for regular nomination in ICE
 - #852: --ip-addr support for IPv6 for media transport in pjsua
 - #854: Adding SOFTWARE attribute in all outgoing requests may cause compatibility problem with older STUN server (thanks Alexei Kuznetsov for the report)
 - #855: Bug in digit map frequencies for DTMF digits (thanks FCCH for the report)
 - #856: Put back the ICE candidate priority values according to the default values in the draft-mmusic-ice
 - #857: Support for ICE keep-alive with Binding indication
 - #858: Do not authenticate STUN 438 response
 - #859: AMR-WB format param in the SDP is not negotiated correctly.
 - #867: Return error instead of asserting when PJSUA-LIB fails to open log file




git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2724 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/samples/debug.c b/pjsip-apps/src/samples/debug.c
index 1a145b9..5417a79 100644
--- a/pjsip-apps/src/samples/debug.c
+++ b/pjsip-apps/src/samples/debug.c
@@ -28,5 +28,5 @@
  * E.g.:
  *  #include "playfile.c"
  */
-#include "auddemo.c"
+#include "icedemo.c"
 
diff --git a/pjsip-apps/src/samples/icedemo.c b/pjsip-apps/src/samples/icedemo.c
index 1c13cf3..f3f7c6c 100644
--- a/pjsip-apps/src/samples/icedemo.c
+++ b/pjsip-apps/src/samples/icedemo.c
@@ -39,7 +39,8 @@
     {
 	unsigned    comp_cnt;
 	pj_str_t    ns;
-	pj_bool_t   no_host;
+	int	    max_host;
+	pj_bool_t   regular;
 	pj_str_t    stun_srv;
 	pj_str_t    turn_srv;
 	pj_bool_t   turn_tcp;
@@ -306,8 +307,15 @@
 
     /* -= Start initializing ICE stream transport config =- */
 
-    /* Disable host candidates? */
-    icedemo.ice_cfg.stun.no_host_cands = icedemo.opt.no_host;
+    /* Maximum number of host candidates */
+    if (icedemo.opt.max_host != -1)
+	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) {
@@ -960,7 +968,7 @@
     }
     */
 
-    if (comp_id > pj_ice_strans_get_running_comp_cnt(icedemo.icest)) {
+    if (comp_id<1||comp_id>pj_ice_strans_get_running_comp_cnt(icedemo.icest)) {
 	PJ_LOG(1,(THIS_FILE, "Error: invalid component ID"));
 	return;
     }
@@ -1137,7 +1145,8 @@
     puts(" --comp-cnt, -c N          Component count (default=1)");
     puts(" --nameserver, -n IP       Configure nameserver to activate DNS SRV");
     puts("                           resolution");
-    puts(" --no-host, -H             Disable host candidates");
+    puts(" --max-host, -H N          Set max number of host candidates to N");
+    puts(" --regular, -R             Use regular nomination (default aggressive)");
     puts(" --help, -h                Display this screen.");
     puts("");
     puts("STUN related options:");
@@ -1165,21 +1174,23 @@
     struct pj_getopt_option long_options[] = {
 	{ "comp-cnt",           1, 0, 'c'},
 	{ "nameserver",		1, 0, 'n'},
-	{ "no-host",		0, 0, 'H'},
+	{ "max-host",		1, 0, 'H'},
 	{ "help",		0, 0, 'h'},
 	{ "stun-srv",		1, 0, 's'},
 	{ "turn-srv",		1, 0, 't'},
 	{ "turn-tcp",		0, 0, 'T'},
 	{ "turn-username",	1, 0, 'u'},
 	{ "turn-password",	1, 0, 'p'},
-	{ "turn-fingerprint",	0, 0, 'F'}
+	{ "turn-fingerprint",	0, 0, 'F'},
+	{ "regular",		0, 0, 'R'}
     };
     int c, opt_id;
     pj_status_t status;
 
     icedemo.opt.comp_cnt = 1;
+    icedemo.opt.max_host = -1;
 
-    while((c=pj_getopt_long(argc,argv, "n:s:t:u:p:HhTF", long_options, &opt_id))!=-1) {
+    while((c=pj_getopt_long(argc,argv, "c:n:s:t:u:p:H:hTFR", long_options, &opt_id))!=-1) {
 	switch (c) {
 	case 'c':
 	    icedemo.opt.comp_cnt = atoi(pj_optarg);
@@ -1192,7 +1203,7 @@
 	    icedemo.opt.ns = pj_str(pj_optarg);
 	    break;
 	case 'H':
-	    icedemo.opt.no_host = PJ_TRUE;
+	    icedemo.opt.max_host = atoi(pj_optarg);
 	    break;
 	case 'h':
 	    icedemo_usage();
@@ -1215,6 +1226,9 @@
 	case 'F':
 	    icedemo.opt.turn_fingerprint = PJ_TRUE;
 	    break;
+	case 'R':
+	    icedemo.opt.regular = PJ_TRUE;
+	    break;
 	default:
 	    printf("Argument \"%s\" is not valid. Use -h to see help",
 		   argv[pj_optind]);
diff --git a/pjsip-apps/src/samples/siprtp_report.c b/pjsip-apps/src/samples/siprtp_report.c
index e63ef94..84c0072 100644
--- a/pjsip-apps/src/samples/siprtp_report.c
+++ b/pjsip-apps/src/samples/siprtp_report.c
@@ -77,7 +77,7 @@
 
     /* Call identification */
     len = pjsip_hdr_print_on(dlg->remote.info, userinfo, sizeof(userinfo));
-    if (len < 1)
+    if (len < 0)
 	pj_ansi_strcpy(userinfo, "<--uri too long-->");
     else
 	userinfo[len] = '\0';