220_reg_good_ims_ok.py 968 B

12345678910111213141516171819202122232425
  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. "--username user@ims-domain --realm python --password passwd --use-ims --auto-update-nat=0"
  5. req1 = sip.RecvfromTransaction("Initial registration", 401,
  6. include=["REGISTER sip", "Authorization",
  7. "username=\"user@ims-domain\"",
  8. "realm=\"python\""],
  9. resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"1234\""],
  10. expect="SIP/2.0 401"
  11. )
  12. req2 = sip.RecvfromTransaction("Registration retry with auth", 200,
  13. include=["REGISTER sip", "Authorization:",
  14. "realm=\"python\"", "username=\"user@ims-domain\"",
  15. "nonce=\"1234\"", "response="],
  16. # Must not have double Authorization header:
  17. exclude=["Authorization:[\\s\\S]+Authorization:"],
  18. expect="registration success"
  19. )
  20. recvfrom_cfg = sip.RecvfromCfg("Successful IMS registration test",
  21. pjsua, [req1, req2])