Debian Codegraph @

Xpjproject/tests/pjsua/scripts-recvfrom/234_reg_bad_stale_ok.py

raw symbols SCIP
1 import inc_sip as sip
2 import inc_sdp as sdp
3
4 # In this test we simulate broken server, where it wants to
5 # change the nonce, but it fails to set stale to true. In this
6 # case, we should expect pjsip to retry the authentication until
7 # PJSIP_MAX_STALE_COUNT is exceeded as it should have detected
8 # that that nonce has changed
9
10
11 pjsua = "--null-audio --id=sip:CLIENT --registrar sip:127.0.0.1:$PORT " + \
12 "--realm=python --user=username --password=password " + \
13 "--auto-update-nat=0"
14
15 req1 = sip.RecvfromTransaction("Initial request", 401,
16 include=["REGISTER sip"],
17 exclude=["Authorization"],
18 resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"1\""]
19 )
20
21 req2 = sip.RecvfromTransaction("First retry", 401,
22 include=["REGISTER sip", "Authorization", "nonce=\"1\""],
23 exclude=["Authorization:[\\s\\S]+Authorization:"],
24 resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"2\""]
25 )
26
27 req3 = sip.RecvfromTransaction("Second retry retry", 401,
28 include=["REGISTER sip", "Authorization", "nonce=\"2\""],
29 exclude=["Authorization:[\\s\\S]+Authorization:"],
30 resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"3\""]
31 )
32
33 req4 = sip.RecvfromTransaction("Third retry", 200,
34 include=["REGISTER sip", "Authorization", "nonce=\"3\""],
35 exclude=["Authorization:[\\s\\S]+Authorization:"],
36 expect="registration success"
37 )
38
39 recvfrom_cfg = sip.RecvfromCfg("Successful auth server changes nonce but with stale=false",
40 pjsua, [req1, req2, req3, req4])