Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py	(revision 2058)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py	(revision 2059)
@@ -56,5 +56,5 @@
 		self.have_reg = have_reg
 		self.have_publish = have_publish
-		if not ("--publish" in self.arg):
+		if have_publish and have_reg and not ("--publish" in self.arg):
 			self.arg = self.arg + " --publish"
 		self.echo_enabled = echo_enabled
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_call.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_call.py	(revision 2058)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_call.py	(revision 2059)
@@ -4,7 +4,17 @@
 import sys
 import inc_const as const
+from inc_cfg import *
 
 # Load configuration
 cfg_file = imp.load_source("cfg_file", sys.argv[2])
+
+# Check media flow between ua1 and ua2
+def check_media(ua1, ua2):
+	ua1.send("#")
+	ua1.send("1122")
+	ua2.expect(const.RX_DTMF + "1")
+	ua2.expect(const.RX_DTMF + "1")
+	ua2.expect(const.RX_DTMF + "2")
+	ua2.expect(const.RX_DTMF + "2")
 
 
@@ -14,4 +24,11 @@
 	caller = t.process[1]
 
+	# if have_reg then wait for couple of seconds for PUBLISH
+	# to complete (just in case pUBLISH is used)
+	if callee.inst_param.have_reg:
+		time.sleep(1)
+	if caller.inst_param.have_reg:
+		time.sleep(1)
+
 	# Caller making call
 	caller.send("m")
@@ -19,7 +36,17 @@
 	caller.expect(const.STATE_CALLING)
 	
-	# Callee answers with 200/OK
+	# Callee waits for call and answers with 180/Ringing
 	time.sleep(1)
 	callee.expect(const.EVENT_INCOMING_CALL)
+	callee.send("a")
+	callee.send("180")
+	callee.expect("SIP/2.0 180")
+	caller.expect("SIP/2.0 180")
+
+	# Synchronize stdout
+	caller.sync_stdout()
+	callee.sync_stdout()
+
+	# Callee answers with 200/OK
 	callee.send("a")
 	callee.send("200")
@@ -27,97 +54,111 @@
 	# Wait until call is connected in both endpoints
 	time.sleep(1)
-	if callee.expect(const.STATE_CONFIRMED, False)==None:
-		raise TestError("Call failed")
 	caller.expect(const.STATE_CONFIRMED)
+	callee.expect(const.STATE_CONFIRMED)
 
 	# Synchronize stdout
-	caller.send("echo 1")
-	caller.expect("echo 1")
-	callee.send("echo 1")
-	callee.expect("echo 1")
+	caller.sync_stdout()
+	callee.sync_stdout()
+	time.sleep(1)
+	caller.sync_stdout()
+	callee.sync_stdout()
 
-	# Test that media is okay (with RFC 2833 DTMF)
+	# Test that media is okay
 	time.sleep(2)
-	caller.send("#")
-	caller.send("1122")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "2")
-	callee.expect(const.RX_DTMF + "2")
+	check_media(caller, callee)
+	check_media(callee, caller)
 
-	# Hold call
+	# Hold call by caller
 	caller.send("H")
+	caller.sync_stdout()
 	caller.expect(const.MEDIA_HOLD)
 	callee.expect(const.MEDIA_HOLD)
 	
+	# Synchronize stdout
+	caller.sync_stdout()
+	callee.sync_stdout()
+
 	# Release hold
 	time.sleep(2)
 	caller.send("v")
+	caller.sync_stdout()
+	callee.expect(const.MEDIA_ACTIVE)
+	caller.expect(const.MEDIA_ACTIVE)
+
+	# Synchronize stdout
+	caller.sync_stdout()
+	callee.sync_stdout()
+
+	# Test that media is okay
+	check_media(caller, callee)
+	check_media(callee, caller)
+
+	# Synchronize stdout
+	caller.sync_stdout()
+	callee.sync_stdout()
+
+	# Hold call by callee
+	callee.send("H")
+	callee.sync_stdout()
+	caller.expect(const.MEDIA_HOLD)
+	callee.expect(const.MEDIA_HOLD)
+	
+	# Synchronize stdout
+	caller.sync_stdout()
+	callee.sync_stdout()
+
+	# Release hold
+	time.sleep(2)
+	callee.send("v")
+	callee.sync_stdout()
 	caller.expect(const.MEDIA_ACTIVE)
 	callee.expect(const.MEDIA_ACTIVE)
 
 	# Synchronize stdout
-	caller.send("echo 1")
-	caller.expect("echo 1")
-	callee.send("echo 1")
-	callee.expect("echo 1")
+	caller.sync_stdout()
+	callee.sync_stdout()
 
-	# Test that media is okay (with RFC 2833 DTMF)
-	caller.send("#")
-	caller.send("1122")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "2")
-	callee.expect(const.RX_DTMF + "2")
+	# Test that media is okay
+	check_media(caller, callee)
+	check_media(callee, caller)
 
 	# Synchronize stdout
-	caller.send("echo 1")
-	caller.expect("echo 1")
-	callee.send("echo 1")
-	callee.expect("echo 1")
+	caller.sync_stdout()
+	callee.sync_stdout()
 
 	# UPDATE (by caller)
 	caller.send("U")
+	caller.sync_stdout()
+	callee.expect(const.MEDIA_ACTIVE)
+	caller.expect(const.MEDIA_ACTIVE)
+	
+	# Synchronize stdout
+	caller.sync_stdout()
+	callee.sync_stdout()
+
+	# Test that media is okay
+	time.sleep(2)
+	check_media(caller, callee)
+	check_media(callee, caller)
+
+	# UPDATE (by callee)
+	callee.send("U")
+	callee.sync_stdout()
 	caller.expect(const.MEDIA_ACTIVE)
 	callee.expect(const.MEDIA_ACTIVE)
 	
 	# Synchronize stdout
-	caller.send("echo 1")
-	caller.expect("echo 1")
-	callee.send("echo 1")
-	callee.expect("echo 1")
+	caller.sync_stdout()
+	callee.sync_stdout()
 
-	# Test that media is okay (with RFC 2833 DTMF)
+	# Test that media is okay
 	time.sleep(2)
-	caller.send("#")
-	caller.send("1122")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "2")
-	callee.expect(const.RX_DTMF + "2")
-
-	# UPDATE (by callee)
-	callee.send("U")
-	callee.expect(const.MEDIA_ACTIVE)
-	caller.expect(const.MEDIA_ACTIVE)
-	
-	# Synchronize stdout
-	caller.send("echo 1")
-	caller.expect("echo 1")
-	callee.send("echo 1")
-	callee.expect("echo 1")
-
-	# Test that media is okay (with RFC 2833 DTMF)
-	time.sleep(2)
-	caller.send("#")
-	caller.send("1122")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "1")
-	callee.expect(const.RX_DTMF + "2")
-	callee.expect(const.RX_DTMF + "2")
+	check_media(caller, callee)
+	check_media(callee, caller)
 
 	# Hangup call
 	time.sleep(1)
 	caller.send("h")
+	caller.sync_stdout()
 
 	# Wait until calls are cleared in both endpoints
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py	(revision 2058)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py	(revision 2059)
@@ -14,4 +14,5 @@
 		   "pyc",
 		   "scripts-call/150_srtp_2_1",				# SRTP optional 'cannot' call SRTP mandatory
+		   "scripts-call/301_ice_public_b.py",			# Doesn't work because OpenSER modifies SDP
 		   "scripts-media-playrec/100_resample_lf_8_11.py",	# related to clock-rate 11 kHz problem
 		   "scripts-media-playrec/100_resample_lf_8_22.py",	# related to clock-rate 22 kHz problem
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_a.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_a.py	(revision 2059)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_a.py	(revision 2059)
@@ -0,0 +1,22 @@
+# $Id:$
+#
+from inc_cfg import *
+
+# Note:
+#	- need --dis-codec to make INVITE packet less than typical MTU
+uas_args = "--null-audio --id=\"<sip:test1@pjsip.org>\" --registrar=sip:sip.pjsip.org --username=test1 --password=test1  --realm=pjsip.org  --proxy=\"sip:sip.pjsip.org;lr\"  --rtp-port 0 --stun-srv stun.pjsip.org  --use-ice --use-compact-form --max-calls 1 --dis-codec=i --dis-codec=s --dis-codec=g"
+
+uac_args = "--null-audio --id=\"<sip:test2@pjsip.org>\" --registrar=sip:sip.pjsip.org --username=test2 --password=test2 --realm=pjsip.org --proxy=\"sip:sip.pjsip.org;lr\" --rtp-port 0 --stun-srv stun.pjsip.org --use-ice --use-compact-form --max-calls 1 --dis-codec=i --dis-codec=s --dis-codec=g"
+
+test_param = TestParam(
+		"ICE via public internet",
+		[
+			InstanceParam(	"callee", uas_args, 
+					uri="<sip:test1@pjsip.org>",
+					have_reg=True, have_publish=False),
+			InstanceParam(	"caller", uac_args,
+					uri="<sip:test2@pjsip.org>",
+					have_reg=True, have_publish=False),
+		]
+		)
+
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_b.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_b.py	(revision 2059)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_b.py	(revision 2059)
@@ -0,0 +1,25 @@
+# $Id:$
+#
+from inc_cfg import *
+
+# This test:
+#   to make call with ICE but without STUN.
+
+# Note:
+#	- need --dis-codec to make INVITE packet less than typical MTU
+uas_args = "--null-audio --id=\"<sip:test1@pjsip.org>\" --registrar=sip:sip.pjsip.org --username=test1 --password=test1  --realm=pjsip.org  --proxy=\"sip:sip.pjsip.org;lr\"  --rtp-port 0 --use-ice --use-compact-form --max-calls 1 --dis-codec=i --dis-codec=s --dis-codec=g --log-file callee.log"
+
+uac_args = "--null-audio --id=\"<sip:test2@pjsip.org>\" --registrar=sip:sip.pjsip.org --username=test2 --password=test2 --realm=pjsip.org --proxy=\"sip:sip.pjsip.org;lr\" --rtp-port 0 --use-ice --use-compact-form --max-calls 1 --dis-codec=i --dis-codec=s --dis-codec=g --log-file caller.log"
+
+test_param = TestParam(
+		"ICE via public internet with no STUN",
+		[
+			InstanceParam(	"callee", uas_args, 
+					uri="<sip:test1@pjsip.org>",
+					have_reg=True, have_publish=False),
+			InstanceParam(	"caller", uac_args,
+					uri="<sip:test2@pjsip.org>",
+					have_reg=True, have_publish=False),
+		]
+		)
+
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/350_prack_a.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/350_prack_a.py	(revision 2059)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/350_prack_a.py	(revision 2059)
@@ -0,0 +1,12 @@
+# $Id:$
+#
+from inc_cfg import *
+
+# TCP call
+test_param = TestParam(
+		"Callee requires PRACK",
+		[
+			InstanceParam("callee", "--null-audio --max-calls=1 --use-100rel"),
+			InstanceParam("caller", "--null-audio --max-calls=1")
+		]
+		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/350_prack_b.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/350_prack_b.py	(revision 2059)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/350_prack_b.py	(revision 2059)
@@ -0,0 +1,12 @@
+# $Id:$
+#
+from inc_cfg import *
+
+# TCP call
+test_param = TestParam(
+		"Caller requires PRACK",
+		[
+			InstanceParam("callee", "--null-audio --max-calls=1"),
+			InstanceParam("caller", "--null-audio --max-calls=1 --use-100rel")
+		]
+		)
