203_reg_good_empty_realm.py 885 B

123456789101112131415161718192021222324252627282930
  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=* --user=username --password=password " + \
  5. "--auto-update-nat=0"
  6. # 401 Response, missing realm value
  7. req1 = sip.RecvfromTransaction("Initial request", 401,
  8. include=["REGISTER sip"],
  9. exclude=[],
  10. resp_hdr=['WWW-Authenticate: Digest']
  11. )
  12. # Client should retry, we giving it another 401 with empty realm
  13. req2 = sip.RecvfromTransaction("REGISTER retry #1 of 2", 407,
  14. include=["REGISTER sip"],
  15. exclude=[],
  16. resp_hdr=['Proxy-Authenticate: Digest realm=""']
  17. )
  18. # Client should retry
  19. req3 = sip.RecvfromTransaction("REGISTER retry #2 of 2", 200,
  20. include=[],
  21. exclude=[],
  22. expect="registration success"
  23. )
  24. recvfrom_cfg = sip.RecvfromCfg("Registration with empty realm",
  25. pjsua, [req1, req2, req3])