blob: 02adac920cb6cb505172e400a2975773a306b649 [file] [log] [blame]
Alexandre Lision67916dd2014-01-24 13:33:04 -05001# $Id$
2import inc_sip as sip
3import inc_sdp as sdp
4
5# Several PUBLISH failure scenarios that should be handled automatically
6
7
8pjsua = "--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"
12
13# Handle REGISTER first
14req1 = sip.RecvfromTransaction("Initial REGISTER", 200,
15 include=["REGISTER sip"],
16 exclude=[],
17 resp_hdr=["Expires: 1800"]
18 )
19
20# First PUBLISH, reply with 412
21req2 = sip.RecvfromTransaction("Initial PUBLISH, will be replied with 412", 412,
22 include=["PUBLISH sip"],
23 exclude=["Expires:"]
24 )
25
26# Second PUBLISH
27req3 = sip.RecvfromTransaction("Second PUBLISH, will be replied with 200", 200,
28 include=["PUBLISH sip"],
29 exclude=["Expires:"],
30 resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
31 )
32
33# PUBLISH refresh, respond with 408
34req4 = sip.RecvfromTransaction("PUBLISH refresh, will be replied with 408", 408,
35 include=["PUBLISH sip", "SIP-If-Match: dx200xyz"],
36 exclude=["Expires:"],
37 resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
38 )
39
40# After 5 minutes, pjsua should retry again
41req5 = sip.RecvfromTransaction("PUBLISH retry", 200,
42 include=["PUBLISH sip"],
43 exclude=["Expires:", "SIP-If-Match:"],
44 resp_hdr=["Expires: 60", "SIP-ETag: abc"]
45 )
46
47
48
49recvfrom_cfg = sip.RecvfromCfg("PUBLISH scenarios",
50 pjsua, [req1, req2, req3])
51