Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [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 theuser1 --realm python1 --password passwd --next-cred " + \ |
| 7 | "--username theuser2 --realm python2 --password passwd " + \ |
| 8 | "--auto-update-nat=0" |
| 9 | |
| 10 | req1 = sip.RecvfromTransaction("Initial registration", 401, |
| 11 | include=["REGISTER sip"], |
| 12 | resp_hdr=["WWW-Authenticate: Digest realm=\"python1\", nonce=\"1234\"", |
| 13 | "WWW-Authenticate: Digest realm=\"python2\", nonce=\"6789\""], |
| 14 | expect="SIP/2.0 401" |
| 15 | ) |
| 16 | |
| 17 | req2 = sip.RecvfromTransaction("Registration retry with auth", 200, |
| 18 | include=["REGISTER sip", |
| 19 | "Authorization:[\\s\\S]+Authorization:", # Must have 2 Auth hdrs |
| 20 | "realm=\"python1\"", "realm=\"python2\"", |
| 21 | "username=\"theuser1\"", "username=\"theuser2\"", |
| 22 | "nonce=\"1234\"", "nonce=\"6789\"", |
| 23 | "response="], |
| 24 | expect="registration success" |
| 25 | ) |
| 26 | |
| 27 | recvfrom_cfg = sip.RecvfromCfg("Multiple authentication challenges", |
| 28 | pjsua, [req1, req2]) |