echo command in pjsua can be used to print any text, and this is used to better synchronize stdout in Python test apps

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2069 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index 1a8f50b..264036e 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -2492,7 +2492,7 @@
     puts("|                              |  V  Adjust audio Volume  |  f  Save config   |");
     puts("|  S  Send arbitrary REQUEST   | Cp  Codec priorities     |  f  Save config   |");
     puts("+------------------------------+--------------------------+-------------------+");
-    puts("|  q  QUIT       sleep MS     echo [0|1]            n: detect NAT type        |");
+    puts("|  q  QUIT       sleep MS     echo [0|1|txt]        n: detect NAT type        |");
     puts("+=============================================================================+");
 
     i = pjsua_call_get_count();
@@ -3544,7 +3544,7 @@
 		    break;
 		}
 
-		cmd_echo = pj_strtoul(&tmp);
+		cmd_echo = *tmp.ptr != '0' || tmp.slen!=1;
 	    }
 	    break;
 
diff --git a/pjsip-apps/src/test-pjsua/run.py b/pjsip-apps/src/test-pjsua/run.py
index e525bac..c1947ef 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -54,6 +54,7 @@
 	rh = re.compile(const.DESTROYED)
 	ra = re.compile(const.ASSERT, re.I)
 	rr = re.compile(const.STDOUT_REFRESH)
+	t0 = time.time()
 	def __init__(self, inst_param):
 		self.inst_param = inst_param
 		self.name = inst_param.name
@@ -98,15 +99,18 @@
 
 	def sync_stdout(self):
 		self.trace("sync_stdout")
-		self.send("echo 1")
-		self.expect("echo 1")
+		cmd = "echo 1" + str(random.randint(1000,9999))
+		self.send(cmd)
+		self.expect(cmd)
 
 	def wait(self):
 		self.trace("wait")
 		self.proc.wait()
 	def trace(self, s):
 		if self.trace_enabled:
-			print self.name + ": " + "====== " + s + " ======"
+			now = time.time()
+			fmt = self.name + ": " + "================== " + s + " ==================" + " [at t=%(time)03d]"
+			print fmt % {'time':int(now - self.t0)}
 
 #########################
 # Error handling