summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-06-26 13:29:29 +0000
committerBenny Prijono <bennylp@teluu.com>2008-06-26 13:29:29 +0000
commit657affe0e2a8f1a30ff48478140278196285843e (patch)
tree4e7b032c9100b2cdd9e333628842f6de0495d6d4
parent908377811bbfebd69d2ff831b7ff38e207fbcd17 (diff)
Added PRACK tests and ICE with public proxy tests
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2059 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/test-pjsua/inc_cfg.py2
-rw-r--r--pjsip-apps/src/test-pjsua/mod_call.py153
-rw-r--r--pjsip-apps/src/test-pjsua/runall.py1
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_a.py22
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_b.py25
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-call/350_prack_a.py12
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-call/350_prack_b.py12
7 files changed, 170 insertions, 57 deletions
diff --git a/pjsip-apps/src/test-pjsua/inc_cfg.py b/pjsip-apps/src/test-pjsua/inc_cfg.py
index 6f3219c9..5b7514a6 100644
--- a/pjsip-apps/src/test-pjsua/inc_cfg.py
+++ b/pjsip-apps/src/test-pjsua/inc_cfg.py
@@ -55,7 +55,7 @@ class InstanceParam:
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):
+ if have_publish and have_reg and not ("--publish" in self.arg):
self.arg = self.arg + " --publish"
self.echo_enabled = echo_enabled
self.trace_enabled = trace_enabled
diff --git a/pjsip-apps/src/test-pjsua/mod_call.py b/pjsip-apps/src/test-pjsua/mod_call.py
index 03023418..7e30a837 100644
--- a/pjsip-apps/src/test-pjsua/mod_call.py
+++ b/pjsip-apps/src/test-pjsua/mod_call.py
@@ -3,122 +3,163 @@ import time
import imp
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")
+
# Test body function
def test_func(t, user_data):
callee = t.process[0]
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")
caller.send(t.inst_params[0].uri)
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")
# 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")
-
- # Hold call
+ check_media(caller, callee)
+ check_media(callee, caller)
+
+ # 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")
-
- # 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")
+ caller.sync_stdout()
+ callee.sync_stdout()
+
+ # 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.expect(const.MEDIA_ACTIVE)
+ caller.sync_stdout()
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")
+ 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)
# UPDATE (by callee)
callee.send("U")
- callee.expect(const.MEDIA_ACTIVE)
+ 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")
+ 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
caller.expect(const.STATE_DISCONNECTED)
diff --git a/pjsip-apps/src/test-pjsua/runall.py b/pjsip-apps/src/test-pjsua/runall.py
index 463e8adc..479e5980 100644
--- a/pjsip-apps/src/test-pjsua/runall.py
+++ b/pjsip-apps/src/test-pjsua/runall.py
@@ -13,6 +13,7 @@ tests = []
excluded_tests = [ "svn",
"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
"scripts-media-playrec/100_resample_lf_11" # related to clock-rate 11 kHz problem
diff --git a/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_a.py b/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_a.py
new file mode 100644
index 00000000..dc76b5c0
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_a.py
@@ -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),
+ ]
+ )
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_b.py b/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_b.py
new file mode 100644
index 00000000..59af2520
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-call/301_ice_public_b.py
@@ -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),
+ ]
+ )
+
diff --git a/pjsip-apps/src/test-pjsua/scripts-call/350_prack_a.py b/pjsip-apps/src/test-pjsua/scripts-call/350_prack_a.py
new file mode 100644
index 00000000..01edee0f
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-call/350_prack_a.py
@@ -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")
+ ]
+ )
diff --git a/pjsip-apps/src/test-pjsua/scripts-call/350_prack_b.py b/pjsip-apps/src/test-pjsua/scripts-call/350_prack_b.py
new file mode 100644
index 00000000..bb8fee74
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-call/350_prack_b.py
@@ -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")
+ ]
+ )