summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip-apps/src/test-pjsua/mod_media_playrec.py19
-rw-r--r--pjsip-apps/src/test-pjsua/run.py17
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py4
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py27
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py27
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py27
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py26
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_1.py26
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_2.py26
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_3.py26
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_avp.py28
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_savp.py28
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/310_srtp1_no_crypto.py26
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/311_srtp1_recv_avp.py28
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/312_srtp1_recv_savp.py28
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py26
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/320_srtp2_no_crypto.py26
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/321_srtp2_recv_avp.py28
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/322_srtp2_recv_savp.py28
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py26
20 files changed, 484 insertions, 13 deletions
diff --git a/pjsip-apps/src/test-pjsua/mod_media_playrec.py b/pjsip-apps/src/test-pjsua/mod_media_playrec.py
index 8d8a60fe..30f2f6db 100644
--- a/pjsip-apps/src/test-pjsua/mod_media_playrec.py
+++ b/pjsip-apps/src/test-pjsua/mod_media_playrec.py
@@ -1,11 +1,12 @@
# $Id$
# 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
import imp
@@ -75,8 +76,20 @@ def post_func(t, ud):
fullcmd = COMPARE_WAV_EXE + " " + ud.input_filename + " " + ud.output_filename + " " + "3000"
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")
# Here where it all comes together
diff --git a/pjsip-apps/src/test-pjsua/run.py b/pjsip-apps/src/test-pjsua/run.py
index 74c028a9..9026f4f8 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -109,14 +109,15 @@ class Expect:
#########################
# 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)
@@ -195,7 +196,7 @@ if script.test.post_func != None:
try:
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
print "Test " + script.test.title + " completed successfully"
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py b/pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py
index 0cf48801..3fc52dff 100644
--- a/pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/100_simplecall.py
@@ -1,4 +1,4 @@
-# $Id:$
+# $Id$
import inc_sip as sip
import inc_sdp as sdp
@@ -16,5 +16,5 @@ a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
-sendto_cfg = sip.SendtoCfg( "simple call", "--null-audio", sdp, 200)
+sendto_cfg = sip.SendtoCfg( "simple call", "--null-audio --auto-answer 200", sdp, 200)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py
new file mode 100644
index 00000000..2e3923e6
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py
new file mode 100644
index 00000000..d9228c82
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py
new file mode 100644
index 00000000..e1b05355
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py
new file mode 100644
index 00000000..51e95d68
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_1.py b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_1.py
new file mode 100644
index 00000000..7cc91a73
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_1.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_2.py b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_2.py
new file mode 100644
index 00000000..0e347004
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_2.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_3.py b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_3.py
new file mode 100644
index 00000000..2849f713
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/300_srtp_receive_no_key_3.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_avp.py b/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_avp.py
new file mode 100644
index 00000000..2ef19f33
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_avp.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_savp.py b/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_savp.py
new file mode 100644
index 00000000..d8a1ade9
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/301_srtp0_recv_savp.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/310_srtp1_no_crypto.py b/pjsip-apps/src/test-pjsua/scripts-sendto/310_srtp1_no_crypto.py
new file mode 100644
index 00000000..5bfb92e5
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/310_srtp1_no_crypto.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/311_srtp1_recv_avp.py b/pjsip-apps/src/test-pjsua/scripts-sendto/311_srtp1_recv_avp.py
new file mode 100644
index 00000000..8b173f26
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/311_srtp1_recv_avp.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/312_srtp1_recv_savp.py b/pjsip-apps/src/test-pjsua/scripts-sendto/312_srtp1_recv_savp.py
new file mode 100644
index 00000000..a3b30218
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/312_srtp1_recv_savp.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py b/pjsip-apps/src/test-pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py
new file mode 100644
index 00000000..7b457555
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py
@@ -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)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/320_srtp2_no_crypto.py b/pjsip-apps/src/test-pjsua/scripts-sendto/320_srtp2_no_crypto.py
new file mode 100644
index 00000000..6613b741
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/320_srtp2_no_crypto.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/321_srtp2_recv_avp.py b/pjsip-apps/src/test-pjsua/scripts-sendto/321_srtp2_recv_avp.py
new file mode 100644
index 00000000..75c02453
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/321_srtp2_recv_avp.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/322_srtp2_recv_savp.py b/pjsip-apps/src/test-pjsua/scripts-sendto/322_srtp2_recv_savp.py
new file mode 100644
index 00000000..5d5d53de
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/322_srtp2_recv_savp.py
@@ -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)
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py b/pjsip-apps/src/test-pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py
new file mode 100644
index 00000000..782beba9
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py
@@ -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)