Alexandre Lision | 8af73cb | 2013-12-10 14:11:20 -0500 | [diff] [blame] | 1 | # $Id$ |
| 2 | import inc_sip as sip |
| 3 | import inc_sdp as sdp |
| 4 | |
| 5 | pjsua = "--null-audio --id=sip:CLIENT --registrar sip:127.0.0.1:$PORT " + \ |
| 6 | "--username user@ims-domain --realm python --password passwd --use-ims --auto-update-nat=0" |
| 7 | |
| 8 | req1 = sip.RecvfromTransaction("Initial registration", 401, |
| 9 | include=["REGISTER sip", "Authorization", |
| 10 | "username=\"user@ims-domain\"", |
| 11 | "realm=\"python\""], |
| 12 | resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"1234\""], |
| 13 | expect="SIP/2.0 401" |
| 14 | ) |
| 15 | |
| 16 | req2 = sip.RecvfromTransaction("Registration retry with auth", 200, |
| 17 | include=["REGISTER sip", "Authorization:", |
| 18 | "realm=\"python\"", "username=\"user@ims-domain\"", |
| 19 | "nonce=\"1234\"", "response="], |
| 20 | # Must not have double Authorization header: |
| 21 | exclude=["Authorization:[\\s\\S]+Authorization:"], |
| 22 | expect="registration success" |
| 23 | ) |
| 24 | |
| 25 | recvfrom_cfg = sip.RecvfromCfg("Successful IMS registration test", |
| 26 | pjsua, [req1, req2]) |