summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-04-28 22:19:49 +0000
committerBenny Prijono <bennylp@teluu.com>2009-04-28 22:19:49 +0000
commit00ed64489de3c39a6a452e11bb43b2c1090c9307 (patch)
treee871adbe53ea5daa64515cdb0feb1102df7e34cc /tests
parent7a0ee1a7208ddfe8575d1f1179f66fda2fa99339 (diff)
Ticket #760: Enhancements to PUBLISH management (thanks Johan Lantz for the suggestion)
- Changes in PJSUA-LIB - retry with fresh request on 412/Conditional Request Failed response - changed default Expires in PUBLISH request to none (we will not put Expires), to avoid getting 423/Interval Too Brief response - if the PUBLISH fails for any reason, it will be retried on every PJSUA_PRES_TIMER (default 300 seconds), similar to how failed SUBSCRIBE will be retried - Changes to publish.h: - added API to add headers in every PUBLISH request - Added test scenario in Python unit tests git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2661 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'tests')
-rw-r--r--tests/pjsua/scripts-recvfrom/240_publish_scenarios.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/pjsua/scripts-recvfrom/240_publish_scenarios.py b/tests/pjsua/scripts-recvfrom/240_publish_scenarios.py
new file mode 100644
index 00000000..02adac92
--- /dev/null
+++ b/tests/pjsua/scripts-recvfrom/240_publish_scenarios.py
@@ -0,0 +1,51 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+# Several PUBLISH failure scenarios that should be handled automatically
+
+
+pjsua = "--null-audio --id=sip:127.0.0.1:$PORT --registrar sip:127.0.0.1:$PORT " + \
+ "--realm=python --user=username --password=password " + \
+ "--auto-update-nat=0 --publish"
+#pjsua = "--null-audio --local-port 0 --rtp-port 0"
+
+# Handle REGISTER first
+req1 = sip.RecvfromTransaction("Initial REGISTER", 200,
+ include=["REGISTER sip"],
+ exclude=[],
+ resp_hdr=["Expires: 1800"]
+ )
+
+# First PUBLISH, reply with 412
+req2 = sip.RecvfromTransaction("Initial PUBLISH, will be replied with 412", 412,
+ include=["PUBLISH sip"],
+ exclude=["Expires:"]
+ )
+
+# Second PUBLISH
+req3 = sip.RecvfromTransaction("Second PUBLISH, will be replied with 200", 200,
+ include=["PUBLISH sip"],
+ exclude=["Expires:"],
+ resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
+ )
+
+# PUBLISH refresh, respond with 408
+req4 = sip.RecvfromTransaction("PUBLISH refresh, will be replied with 408", 408,
+ include=["PUBLISH sip", "SIP-If-Match: dx200xyz"],
+ exclude=["Expires:"],
+ resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
+ )
+
+# After 5 minutes, pjsua should retry again
+req5 = sip.RecvfromTransaction("PUBLISH retry", 200,
+ include=["PUBLISH sip"],
+ exclude=["Expires:", "SIP-If-Match:"],
+ resp_hdr=["Expires: 60", "SIP-ETag: abc"]
+ )
+
+
+
+recvfrom_cfg = sip.RecvfromCfg("PUBLISH scenarios",
+ pjsua, [req1, req2, req3])
+