Index: pjproject/trunk/pjsip-apps/src/test-pjsua/mod_media_playrec.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/mod_media_playrec.py	(revision 2035)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/mod_media_playrec.py	(revision 2036)
@@ -2,9 +2,10 @@
 
 # PLAYFILE -> RECFILE:
-# input file is played and is recorded to output, then compare them.
+# Input file is played and is recorded to output, then compare them.
+# Useful to tes clock rates compatibility and resample quality
 #	null-audio
 #	port 1: wav file input xxxxxx.clock_rate.wav, e.g: test1.8.wav
 #	port 2: wav file ouput xxxxxx.clock_rate.wav, e.g: res1.8.wav
-#	wav input more than 3 seconds
+#	wav input must be more than 3 seconds long
 
 import time
@@ -76,6 +77,18 @@
 	endpt.trace("Popen " + fullcmd)
 	cmp_proc = subprocess.Popen(fullcmd, stdout=subprocess.PIPE, universal_newlines=True)
+
+	# Parse similarity ouput
 	line = cmp_proc.stdout.readline()
-	endpt.trace("WAV similarity = " + line)
+	mo_sim_val = re.match(".+=\s+(\d+)", line)
+	if (mo_sim_val == None):
+		raise TestError("Error comparing WAV files")
+		return
+
+	# Evaluate the similarity value
+	sim_val = mo_sim_val.group(1)
+	if (sim_val > 0):
+		endpt.trace("WAV similarity = " + sim_val)
+	else:
+		raise TestError("Degraded WAV heavily distorted")
 
 
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/run.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/run.py	(revision 2035)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/run.py	(revision 2036)
@@ -110,12 +110,13 @@
 #########################
 # Error handling
-def handle_error(errmsg, t):
+def handle_error(errmsg, t, close_processes = True):
 	print "====== Caught error: " + errmsg + " ======"
-	time.sleep(1)
-	for p in t.process:
-		p.send("q")
-		p.send("q")
-		p.expect(const.DESTROYED, False)
-		p.wait()
+	if (close_processes):
+		time.sleep(1)
+		for p in t.process:
+			p.send("q")
+			p.send("q")
+			p.expect(const.DESTROYED, False)
+			p.wait()
 	print "Test completed with error: " + errmsg
 	sys.exit(1)
@@ -196,5 +197,5 @@
 		script.test.post_func(script.test, script.test.user_data)
 	except TestError, e:
-		handle_error(e.desc, script.test)
+		handle_error(e.desc, script.test, False)
 
 # Done
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py	(revision 2035)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py	(revision 2036)
@@ -1,3 +1,3 @@
-# $Id:$
+# $Id$
 import inc_sip as sip
 import inc_sdp as sdp
@@ -17,4 +17,4 @@
 """
 
-sendto_cfg = sip.SendtoCfg( "simple call", "--null-audio", sdp, 200)
+sendto_cfg = sip.SendtoCfg( "simple call", "--null-audio --auto-answer 200", sdp, 200)
 
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py	(revision 2036)
@@ -0,0 +1,27 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/SAVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AeS_Cm_128_HmAC_shA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:2 aEs_cM_128_HMaC_ShA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
+include = ["m=audio \d+ RTP/SAVP", "a=crypto"]
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller has used mixed case in crypto attr, callee must process that normally", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py	(revision 2036)
@@ -0,0 +1,27 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag, callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py	(revision 2036)
@@ -0,0 +1,27 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:x AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag (non-numeric), callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag (zero), callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_1.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_1.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_1.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:0 AES_CM_128_HMAC_SHA1_80
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_2.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_2.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_2.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_3.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_3.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_3.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_avp.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_avp.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_avp.py	(revision 2036)
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 0 --srtp-secure 0"
+include = []
+exclude = ["a=crypto"]
+
+sendto_cfg = sip.SendtoCfg( "Callee has SRTP disabled but receive RTP/AVP with crypto, should accept without crypto", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_savp.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_savp.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_savp.py	(revision 2036)
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/SAVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 0 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "Callee has SRTP disabled but receive RTP/SAVP, should reject the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/310_srtp1_no_crypto.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/310_srtp1_no_crypto.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/310_srtp1_no_crypto.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = ["m=audio \d+ RTP/AVP"]
+exclude = ["a=crypto"]
+
+sendto_cfg = sip.SendtoCfg( "caller has no crypto attr, answer must accept without crypto attr", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/311_srtp1_recv_avp.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/311_srtp1_recv_avp.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/311_srtp1_recv_avp.py	(revision 2036)
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = ["m=audio \d+ RTP/AVP", "a=crypto"]
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "Callee has SRTP optional and receive RTP/AVP with crypto, should accept with RTP/AVP & crypto", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/312_srtp1_recv_savp.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/312_srtp1_recv_savp.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/312_srtp1_recv_savp.py	(revision 2036)
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/SAVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = ["m=audio \d+ RTP/SAVP", "a=crypto"]
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "Callee has SRTP optional receive RTP/SAVP, should answer RTP/SAVP too", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 CRYPTO_X inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = ["a=crypto"]
+
+sendto_cfg = sip.SendtoCfg( "caller has used unsupported crypto, callee (SRTP optional) accept the call without crypto", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/320_srtp2_no_crypto.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/320_srtp2_no_crypto.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/320_srtp2_no_crypto.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/SAVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller has no crypto attr on RTP/SAVP, callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/321_srtp2_recv_avp.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/321_srtp2_recv_avp.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/321_srtp2_recv_avp.py	(revision 2036)
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "Callee has SRTP mandatory and receive RTP/AVP with crypto, should reject the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/322_srtp2_recv_savp.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/322_srtp2_recv_savp.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/322_srtp2_recv_savp.py	(revision 2036)
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/SAVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
+include = ["m=audio \d+ RTP/SAVP", "a=crypto"]
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "Callee has SRTP mandatory receive RTP/SAVP, should answer RTP/SAVP too", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
+
Index: pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py
===================================================================
--- pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py	(revision 2036)
+++ pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py	(revision 2036)
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/SAVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 CRYPTO_X inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller has used unsupported crypto, callee (SRTP mandatory) must reject the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
