1
# $Id: 240_publish_scenarios.py 2661 2009-04-28 22:19:49Z bennylp $
5
# Several PUBLISH failure scenarios that should be handled automatically
8
pjsua = "--null-audio --id=sip:127.0.0.1:$PORT --registrar sip:127.0.0.1:$PORT " + \
9
"--realm=python --user=username --password=password " + \
10
"--auto-update-nat=0 --publish"
11
#pjsua = "--null-audio --local-port 0 --rtp-port 0"
13
# Handle REGISTER first
14
req1 = sip.RecvfromTransaction("Initial REGISTER", 200,
15
include=["REGISTER sip"],
17
resp_hdr=["Expires: 1800"]
20
# First PUBLISH, reply with 412
21
req2 = sip.RecvfromTransaction("Initial PUBLISH, will be replied with 412", 412,
22
include=["PUBLISH sip"],
27
req3 = sip.RecvfromTransaction("Second PUBLISH, will be replied with 200", 200,
28
include=["PUBLISH sip"],
30
resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
33
# PUBLISH refresh, respond with 408
34
req4 = sip.RecvfromTransaction("PUBLISH refresh, will be replied with 408", 408,
35
include=["PUBLISH sip", "SIP-If-Match: dx200xyz"],
37
resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
40
# After 5 minutes, pjsua should retry again
41
req5 = sip.RecvfromTransaction("PUBLISH retry", 200,
42
include=["PUBLISH sip"],
43
exclude=["Expires:", "SIP-If-Match:"],
44
resp_hdr=["Expires: 60", "SIP-ETag: abc"]
49
recvfrom_cfg = sip.RecvfromCfg("PUBLISH scenarios",
50
pjsua, [req1, req2, req3])