| 1 |
import inc_sip as sip |
| 2 |
import inc_sdp as sdp |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
pjsua = "--null-audio --id=sip:CLIENT --registrar sip:127.0.0.1:$PORT " + \ |
| 12 |
"--realm=python --user=username --password=password" |
| 13 |
|
| 14 |
req1 = sip.RecvfromTransaction("Initial request", 401, |
| 15 |
include=["REGISTER sip"], |
| 16 |
exclude=["Authorization"], |
| 17 |
resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"1\""] |
| 18 |
) |
| 19 |
|
| 20 |
req2 = sip.RecvfromTransaction("First retry", 401, |
| 21 |
include=["REGISTER sip", "Authorization", "nonce=\"1\""], |
| 22 |
exclude=["Authorization:[\\s\\S]+Authorization:"], |
| 23 |
resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"2\", stale=true"] |
| 24 |
) |
| 25 |
|
| 26 |
req3 = sip.RecvfromTransaction("Second retry retry", 401, |
| 27 |
include=["REGISTER sip", "Authorization", "nonce=\"2\""], |
| 28 |
exclude=["Authorization:[\\s\\S]+Authorization:"], |
| 29 |
resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"3\", stale=true"] |
| 30 |
) |
| 31 |
|
| 32 |
req4 = sip.RecvfromTransaction("Third retry", 401, |
| 33 |
include=["REGISTER sip", "Authorization", "nonce=\"3\""], |
| 34 |
exclude=["Authorization:[\\s\\S]+Authorization:"], |
| 35 |
resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"4\", stale=true"], |
| 36 |
expect="PJSIP_EAUTHSTALECOUNT" |
| 37 |
) |
| 38 |
|
| 39 |
recvfrom_cfg = sip.RecvfromCfg("Failed registration retry (server rejects with stale=true) ", |
| 40 |
pjsua, [req1, req2, req3, req4]) |