~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.2.1/tests/pjsua/scripts-recvfrom/240_publish_scenarios.py

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# $Id: 240_publish_scenarios.py 2661 2009-04-28 22:19:49Z bennylp $
 
2
import inc_sip as sip
 
3
import inc_sdp as sdp
 
4
 
 
5
# Several PUBLISH failure scenarios that should be handled automatically
 
6
 
 
7
 
 
8
pjsua = "--null-audio --id=sip:127.0.0.1:$PORT --registrar sip:127.0.0.1:$PORT " + \
 
9
        "--realm=python --user=username --password=password " + \
 
10
        "--auto-update-nat=0 --publish"
 
11
#pjsua = "--null-audio --local-port 0 --rtp-port 0"
 
12
 
 
13
# Handle REGISTER first
 
14
req1 = sip.RecvfromTransaction("Initial REGISTER", 200,
 
15
                                include=["REGISTER sip"], 
 
16
                                exclude=[],
 
17
                                resp_hdr=["Expires: 1800"]
 
18
                                )
 
19
 
 
20
# First PUBLISH, reply with 412
 
21
req2 = sip.RecvfromTransaction("Initial PUBLISH, will be replied with 412", 412,
 
22
                                include=["PUBLISH sip"], 
 
23
                                exclude=["Expires:"]
 
24
                                )
 
25
 
 
26
# Second PUBLISH
 
27
req3 = sip.RecvfromTransaction("Second PUBLISH, will be replied with 200", 200,
 
28
                                include=["PUBLISH sip"], 
 
29
                                exclude=["Expires:"],
 
30
                                resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
 
31
                                )
 
32
 
 
33
# PUBLISH refresh, respond with 408
 
34
req4 = sip.RecvfromTransaction("PUBLISH refresh, will be replied with 408", 408,
 
35
                                include=["PUBLISH sip", "SIP-If-Match: dx200xyz"], 
 
36
                                exclude=["Expires:"],
 
37
                                resp_hdr=["Expires: 60", "SIP-ETag: dx200xyz"]
 
38
                                )
 
39
 
 
40
# After 5 minutes, pjsua should retry again
 
41
req5 = sip.RecvfromTransaction("PUBLISH retry", 200,
 
42
                                include=["PUBLISH sip"], 
 
43
                                exclude=["Expires:", "SIP-If-Match:"],
 
44
                                resp_hdr=["Expires: 60", "SIP-ETag: abc"]
 
45
                                )
 
46
 
 
47
 
 
48
 
 
49
recvfrom_cfg = sip.RecvfromCfg("PUBLISH scenarios",
 
50
                               pjsua, [req1, req2, req3])
 
51