208_reg_good_retry_nonce_ok.py 1022 B

12345678910111213141516171819202122232425262728
  1. import inc_sip as sip
  2. import inc_sdp as sdp
  3. pjsua = "--null-audio --id=sip:CLIENT --registrar sip:127.0.0.1:$PORT " + \
  4. "--realm=python --user=username --password=password " + \
  5. "--auto-update-nat=0"
  6. req1 = sip.RecvfromTransaction("Initial request", 401,
  7. include=["REGISTER sip"],
  8. exclude=["Authorization"],
  9. resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"1\""]
  10. )
  11. req2 = sip.RecvfromTransaction("REGISTER first retry", 401,
  12. include=["REGISTER sip", "Authorization", "nonce=\"1\""],
  13. exclude=["Authorization:[\\s\\S]+Authorization:"],
  14. resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"2\", stale=true"]
  15. )
  16. req3 = sip.RecvfromTransaction("REGISTER retry with new nonce", 200,
  17. include=["REGISTER sip", "Authorization", "nonce=\"2\""],
  18. exclude=["Authorization:[\\s\\S]+Authorization:"],
  19. expect="registration success"
  20. )
  21. recvfrom_cfg = sip.RecvfromCfg("Authentication okay after retry with new nonce",
  22. pjsua, [req1, req2, req3])