Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py	(revision 2025)
@@ -1,9 +1,13 @@
 # $Id:$
+import random
 
 DEFAULT_ECHO = True
 DEFAULT_TRACE = True
+DEFAULT_START_SIP_PORT = 50000
 
-# Individual pjsua config class
-class Config:
+# Individual pjsua instance configuration class
+class InstanceParam:
+	# Name to identify this pjsua instance (e.g. "caller", "callee", etc.)
+	name = ""
 	# pjsua command line arguments, concatenated in string
 	arg = ""
@@ -12,16 +16,68 @@
 	# Enable/disable test tracing
 	trace_enabled = DEFAULT_TRACE
-	def __init__(self, arg, echo_enabled=DEFAULT_ECHO, trace_enabled=DEFAULT_TRACE):
-		self.arg = arg
+	# SIP URI to send request to this instance
+	uri = ""
+	# SIP port number, zero to automatically assign
+	sip_port = 0
+	# Does this have registration? If yes then the test function will
+	# wait until the UA is registered before doing anything else
+	have_reg = False
+	# Does this have PUBLISH?
+	have_publish = False
+	def __init__(	self, 
+			name,			# Instance name
+			arg, 			# Cmd-line arguments
+			uri="", 		# URI
+			uri_param="",		# Additional URI param
+			sip_port=0, 		# SIP port
+			have_reg=False,		# Have registration?
+			have_publish=False,	# Have publish?
+			echo_enabled=DEFAULT_ECHO, 
+			trace_enabled=DEFAULT_TRACE):
+		# Instance name
+		self.name = name
+		# Give random sip_port if it's not specified
+		if sip_port==0:
+			self.sip_port = random.randint(DEFAULT_START_SIP_PORT, 65534)
+		else:
+			self.sip_port = sip_port
+		# Autogenerate URI if it's empty.
+		self.uri = uri
+		if self.uri=="":
+			self.uri = "sip:pjsip@127.0.0.1:" + str(self.sip_port)
+		# Add uri_param to the URI
+		self.uri = self.uri + uri_param
+		# Add bracket to the URI
+		if self.uri[0] != "<":
+			self.uri = "<" + self.uri + ">"
+		# Add SIP local port to the argument
+		self.arg = arg + " --local-port=" + str(self.sip_port)
+		self.have_reg = have_reg
+		self.have_publish = have_publish
+		if not ("--publish" in self.arg):
+			self.arg = self.arg + " --publish"
 		self.echo_enabled = echo_enabled
 		self.trace_enabled = trace_enabled
 
-# Call config class
-class CallConfig:
-	# additional parameter to be added to target URI
-	uri_param = ""
-	def __init__(self, title, callee_cfg, caller_cfg):
+
+############################################
+# Test parameter class
+class TestParam:
+	title = ""
+	# params is list containing InstanceParams objects
+	inst_params = []
+	# list of Expect instances, to be filled at run-time by
+        # the test program	
+	process = []
+	# the function for test body
+	test_func = None
+	def __init__(	self, 
+			title, 		# Test title
+			inst_params, 	# InstanceParam's as list
+			func=None):
 		self.title = title
-		self.callee_cfg = callee_cfg
-		self.caller_cfg = caller_cfg
+		self.inst_params = inst_params
+		self.test_func = func
 
+
+
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_const.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_const.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_const.py	(revision 2025)
Index: project/trunk/pjsip-apps/src/test-pjsua/inc_param.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/inc_param.py	(revision 2024)
+++ 	(revision )
@@ -1,46 +1,0 @@
-# $Id:$
-###########################################
-# pjsua instantiation parameter
-class Pjsua:
-	# instance name
-	name = ""
-	# command line arguments. Default is empty.
-	# sample:
-	#  args = "--null-audio --local-port 0"
-	args = ""
-	# list containing send/expect/title list. Default empty.
-	# The inside list contains three items, all are optional:
-	#  - the command to be sent to pjsua menu
-	#  - the string to expect
-	#  - optional string to describe what this is doing
-	# Sample of command list containing two list items:
-	#  cmds = [["sleep 50",""], ["q","", "quitting.."]]
-	cmds = []
-	# print out the stdout output of this pjsua?
-	echo = False
-	# print out commands interacting with this pjsua?
-	trace = False
-	def __init__(self, name, args="", echo=False, trace=False, cmds=[]):
-		self.name = name
-		self.args = args
-		self.echo = echo
-		self.trace = trace
-		self.cmds = cmds
-			
-############################################
-# Test parameter class
-class Test:
-	title = ""
-	# params is list containing Pjsua objects
-	run = []
-	# list of Expect instances, to be filled at run-time by
-        # the test program	
-	process = []
-	# the function for test body
-	test_func = None
-	def __init__(self, title, run, func=None):
-		self.title = title
-		self.run = run
-		self.test_func = func
-
-
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_call.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_call.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_call.py	(revision 2025)
@@ -3,5 +3,4 @@
 import imp
 import sys
-import inc_param as param
 import inc_const as const
 
@@ -9,23 +8,4 @@
 cfg_file = imp.load_source("cfg_file", sys.argv[2])
 
-# Test title
-title = cfg_file.config.title
-port1 = "9060"
-
-# First pjsua
-p1 = param.Pjsua(
-		"callee",
-		args = cfg_file.config.callee_cfg.arg + " --local-port="+port1,
-		echo = cfg_file.config.callee_cfg.echo_enabled,
-		trace = cfg_file.config.callee_cfg.trace_enabled
-		)
-
-# Second pjsua, make call to the first one
-p2 = param.Pjsua(
-		"caller",
-		args = cfg_file.config.caller_cfg.arg + " --local-port=0",
-		echo = cfg_file.config.caller_cfg.echo_enabled,
-		trace = cfg_file.config.caller_cfg.trace_enabled
-		)
 
 # Test body function
@@ -36,5 +16,5 @@
 	# Caller making call
 	caller.send("m")
-	caller.send("sip:localhost:" + port1 + cfg_file.config.uri_param)
+	caller.send(t.inst_params[0].uri)
 	caller.expect(const.STATE_CALLING)
 	
@@ -147,5 +127,5 @@
 
 # Here where it all comes together
-test = param.Test(title, run=[p1, p2], func=test_func)
+test = cfg_file.test_param
+test.test_func = test_func
 
-
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_pres.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_pres.py	(revision 2025)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_pres.py	(revision 2025)
@@ -0,0 +1,124 @@
+# $Id:$
+import time
+import imp
+import sys
+import inc_const as const
+
+# Load configuration
+cfg_file = imp.load_source("cfg_file", sys.argv[2])
+
+
+# Test body function
+def test_func(t):
+	u1 = t.process[0]
+	uri1 = cfg_file.test_param.inst_params[0].uri
+	acc1 = "-1"
+	u2 = t.process[1]
+	uri2 = cfg_file.test_param.inst_params[1].uri
+	acc2 = "-1"
+
+	# if have_reg then wait for couple of seconds for PUBLISH
+	# to complete (just in case pUBLISH is used)
+	if u1.inst_param.have_reg:
+		time.sleep(1)
+	if u2.inst_param.have_reg:
+		time.sleep(1)
+
+	# U1 adds U2 as buddy
+	u1.send("+b")
+	u1.send(uri2)
+	u1.expect("Subscription state changed NULL --> SENT")
+	u1.expect("Presence subscription.*is ACCEPTED")
+	if not u2.inst_param.have_publish:
+		# Process incoming SUBSCRIBE in U2
+		# Finds out which account gets the subscription in U2
+		line = u2.expect("pjsua_pres.*subscription.*using account")
+		acc2 = line.split("using account ")[1]
+	# wait until we've got Online notification
+	u1.expect(uri2 + ".*Online")
+
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+	# U2 adds U1 as buddy
+	u2.send("+b")
+	u2.send(uri1)
+	u2.expect("Subscription state changed NULL --> SENT")
+	u2.expect("Presence subscription.*is ACCEPTED")
+	if not u1.inst_param.have_publish:
+		# Process incoming SUBSCRIBE in U1
+		# Finds out which account gets the subscription in U1
+		line = u1.expect("pjsua_pres.*subscription.*using account")
+		acc1 = line.split("using account ")[1]
+	# wait until we've got Online notification
+	u2.expect(uri1 + ".*Online")
+
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+	# Set current account in both U1 and U2
+	if acc1!="-1":
+		u1.send(">")
+		u1.send(acc1)
+		u1.expect("Current account changed")
+	if acc2!="-1":
+		u2.send(">")
+		u2.send(acc2)
+		u2.expect("Current account changed")
+
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+	# u2 toggles online status
+	u2.send("t")
+	u1.expect(uri2 + ".*status.*Offline")
+	u2.expect("offline")
+	
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+	# u1 toggles online status
+	u1.send("t")
+	u2.expect(uri1 + ".*status.*Offline")
+	u1.expect("offline")
+
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+	# u2 set online status to On the phone
+	u2.send("T")
+	u2.send("3")
+	u1.expect(uri2 + ".*status.*On the phone")
+	u2.expect("On the phone")
+	
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+	# U1 send IM
+	im_text = "Hello World from U1"
+	u1.send("i")
+	u1.send("1")
+	u1.send(im_text)
+	u2.expect(" is typing")
+	u2.expect("MESSAGE from.*"+im_text)
+	u1.expect(im_text+".*delivered successfully")
+	
+	# Synchronize stdout
+	u1.sync_stdout()
+	u2.sync_stdout()
+
+
+# Here where it all comes together
+test = cfg_file.test_param
+test.test_func = test_func
+
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_run.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_run.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/mod_run.py	(revision 2025)
@@ -2,5 +2,4 @@
 import imp
 import sys
-import inc_param as param
 
 
@@ -8,12 +7,4 @@
 cfg_file = imp.load_source("cfg_file", sys.argv[2])
 
-# Test title
-title = "Basic pjsua"
-
-# Param to spawn pjsua
-p1 = param.Pjsua("pjsua", args=cfg_file.config.arg, 
-		 echo=cfg_file.config.echo_enabled, 
-		 trace=cfg_file.config.trace_enabled)
-
 # Here where it all comes together
-test = param.Test(title, run=[p1])
+test = cfg_file.test_param
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/run.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/run.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/run.py	(revision 2025)
@@ -6,10 +6,7 @@
 import time
 
-import inc_param as param
 import inc_const as const
 
 # Defaults
-G_ECHO=True
-G_TRACE=False
 G_EXE="..\\..\\bin\\pjsua_vc6d.exe"
 
@@ -28,12 +25,14 @@
 	trace_enabled = False
 	name = ""
+	inst_param = None
 	rh = re.compile(const.DESTROYED)
 	ra = re.compile(const.ASSERT, re.I)
 	rr = re.compile(const.STDOUT_REFRESH)
-	def __init__(self, name, exe, args="", echo=G_ECHO, trace_enabled=G_TRACE):
-		self.name = name
-		self.echo = echo
-		self.trace_enabled = trace_enabled
-		fullcmd = exe + " " + args + " --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH
+	def __init__(self, inst_param):
+		self.inst_param = inst_param
+		self.name = inst_param.name
+		self.echo = inst_param.echo_enabled
+		self.trace_enabled = inst_param.trace_enabled
+		fullcmd = G_EXE + " " + inst_param.arg + " --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH
 		self.trace("Popen " + fullcmd)
 		self.proc = subprocess.Popen(fullcmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
@@ -70,4 +69,10 @@
 			if r.search(line) != None:
 				return line
+
+	def sync_stdout(self):
+		self.trace("sync_stdout")
+		self.send("echo 1")
+		self.expect("echo 1")
+
 	def wait(self):
 		self.trace("wait")
@@ -83,4 +88,5 @@
 	time.sleep(1)
 	for p in t.process:
+		p.send("q")
 		p.send("q")
 		p.expect(const.DESTROYED, False)
@@ -108,5 +114,5 @@
 	sys.exit(1)
 
-if len(script.test.run) == 0:
+if len(script.test.inst_params) == 0:
 	print "Error: test doesn't contain pjsua run descriptions"
 	sys.exit(1)
@@ -114,8 +120,13 @@
 # Instantiate pjsuas
 print "====== Running " + script.test.title + " ======"
-for run in script.test.run:
+for inst_param in script.test.inst_params:
 	try:
-		p = Expect(run.name, G_EXE, args=run.args, echo=run.echo, trace_enabled=run.trace)
-	 	# Wait until initialized
+		# Create pjsua's Expect instance from the param
+		p = Expect(inst_param)
+		# Wait until registration completes
+		if inst_param.have_reg:
+			p.expect(inst_param.uri+".*registration success")
+	 	# Synchronize stdout
+		p.send("")
 		p.expect(const.PROMPT)
 		p.send("echo 1")
@@ -124,12 +135,4 @@
 		# add running instance
 		script.test.process.append(p)
-		# run initial script
-		for cmd in run.cmds:
-			if len(cmd) >= 3 and cmd[2]!="":
-				print "====== " + cmd[2] + " ======"
-			if len(cmd) >= 1 and cmd[0]!="":
-				p.send(cmd[0])
-			if len(cmd) >= 2 and cmd[1]!="":
-				p.expect(cmd[1])
 
 	except TestError, e:
@@ -146,4 +149,10 @@
 time.sleep(2)
 for p in script.test.process:
+	# Unregister if we have_reg to make sure that next tests
+	# won't wail
+	if p.inst_param.have_reg:
+		p.send("ru")
+		p.expect(p.inst_param.uri+".*unregistration success")
+	p.send("q")
 	p.send("q")
 	time.sleep(0.5)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py	(revision 2025)
@@ -1,3 +1,3 @@
-# $Id:$
+# $Id$
 import os
 import sys
@@ -13,11 +13,15 @@
                    "scripts-call/300_ice_1_1"]
 
-# Add all tests in "scripts-run" directory.
+# Add basic tests
 for f in os.listdir("scripts-run"):
     tests.append("mod_run.py scripts-run/" + f)
 
-# Add all tests in "scripts-call" directory.
+# Add basic call tests
 for f in os.listdir("scripts-call"):
     tests.append("mod_call.py scripts-call/" + f)
+
+# Add presence tests
+for f in os.listdir("scripts-pres"):
+    tests.append("mod_pres.py scripts-pres/" + f)
 
 # Filter-out excluded tests
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/100_simplecall.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/100_simplecall.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/100_simplecall.py	(revision 2025)
@@ -1,10 +1,12 @@
 # $Id:$
 #
-import inc_cfg
+from inc_cfg import *
 
 # Simple call
-config = inc_cfg.CallConfig(
-		title = "Basic call",
-		callee_cfg = inc_cfg.Config(arg="--null-audio"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio")
+test_param = TestParam(
+		"Basic call",
+		[
+			InstanceParam("callee", "--null-audio --max-calls=1"),
+			InstanceParam("caller", "--null-audio --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_0_1.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_0_1.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_0_1.py	(revision 2025)
@@ -1,10 +1,11 @@
 # $Id:$
 #
-import inc_cfg
+from inc_cfg import *
 
-# Simple call
-config = inc_cfg.CallConfig(
-		title = "Callee=no SRTP, caller=optional SRTP",
-		callee_cfg = inc_cfg.Config(arg="--null-audio"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=1 --srtp-secure=0")
+test_param= TestParam(
+		"Callee=no SRTP, caller=optional SRTP",
+		[
+			InstanceParam("callee", "--null-audio --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_0.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_0.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_0.py	(revision 2025)
@@ -1,10 +1,11 @@
 # $Id:$
 #
-import inc_cfg
+from inc_cfg import *
 
-# Simple call
-config = inc_cfg.CallConfig(
-		title = "Callee=optional SRTP, caller=no SRTP",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=1 --srtp-secure=0"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio")
+test_param = TestParam(
+		"Callee=optional SRTP, caller=no SRTP",
+		[
+			InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
+			InstanceParam("caller", "--null-audio --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_1.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_1.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_1.py	(revision 2025)
@@ -1,10 +1,11 @@
 # $Id:$
 #
-import inc_cfg
+from inc_cfg import *
 
-# Simple call
-config = inc_cfg.CallConfig(
-		title = "Callee=optional SRTP, caller=optional SRTP",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=1 --srtp-secure=0"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=1 --srtp-secure=0")
+test_param = TestParam(
+		"Callee=optional SRTP, caller=optional SRTP",
+		[
+			InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_2.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_2.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_1_2.py	(revision 2025)
@@ -1,10 +1,11 @@
 # $Id$
 #
-import inc_cfg
+from inc_cfg import *
 
-# Simple call
-config = inc_cfg.CallConfig(
-		title = "Callee=optional SRTP, caller=mandatory SRTP",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=1 --srtp-secure=0"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=2 --srtp-secure=0")
+test_param = TestParam(
+		"Callee=optional SRTP, caller=mandatory SRTP",
+		[
+			InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-srtp=2 --srtp-secure=0 --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_2_1.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_2_1.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_2_1.py	(revision 2025)
@@ -1,10 +1,12 @@
 # $Id$
 #
-import inc_cfg
+from inc_cfg import *
 
 # Simple call
-config = inc_cfg.CallConfig(
-		title = "Callee=mandatory SRTP, caller=optional SRTP",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=2 --srtp-secure=0"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=1 --srtp-secure=0")
+test_param = TestParam(
+		"Callee=mandatory SRTP, caller=optional SRTP",
+		[
+			InstanceParam("callee", "--null-audio --use-srtp=2 --srtp-secure=0 --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_2_2.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_2_2.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/150_srtp_2_2.py	(revision 2025)
@@ -1,10 +1,11 @@
 # $Id$
 #
-import inc_cfg
+from inc_cfg import *
 
-# Simple call
-config = inc_cfg.CallConfig(
-		title = "Callee=mandatory SRTP, caller=mandatory SRTP",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=2 --srtp-secure=0"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --use-srtp=2 --srtp-secure=0")
+test_param = TestParam(
+		"Callee=mandatory SRTP, caller=mandatory SRTP",
+		[
+			InstanceParam("callee", "--null-audio --use-srtp=2 --srtp-secure=0 --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-srtp=2 --srtp-secure=0 --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py	(revision 2025)
@@ -1,11 +1,12 @@
 # $Id$
 #
-import inc_cfg
+from inc_cfg import *
 
 # TCP call
-config = inc_cfg.CallConfig(
-		title = "TCP transport",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --no-udp"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --no-udp")
+test_param = TestParam(
+		"TCP transport",
+		[
+			InstanceParam("callee", "--null-audio --no-udp", uri_param=";transport=tcp --max-calls=1"),
+			InstanceParam("caller", "--null-audio --no-udp --max-calls=1")
+		]
 		)
-config.uri_param = ";transport=tcp"
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_0_1.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_0_1.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_0_1.py	(revision 2025)
@@ -1,10 +1,12 @@
-# $Id:$
+# $Id$
 #
-import inc_cfg
+from inc_cfg import *
 
 # ICE mismatch
-config = inc_cfg.CallConfig(
-		title = "Callee=no ICE, caller=use ICE",
-		callee_cfg = inc_cfg.Config(arg="--null-audio"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --use-ice")
+test_param = TestParam(
+		"Callee=no ICE, caller=use ICE",
+		[
+			InstanceParam("callee", "--null-audio --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-ice --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_0.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_0.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_0.py	(revision 2025)
@@ -1,10 +1,12 @@
-# $Id:$
+# $Id$
 #
-import inc_cfg
-
+from inc_cfg import *
+ 
 # ICE mismatch
-config = inc_cfg.CallConfig(
-		title = "Callee=use ICE, caller=no ICE",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --use-ice"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio")
+test_param = TestParam(
+		"Callee=use ICE, caller=no ICE",
+		[
+			InstanceParam("callee", "--null-audio --use-ice --max-calls=1"),
+			InstanceParam("caller", "--null-audio --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py	(revision 2025)
@@ -1,10 +1,12 @@
-# $Id:$
+# $Id$
 #
-import inc_cfg
+from inc_cfg import *
 
 # ICE mismatch
-config = inc_cfg.CallConfig(
-		title = "Callee=use ICE, caller=use ICE",
-		callee_cfg = inc_cfg.Config(arg="--null-audio --use-ice"),
-		caller_cfg = inc_cfg.Config(arg="--null-audio --use-ice")
+test_param = TestParam(
+		"Callee=use ICE, caller=use ICE",
+		[
+			InstanceParam("callee", "--null-audio --use-ice --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-ice --max-calls=1")
+		]
 		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres/100_peertopeer.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres/100_peertopeer.py	(revision 2025)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres/100_peertopeer.py	(revision 2025)
@@ -0,0 +1,12 @@
+# $Id:$
+#
+from inc_cfg import *
+
+# Direct peer to peer presence
+test_param = TestParam(
+		"Direct peer to peer presence",
+		[
+			InstanceParam("client1", "--null-audio"),
+			InstanceParam("client2", "--null-audio")
+		]
+		)
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres/200_publish.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres/200_publish.py	(revision 2025)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres/200_publish.py	(revision 2025)
@@ -0,0 +1,35 @@
+# $Id:$
+#
+from inc_cfg import *
+
+# Basic registration
+test_param = TestParam(
+		"Presence with PUBLISH",
+		[
+			InstanceParam(	"ua1", 
+					"--null-audio"+
+						" --id=<sip:test1@pjsip.org>"+
+						" --registrar=sip:sip.pjsip.org" +
+						" --username=test1" +
+						" --password=test1" +
+						" --realm=*" +
+						" --proxy=sip:sip.pjsip.org;lr" +
+						" --publish",
+					uri="<sip:test1@pjsip.org>",
+					have_reg=True,
+					have_publish=True),
+			InstanceParam(	"ua2", 
+					"--null-audio"+
+						" --id=<sip:test2@pjsip.org>"+
+						" --registrar=sip:sip.pjsip.org" +
+						" --username=test2" +
+						" --password=test2" +
+						" --realm=*" +
+						" --proxy=sip:sip.pjsip.org;lr" +
+						" --publish",
+					uri="<sip:test2@pjsip.org>",
+					have_reg=True,
+					have_publish=True),
+		]
+		)
+
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/100_simple.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/100_simple.py	(revision 2024)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/100_simple.py	(revision 2025)
@@ -3,6 +3,11 @@
 # Just about the simple pjsua command line parameter, which should
 # never fail in any circumstances
-import inc_cfg
+from inc_cfg import *
 
-config = inc_cfg.Config(arg = "--null-audio --local-port 0 --rtp-port 0")
+test_param = TestParam(
+		"Basic run", 
+		[
+			InstanceParam("pjsua", "--null-audio --local-port 0 --rtp-port 0")
+		]
+		)
 
Index: /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/200_register.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/200_register.py	(revision 2025)
+++ /pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/200_register.py	(revision 2025)
@@ -0,0 +1,20 @@
+# $Id:$
+#
+from inc_cfg import *
+
+# Basic registration
+test_param = TestParam(
+		"Basic registration",
+		[
+			InstanceParam(	"client", 
+					"--null-audio"+
+						" --id=<sip:test1@pjsip.org>"+
+						" --registrar=sip:sip.pjsip.org" +
+						" --username=test1" +
+						" --password=test1" +
+						" --realm=*",
+					uri="sip:test1@pjsip.org",
+					have_reg=True),
+		]
+		)
+
