SipPayloadsApi

Version 17 (Adrian Georgescu, 08/07/2012 12:27 pm)

1 15 Adrian Georgescu
h1. Payloads API
2 1 Adrian Georgescu
3 16 Adrian Georgescu
The following modules are used for parsing and generating bodies carried using SIP PUBLISH/SUBSCRIBE/NOTIFY methods that have been designed for asynchronous event notifications to convey in real-time state and other information between end-points. 
4 1 Adrian Georgescu
5 17 Adrian Georgescu
An example of state information is presence, which in its basic form provides user availability information based on end-user choice. In its advanced form, presence can provide rich state information including but not limited to user mood, geo-location, environment, noise level and type of communication desired. The information can be disseminated based on a granular policy which allows end-users to decide who has access to which part of the published information.
6 1 Adrian Georgescu
7 15 Adrian Georgescu
These applications are used by the SIP core [[SipCoreApiDocumentation#Publication|Publication]] and [[SipCoreApiDocumentation#Subscription|Subscription]] classes.
8 1 Adrian Georgescu
9 1 Adrian Georgescu
10 15 Adrian Georgescu
h2. Common Policy
11 15 Adrian Georgescu
12 15 Adrian Georgescu
13 1 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/policy.py]
14 1 Adrian Georgescu
15 15 Adrian Georgescu
Generic data types to be used in policy applications, according to "RFC 4745":http://tools.ietf.org/html/rfc4745.
16 1 Adrian Georgescu
17 1 Adrian Georgescu
18 15 Adrian Georgescu
h3. Example
19 15 Adrian Georgescu
20 15 Adrian Georgescu
21 15 Adrian Georgescu
<pre>
22 1 Adrian Georgescu
>>> alice = IdentityOne('sip:alice@example.com')
23 1 Adrian Georgescu
>>> carol = IdentityOne('tel:+1-212-555-1234')
24 1 Adrian Georgescu
>>> bob = IdentityOne('mailto:bob@example.net')
25 1 Adrian Georgescu
>>> print carol
26 1 Adrian Georgescu
tel:+1-212-555-1234
27 1 Adrian Georgescu
>>> id = Identity([alice, bob])
28 1 Adrian Georgescu
>>> print id
29 1 Adrian Georgescu
Identity([IdentityOne('sip:alice@example.com'), IdentityOne('mailto:bob@example.net')])
30 1 Adrian Georgescu
>>> id[1:1] = [carol]
31 1 Adrian Georgescu
>>> print id
32 1 Adrian Georgescu
Identity([IdentityOne('sip:alice@example.com'), IdentityOne('tel:+1-212-555-1234'), IdentityOne('mailto:bob@example.net')])
33 1 Adrian Georgescu
>>> conditions = Conditions([id])
34 1 Adrian Georgescu
>>> rule = Rule(id='f3g44r1', conditions=conditions, actions=Actions(), transformations=Transformations())
35 1 Adrian Georgescu
>>> ruleset = RuleSet()
36 1 Adrian Georgescu
>>> ruleset.append(rule)
37 1 Adrian Georgescu
>>> print ruleset.toxml(pretty_print=True)
38 1 Adrian Georgescu
<?xml version='1.0' encoding='UTF-8'?>
39 1 Adrian Georgescu
<cp:ruleset xmlns:cp="urn:ietf:params:xml:ns:common-policy">
40 1 Adrian Georgescu
  <cp:rule id="f3g44r1">
41 1 Adrian Georgescu
    <cp:conditions>
42 1 Adrian Georgescu
      <cp:identity>
43 1 Adrian Georgescu
        <cp:one id="sip:alice@example.com"/>
44 1 Adrian Georgescu
        <cp:one id="mailto:bob@example.net"/>
45 1 Adrian Georgescu
        <cp:one id="tel:+1-212-555-1234"/>
46 1 Adrian Georgescu
      </cp:identity>
47 1 Adrian Georgescu
    </cp:conditions>
48 1 Adrian Georgescu
    <cp:actions/>
49 1 Adrian Georgescu
    <cp:transformations/>
50 1 Adrian Georgescu
  </cp:rule>
51 1 Adrian Georgescu
</cp:ruleset>
52 1 Adrian Georgescu
<BLANKLINE>
53 15 Adrian Georgescu
</pre>
54 1 Adrian Georgescu
55 1 Adrian Georgescu
56 15 Adrian Georgescu
h2. Pres-rules
57 15 Adrian Georgescu
58 15 Adrian Georgescu
59 1 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/presrules.py]
60 1 Adrian Georgescu
61 15 Adrian Georgescu
Parses and produces Presence Authorization Rules documents according to "RFC 5025":http://tools.ietf.org/html/rfc5025.
62 5 Adrian Georgescu
63 1 Adrian Georgescu
Authorization rules are stored on the XCAP server. The presence rules are generated either based on user initiative or as a response to a new subscription signaled by a change in the watcherinfo application.
64 1 Adrian Georgescu
65 1 Adrian Georgescu
66 15 Adrian Georgescu
h3. Example
67 15 Adrian Georgescu
68 15 Adrian Georgescu
69 15 Adrian Georgescu
<pre>
70 1 Adrian Georgescu
>>> conditions = Conditions([Identity([IdentityOne('sip:user@example.com')])])
71 1 Adrian Georgescu
>>> actions = Actions([SubHandling('allow')])
72 1 Adrian Georgescu
>>> transformations = Transformations()
73 1 Adrian Georgescu
>>> psrv = ProvideServices(provides=[ServiceURIScheme('sip'), ServiceURIScheme('mailto')])
74 1 Adrian Georgescu
>>> ppers = ProvidePersons(all=True)
75 1 Adrian Georgescu
>>> transformations[0:0] = [psrv, ppers]
76 1 Adrian Georgescu
>>> transformations.append(ProvideActivities('true'))
77 1 Adrian Georgescu
>>> transformations.append(ProvideUserInput('bare'))
78 1 Adrian Georgescu
>>> transformations.append(ProvideUnknownAttribute(ns='urn:vendor-specific:foo-namespace', name='foo', value='true'))
79 1 Adrian Georgescu
>>> rule = Rule(id='a', conditions=conditions, actions=actions, transformations=transformations)
80 1 Adrian Georgescu
>>> prules = PresRules([rule])
81 1 Adrian Georgescu
>>> print prules.toxml(pretty_print=True)
82 1 Adrian Georgescu
<?xml version='1.0' encoding='UTF-8'?>
83 1 Adrian Georgescu
<cp:ruleset xmlns:pr="urn:ietf:params:xml:ns:pres-rules" xmlns:cp="urn:ietf:params:xml:ns:common-policy">
84 1 Adrian Georgescu
  <cp:rule id="a">
85 1 Adrian Georgescu
    <cp:conditions>
86 1 Adrian Georgescu
      <cp:identity>
87 1 Adrian Georgescu
        <cp:one id="sip:user@example.com"/>
88 1 Adrian Georgescu
      </cp:identity>
89 1 Adrian Georgescu
    </cp:conditions>
90 1 Adrian Georgescu
    <cp:actions>
91 1 Adrian Georgescu
      <pr:sub-handling>allow</pr:sub-handling>
92 1 Adrian Georgescu
    </cp:actions>
93 1 Adrian Georgescu
    <cp:transformations>
94 1 Adrian Georgescu
      <pr:provide-services>
95 1 Adrian Georgescu
        <pr:service-uri-scheme>sip</pr:service-uri-scheme>
96 1 Adrian Georgescu
        <pr:service-uri-scheme>mailto</pr:service-uri-scheme>
97 1 Adrian Georgescu
      </pr:provide-services>
98 1 Adrian Georgescu
      <pr:provide-persons>
99 1 Adrian Georgescu
        <pr:all-persons/>
100 1 Adrian Georgescu
      </pr:provide-persons>
101 1 Adrian Georgescu
      <pr:provide-activities>true</pr:provide-activities>
102 1 Adrian Georgescu
      <pr:provide-user-input>bare</pr:provide-user-input>
103 1 Adrian Georgescu
      <pr:provide-unknown-attribute ns="urn:vendor-specific:foo-namespace" name="foo">true</pr:provide-unknown-attribute>
104 1 Adrian Georgescu
    </cp:transformations>
105 1 Adrian Georgescu
  </cp:rule>
106 1 Adrian Georgescu
</cp:ruleset>
107 1 Adrian Georgescu
<BLANKLINE>
108 15 Adrian Georgescu
</pre>
109 1 Adrian Georgescu
110 1 Adrian Georgescu
111 15 Adrian Georgescu
h2. Resource Lists
112 15 Adrian Georgescu
113 15 Adrian Georgescu
114 5 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/resourcelists.py]
115 1 Adrian Georgescu
116 15 Adrian Georgescu
This module provides convenient classes to parse and generate resource-lists documents as described in "RFC 4826":http://tools.ietf.org/html/rfc4826.
117 1 Adrian Georgescu
118 1 Adrian Georgescu
Used for server side storage of presence related buddy lists using XCAP protocol. The SIP clients maintain the resource-lists on the XCAP server which provides persisten storage and aggregation point for multiple devices.
119 1 Adrian Georgescu
120 1 Adrian Georgescu
121 15 Adrian Georgescu
h3. Generation
122 15 Adrian Georgescu
123 15 Adrian Georgescu
124 15 Adrian Georgescu
<pre>
125 1 Adrian Georgescu
>>> bill = Entry('sip:bill@example.com', display_name = 'Bill Doe')
126 1 Adrian Georgescu
>>> petri = EntryRef('some/ref')
127 1 Adrian Georgescu
>>> friends = List([bill, petri])
128 1 Adrian Georgescu
>>> rl = ResourceLists([friends])
129 1 Adrian Georgescu
>>> print rl.toxml(pretty_print=True)
130 1 Adrian Georgescu
<?xml version='1.0' encoding='UTF-8'?>
131 1 Adrian Georgescu
<rl:resource-lists xmlns:rl="urn:ietf:params:xml:ns:resource-lists">
132 1 Adrian Georgescu
  <rl:list>
133 1 Adrian Georgescu
    <rl:entry uri="sip:bill@example.com">
134 1 Adrian Georgescu
      <rl:display-name>Bill Doe</rl:display-name>
135 1 Adrian Georgescu
    </rl:entry>
136 1 Adrian Georgescu
    <rl:entry-ref ref="some/ref"/>
137 1 Adrian Georgescu
  </rl:list>
138 1 Adrian Georgescu
</rl:resource-lists>
139 1 Adrian Georgescu
<BLANKLINE>
140 15 Adrian Georgescu
</pre>
141 1 Adrian Georgescu
142 1 Adrian Georgescu
toxml() wraps etree.tostring() and accepts all its arguments (like pretty_print).
143 1 Adrian Georgescu
144 1 Adrian Georgescu
145 15 Adrian Georgescu
h3. Parsing
146 15 Adrian Georgescu
147 15 Adrian Georgescu
148 15 Adrian Georgescu
<pre>
149 1 Adrian Georgescu
>>> r = ResourceLists.parse(example_from_section_3_3_rfc)
150 1 Adrian Georgescu
>>> len(r)
151 1 Adrian Georgescu
1
152 1 Adrian Georgescu
153 1 Adrian Georgescu
>>> friends = r[0]
154 1 Adrian Georgescu
>>> friends.name
155 1 Adrian Georgescu
'friends'
156 1 Adrian Georgescu
157 1 Adrian Georgescu
>>> bill = friends[0]
158 1 Adrian Georgescu
>>> bill.uri
159 1 Adrian Georgescu
'sip:bill@example.com'
160 1 Adrian Georgescu
>>> print bill.display_name
161 1 Adrian Georgescu
Bill Doe
162 1 Adrian Georgescu
163 1 Adrian Georgescu
>>> close_friends = friends[2]
164 1 Adrian Georgescu
>>> print close_friends[0]
165 1 Adrian Georgescu
"Joe Smith" <sip:joe@example.com>
166 1 Adrian Georgescu
>>> print close_friends[2].display_name
167 15 Adrian Georgescu
Marketing
168 1 Adrian Georgescu
</pre>
169 1 Adrian Georgescu
170 1 Adrian Georgescu
171 15 Adrian Georgescu
h2. RLS Services
172 15 Adrian Georgescu
173 15 Adrian Georgescu
174 1 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/rlsservices.py]
175 1 Adrian Georgescu
176 15 Adrian Georgescu
Parses and builds application/rls-services+xml documents according to "RFC 4826":http://tools.ietf.org/html/rfc4826.
177 5 Adrian Georgescu
178 1 Adrian Georgescu
Used for delegating presence related works to the server. The client build rls-services lists with buddies and instructs the server to subscribe to the sip uris indicated in the lists. This way the client can save bandwidth as the server performs the signaling for subscription and collection of notifications and provides consolidated answers to the SIP user agent.
179 1 Adrian Georgescu
180 1 Adrian Georgescu
181 15 Adrian Georgescu
h3. Generation
182 15 Adrian Georgescu
183 15 Adrian Georgescu
184 15 Adrian Georgescu
<pre>
185 1 Adrian Georgescu
>>> buddies = Service('sip:mybuddies@example.com', 'http://xcap.example.com/xxx', ['presence'])
186 1 Adrian Georgescu
>>> marketing = Service('sip:marketing@example.com')
187 1 Adrian Georgescu
>>> marketing.list = RLSList([Entry('sip:joe@example.com'), Entry('sip:sudhir@example.com')])
188 1 Adrian Georgescu
>>> marketing.packages = ['presence']
189 1 Adrian Georgescu
>>> rls = RLSServices([buddies, marketing])
190 1 Adrian Georgescu
>>> print rls.toxml(pretty_print=True)
191 1 Adrian Georgescu
<?xml version='1.0' encoding='UTF-8'?>
192 1 Adrian Georgescu
<rls-services xmlns:rl="urn:ietf:params:xml:ns:resource-lists" xmlns="urn:ietf:params:xml:ns:rls-services">
193 1 Adrian Georgescu
  <service uri="sip:mybuddies@example.com">
194 1 Adrian Georgescu
    <resource-list>http://xcap.example.com/xxx</resource-list>
195 1 Adrian Georgescu
    <packages>
196 1 Adrian Georgescu
      <package>presence</package>
197 1 Adrian Georgescu
    </packages>
198 1 Adrian Georgescu
  </service>
199 1 Adrian Georgescu
  <service uri="sip:marketing@example.com">
200 1 Adrian Georgescu
    <list>
201 1 Adrian Georgescu
      <rl:entry uri="sip:joe@example.com"/>
202 1 Adrian Georgescu
      <rl:entry uri="sip:sudhir@example.com"/>
203 1 Adrian Georgescu
    </list>
204 1 Adrian Georgescu
    <packages>
205 1 Adrian Georgescu
      <package>presence</package>
206 1 Adrian Georgescu
    </packages>
207 3 Adrian Georgescu
  </service>
208 1 Adrian Georgescu
</rls-services>
209 1 Adrian Georgescu
<BLANKLINE>
210 1 Adrian Georgescu
211 1 Adrian Georgescu
=== Parsing ===
212 1 Adrian Georgescu
213 1 Adrian Georgescu
>>> rls = RLSServices.parse(example_from_section_4_3_rfc)
214 1 Adrian Georgescu
>>> len(rls)
215 1 Adrian Georgescu
2
216 1 Adrian Georgescu
217 1 Adrian Georgescu
>>> rls[0].uri
218 1 Adrian Georgescu
'sip:mybuddies@example.com'
219 1 Adrian Georgescu
220 1 Adrian Georgescu
>>> print rls[0].list
221 1 Adrian Georgescu
http://xcap.example.com/xxx
222 1 Adrian Georgescu
223 1 Adrian Georgescu
>>> print rls[0].packages[0]
224 1 Adrian Georgescu
presence
225 1 Adrian Georgescu
226 1 Adrian Georgescu
227 1 Adrian Georgescu
>>> rls[1].uri
228 1 Adrian Georgescu
'sip:marketing@example.com'
229 1 Adrian Georgescu
230 1 Adrian Georgescu
>>> assert len(rls[1].packages) == 1 and rls[1].packages[0] == 'presence'
231 1 Adrian Georgescu
232 15 Adrian Georgescu
</pre>
233 1 Adrian Georgescu
234 1 Adrian Georgescu
235 15 Adrian Georgescu
h2. Presence Data Model
236 15 Adrian Georgescu
237 15 Adrian Georgescu
238 1 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/presdm.py]
239 1 Adrian Georgescu
240 15 Adrian Georgescu
PIDF handling according to "RFC 3863":http://tools.ietf.org/html/rfc3863 and "RFC 3379":http://tools.ietf.org/html/rfc3379. This module provides classes to parse and generate PIDF documents.
241 1 Adrian Georgescu
242 6 Adrian Georgescu
Used to parse NOTIFY body for presence event and generate state information for use with PUBLISH method and to parse the state of buddy lists entries we have subscribed to. A SIP client typically instantiates a new PIDF object for itself and for each buddy it SUBSCRIBEs to and updates each object when a NOTIFY is received. The list of buddies is maintained using the resource-lists XCAP application.
243 1 Adrian Georgescu
244 1 Adrian Georgescu
245 15 Adrian Georgescu
h3. Example
246 15 Adrian Georgescu
247 15 Adrian Georgescu
248 15 Adrian Georgescu
<pre>
249 1 Adrian Georgescu
>>> from datetime import datetime
250 1 Adrian Georgescu
>>> pidf = PIDF('pres:someone@example.com')
251 1 Adrian Georgescu
>>> status = Status(basic=Basic('open'))
252 1 Adrian Georgescu
>>> contact = Contact('im:someone@mobilecarrier.net')
253 1 Adrian Georgescu
>>> contact.priority = "0.8"
254 1 Adrian Georgescu
>>> tuple1 = Service('bs35r9', notes=[ServiceNote("Don't Disturb Please!"), ServiceNote("Ne derangez pas, s'il vous plait", lang="fr")], status=status)
255 1 Adrian Georgescu
>>> tuple1.contact = contact
256 1 Adrian Georgescu
>>> tuple1.timestamp = Timestamp(datetime(2008, 9, 11, 20, 42, 03))
257 1 Adrian Georgescu
>>> tuple2 = Service('eg92n8', status=Status(basic=Basic('open')), contact=Contact('mailto:someone@example.com'))
258 1 Adrian Georgescu
>>> tuple2.contact.priority = "1.0"
259 1 Adrian Georgescu
>>> pidf.notes.add(Note("I'll be in Tokyo next week"))
260 1 Adrian Georgescu
>>> pidf.append(tuple1)
261 1 Adrian Georgescu
>>> pidf.append(tuple2)
262 1 Adrian Georgescu
>>> print pidf.toxml(pretty_print=True)
263 1 Adrian Georgescu
<?xml version='1.0' encoding='UTF-8'?>
264 1 Adrian Georgescu
<presence xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns="urn:ietf:params:xml:ns:pidf" entity="pres:someone@example.com"
265 1 Adrian Georgescu
  <tuple id="bs35r9">
266 1 Adrian Georgescu
    <status>
267 1 Adrian Georgescu
      <basic>open</basic>
268 1 Adrian Georgescu
    </status>
269 1 Adrian Georgescu
    <contact priority="0.8">im:someone@mobilecarrier.net</contact>
270 1 Adrian Georgescu
    <note>Don't Disturb Please!</note>
271 1 Adrian Georgescu
    <note xml:lang="fr">Ne derangez pas, s'il vous plait</note>
272 1 Adrian Georgescu
    <timestamp>2008-09-11T20:42:03Z</timestamp>
273 1 Adrian Georgescu
  </tuple>
274 1 Adrian Georgescu
  <tuple id="eg92n8">
275 1 Adrian Georgescu
    <status>
276 1 Adrian Georgescu
      <basic>open</basic>
277 1 Adrian Georgescu
    </status>
278 1 Adrian Georgescu
    <contact priority="1.0">mailto:someone@example.com</contact>
279 1 Adrian Georgescu
  </tuple>
280 1 Adrian Georgescu
  <note>I'll be in Tokyo next week</note>
281 1 Adrian Georgescu
</presence>
282 1 Adrian Georgescu
<BLANKLINE>
283 15 Adrian Georgescu
</pre>
284 5 Adrian Georgescu
285 5 Adrian Georgescu
286 15 Adrian Georgescu
h2. Rich Presence Extension
287 15 Adrian Georgescu
288 15 Adrian Georgescu
289 1 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/rpid.py]
290 1 Adrian Georgescu
291 15 Adrian Georgescu
RPID handling according to "RFC 4480":http://tools.ietf.org/html/rfc4480. This module provides an extension to PIDF to support rich presence.
292 1 Adrian Georgescu
293 15 Adrian Georgescu
<pre>
294 1 Adrian Georgescu
__all__ = ['_rpid_namespace_',
295 1 Adrian Georgescu
           'ActivityElement',
296 1 Adrian Georgescu
           'MoodElement',
297 1 Adrian Georgescu
           'PlaceTypeElement',
298 1 Adrian Georgescu
           'PrivacyElement',
299 1 Adrian Georgescu
           'SphereElement',
300 1 Adrian Georgescu
           'RPIDNote',
301 1 Adrian Georgescu
           'Activities',
302 1 Adrian Georgescu
           'Mood',
303 1 Adrian Georgescu
           'PlaceIs',
304 1 Adrian Georgescu
           'AudioPlaceInformation',
305 1 Adrian Georgescu
           'VideoPlaceInformation',
306 1 Adrian Georgescu
           'TextPlaceInformation',
307 1 Adrian Georgescu
           'PlaceType',
308 1 Adrian Georgescu
           'AudioPrivacy',
309 1 Adrian Georgescu
           'TextPrivacy',
310 1 Adrian Georgescu
           'VideoPrivacy',
311 1 Adrian Georgescu
           'Privacy',
312 1 Adrian Georgescu
           'Relationship',
313 1 Adrian Georgescu
           'ServiceClass',
314 1 Adrian Georgescu
           'Sphere',
315 1 Adrian Georgescu
           'StatusIcon',
316 1 Adrian Georgescu
           'TimeOffset',
317 1 Adrian Georgescu
           'UserInput',
318 1 Adrian Georgescu
           'Class',
319 1 Adrian Georgescu
           'Other']
320 1 Adrian Georgescu
321 15 Adrian Georgescu
</pre>
322 1 Adrian Georgescu
323 1 Adrian Georgescu
324 15 Adrian Georgescu
h2. Watcher-info
325 15 Adrian Georgescu
326 15 Adrian Georgescu
327 5 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/watcherinfo.py]
328 1 Adrian Georgescu
329 15 Adrian Georgescu
Parses application/watcherinfo+xml documents according to "RFC 3857":http://tools.ietf.org/html/rfc3857 and "RFC3858":http://tools.ietf.org/html/rfc3858.
330 6 Adrian Georgescu
331 1 Adrian Georgescu
Used for parsing of NOTIFY body for presence.winfo event. Used for keeping track of watchers that subscribed to our presentity. Based on this information the authorization rules can be managed using presrules.py. To retrieve this information the SIP client must subscribe to its own address for event presence.winfo.
332 1 Adrian Georgescu
333 1 Adrian Georgescu
334 15 Adrian Georgescu
h3. Example
335 15 Adrian Georgescu
336 15 Adrian Georgescu
337 15 Adrian Georgescu
<pre>
338 1 Adrian Georgescu
>>> winfo_doc='''<?xml version="1.0"?>
339 1 Adrian Georgescu
... <watcherinfo xmlns="urn:ietf:params:xml:ns:watcherinfo"
340 1 Adrian Georgescu
...              version="0" state="full">
341 1 Adrian Georgescu
...   <watcher-list resource="sip:professor@example.net" package="presence">
342 1 Adrian Georgescu
...     <watcher status="active"
343 1 Adrian Georgescu
...              id="8ajksjda7s"
344 1 Adrian Georgescu
...              duration-subscribed="509"
345 1 Adrian Georgescu
...              event="approved" >sip:userA@example.net</watcher>
346 1 Adrian Georgescu
...     <watcher status="pending"
347 1 Adrian Georgescu
...              id="hh8juja87s997-ass7"
348 1 Adrian Georgescu
...              display-name="Mr. Subscriber"
349 1 Adrian Georgescu
...              event="subscribe">sip:userB@example.org</watcher>
350 1 Adrian Georgescu
...   </watcher-list>
351 1 Adrian Georgescu
... </watcherinfo>'''
352 1 Adrian Georgescu
>>> winfo = WatcherInfo()
353 1 Adrian Georgescu
354 1 Adrian Georgescu
The return value of winfo.update() is a dictionary containing WatcherList objects
355 1 Adrian Georgescu
as keys and lists of the updated watchers as values.
356 1 Adrian Georgescu
357 1 Adrian Georgescu
>>> updated = winfo.update(winfo_doc)
358 1 Adrian Georgescu
>>> len(updated['sip:professor@example.net'])
359 1 Adrian Georgescu
2
360 1 Adrian Georgescu
361 1 Adrian Georgescu
winfo.pending, winfo.terminated and winfo.active are dictionaries indexed by
362 1 Adrian Georgescu
WatcherList objects as keys and lists of Wacher objects as values.
363 1 Adrian Georgescu
364 1 Adrian Georgescu
>>> print winfo.pending['sip:professor@example.net'][0]
365 1 Adrian Georgescu
"Mr. Subscriber" <sip:userB@example.org>
366 1 Adrian Georgescu
>>> print winfo.pending['sip:professor@example.net'][1]
367 1 Adrian Georgescu
Traceback (most recent call last):
368 1 Adrian Georgescu
  File "<stdin>", line 1, in <module>
369 1 Adrian Georgescu
IndexError: list index out of range
370 1 Adrian Georgescu
>>> print winfo.active['sip:professor@example.net'][0]
371 1 Adrian Georgescu
sip:userA@example.net
372 1 Adrian Georgescu
>>> len(winfo.terminated['sip:professor@example.net'])
373 1 Adrian Georgescu
0
374 1 Adrian Georgescu
375 1 Adrian Georgescu
winfo.wlists is the list of WatcherList objects
376 1 Adrian Georgescu
377 1 Adrian Georgescu
>>> list(winfo.wlists[0].active) == list(winfo.active['sip:professor@example.net'])
378 1 Adrian Georgescu
True
379 1 Adrian Georgescu
380 1 Adrian Georgescu
See the classes for more information.
381 15 Adrian Georgescu
</pre>
382 1 Adrian Georgescu
383 1 Adrian Georgescu
384 1 Adrian Georgescu
385 15 Adrian Georgescu
h2. XCAP-diff
386 15 Adrian Georgescu
387 15 Adrian Georgescu
388 1 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/xcapdiff.py]
389 1 Adrian Georgescu
390 1 Adrian Georgescu
This module allows parsing and building xcap-diff documents according to RFC5874.
391 1 Adrian Georgescu
392 1 Adrian Georgescu
Used to parse NOTIFY body for xcap-diff event. Used to detect changes in XCAP documents changed by other device configured for the same presentity.
393 1 Adrian Georgescu
394 15 Adrian Georgescu
<pre>
395 1 Adrian Georgescu
__all__ = ['namespace', 
396 14 Adrian Georgescu
    'XCAPDiffApplication', 
397 1 Adrian Georgescu
    'BodyNotChanged', 
398 1 Adrian Georgescu
    'Document', 
399 1 Adrian Georgescu
    'Element', 
400 11 Adrian Georgescu
    'Attribute', 
401 12 Adrian Georgescu
    'XCAPDiff']
402 15 Adrian Georgescu
</pre>
403 12 Adrian Georgescu
404 12 Adrian Georgescu
405 15 Adrian Georgescu
h2. Is-composing
406 15 Adrian Georgescu
407 15 Adrian Georgescu
408 11 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/iscomposing.py]
409 1 Adrian Georgescu
410 1 Adrian Georgescu
This module parses and produces isComposing messages according to RFC3994.
411 5 Adrian Georgescu
412 15 Adrian Georgescu
<pre>
413 1 Adrian Georgescu
__all__ = ['namespace', 
414 1 Adrian Georgescu
    'IsComposingApplication', 
415 1 Adrian Georgescu
    'State', 
416 1 Adrian Georgescu
    'LastActive', 
417 12 Adrian Georgescu
    'ContentType', 
418 12 Adrian Georgescu
    'Refresh', 
419 12 Adrian Georgescu
    'IsComposingMessage']
420 15 Adrian Georgescu
</pre>
421 12 Adrian Georgescu
422 12 Adrian Georgescu
423 15 Adrian Georgescu
h2. Message Summary
424 15 Adrian Georgescu
425 15 Adrian Georgescu
426 5 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/messagesummary.py]
427 5 Adrian Georgescu
428 5 Adrian Georgescu
This module parses and produces message-summary messages according to RF3842.
429 5 Adrian Georgescu
430 5 Adrian Georgescu
431 1 Adrian Georgescu
432 15 Adrian Georgescu
h2. User Agent Capability
433 15 Adrian Georgescu
434 15 Adrian Georgescu
435 8 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/caps.py]
436 8 Adrian Georgescu
437 8 Adrian Georgescu
User Agent Capability Extension handling according to RFC5196
438 8 Adrian Georgescu
439 8 Adrian Georgescu
This module provides an extension to PIDF to describe a user-agent capabilities in the PIDF documents.
440 1 Adrian Georgescu
441 15 Adrian Georgescu
<pre>
442 11 Adrian Georgescu
__all__ = ['caps_namespace',
443 11 Adrian Georgescu
            'Audio',
444 11 Adrian Georgescu
            'Application',
445 11 Adrian Georgescu
            'Data',
446 11 Adrian Georgescu
            'Control',
447 11 Adrian Georgescu
            'Video',
448 11 Adrian Georgescu
            'Video',
449 11 Adrian Georgescu
            'Text',
450 11 Adrian Georgescu
            'Message',
451 11 Adrian Georgescu
            'Type',
452 11 Adrian Georgescu
            'Automata',
453 11 Adrian Georgescu
            'Class',
454 11 Adrian Georgescu
            'ClassPersonal',
455 11 Adrian Georgescu
            'ClassBusiness',
456 11 Adrian Georgescu
            'Duplex',
457 11 Adrian Georgescu
            'DuplexFull',
458 11 Adrian Georgescu
            'DuplexHalf',
459 11 Adrian Georgescu
            'DuplexReceiveOnly',
460 11 Adrian Georgescu
            'DuplexSendOnly',
461 11 Adrian Georgescu
            'Description',
462 11 Adrian Georgescu
            'EventPackages',
463 11 Adrian Georgescu
            'EventConference',
464 11 Adrian Georgescu
            'EventDialog',
465 11 Adrian Georgescu
            'EventKpml',
466 11 Adrian Georgescu
            'EventMessageSummary',
467 11 Adrian Georgescu
            'EventPocSettings',
468 11 Adrian Georgescu
            'EventPresence',
469 11 Adrian Georgescu
            'EventReg',
470 11 Adrian Georgescu
            'EventRefer',
471 11 Adrian Georgescu
            'EventSiemensRtpStats',
472 11 Adrian Georgescu
            'EventSpiritsIndps',
473 11 Adrian Georgescu
            'EventSpiritsUserProf',
474 11 Adrian Georgescu
            'EventWinfo',
475 11 Adrian Georgescu
            'Priority',
476 11 Adrian Georgescu
            'PriorityLowerthan',
477 11 Adrian Georgescu
            'PriorityHigherthan',
478 11 Adrian Georgescu
            'PriorityEquals',
479 11 Adrian Georgescu
            'PriorityRange',
480 11 Adrian Georgescu
            'Methods',
481 11 Adrian Georgescu
            'MethodAck',
482 11 Adrian Georgescu
            'MethodBye',
483 11 Adrian Georgescu
            'MethodCancel',
484 11 Adrian Georgescu
            'MethodInfo',
485 11 Adrian Georgescu
            'MethodInvite',
486 11 Adrian Georgescu
            'MethodMessage',
487 11 Adrian Georgescu
            'MethodNotify',
488 1 Adrian Georgescu
            'MethodOptions',
489 11 Adrian Georgescu
            'MethodPrack',
490 1 Adrian Georgescu
            'MethodPublish',
491 1 Adrian Georgescu
            'MethodRefer',
492 1 Adrian Georgescu
            'MethodRegister',
493 11 Adrian Georgescu
            'MethodSubscribe',
494 11 Adrian Georgescu
            'MethodUpdate',
495 11 Adrian Georgescu
            'Extensions',
496 1 Adrian Georgescu
            'ExtensionRel100',
497 11 Adrian Georgescu
            'ExtensionEarlySession',
498 11 Adrian Georgescu
            'ExtensionEventList',
499 11 Adrian Georgescu
            'ExtensionFromChange',
500 11 Adrian Georgescu
            'ExtensionGruu',
501 11 Adrian Georgescu
            'ExtensionHistinfo',
502 11 Adrian Georgescu
            'ExtensionJoin',
503 1 Adrian Georgescu
            'ExtensionNoRefSub',
504 11 Adrian Georgescu
            'ExtensionPath',
505 1 Adrian Georgescu
            'ExtensionPrecondition',
506 1 Adrian Georgescu
            'ExtensionPref',
507 1 Adrian Georgescu
            'ExtensionPrivacy',
508 11 Adrian Georgescu
            'ExtensionRecipientListInvite',
509 11 Adrian Georgescu
            'ExtensionRecipientListSubscribe',
510 11 Adrian Georgescu
            'ExtensionReplaces',
511 1 Adrian Georgescu
            'ExtensionResourcePriority',
512 11 Adrian Georgescu
            'ExtensionSdpAnat',
513 11 Adrian Georgescu
            'ExtensionSecAgree',
514 11 Adrian Georgescu
            'ExtensionTdialog',
515 11 Adrian Georgescu
            'ExtensionTimer',
516 11 Adrian Georgescu
            'Schemes',
517 11 Adrian Georgescu
            'Scheme',
518 11 Adrian Georgescu
            'Actor',
519 11 Adrian Georgescu
            'ActorPrincipal',
520 11 Adrian Georgescu
            'ActorAttendant',
521 11 Adrian Georgescu
            'ActorMsgTaker',
522 11 Adrian Georgescu
            'ActorInformation',
523 11 Adrian Georgescu
            'IsFocus',
524 11 Adrian Georgescu
            'Languages',
525 11 Adrian Georgescu
            'Language',
526 11 Adrian Georgescu
            'Servcaps',
527 11 Adrian Georgescu
            'Mobility',
528 11 Adrian Georgescu
            'MobilityFixed',
529 11 Adrian Georgescu
            'MobilityMobile',
530 11 Adrian Georgescu
            'Devcaps',
531 11 Adrian Georgescu
            'ServcapsExtension',
532 11 Adrian Georgescu
            'EventPackagesExtension',
533 11 Adrian Georgescu
            'PriorityExtension',
534 11 Adrian Georgescu
            'MethodsExtension',
535 11 Adrian Georgescu
            'ExtensionsExtension',
536 11 Adrian Georgescu
            'DevcapsExtension',
537 11 Adrian Georgescu
            'MobilityExtension']
538 15 Adrian Georgescu
</pre>
539 11 Adrian Georgescu
540 1 Adrian Georgescu
541 15 Adrian Georgescu
h2. CIPID
542 15 Adrian Georgescu
543 15 Adrian Georgescu
544 1 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/cipid.py]
545 8 Adrian Georgescu
546 8 Adrian Georgescu
CIPID handling according to RFC4482. This module provides an extension to PIDF to provide additional contact information about a presentity.
547 8 Adrian Georgescu
548 15 Adrian Georgescu
<pre>
549 1 Adrian Georgescu
__all__ = ['cipid_namespace', 
550 11 Adrian Georgescu
    'Card', 
551 11 Adrian Georgescu
    'DisplayName', 
552 13 Adrian Georgescu
    'Homepage', 
553 13 Adrian Georgescu
    'Icon', 
554 13 Adrian Georgescu
    'Map', 
555 13 Adrian Georgescu
    'Sound']
556 15 Adrian Georgescu
</pre>
557 13 Adrian Georgescu
558 13 Adrian Georgescu
559 15 Adrian Georgescu
h2. Conference
560 15 Adrian Georgescu
561 15 Adrian Georgescu
562 11 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/conference.py]
563 11 Adrian Georgescu
564 11 Adrian Georgescu
Parses and produces conference-info messages according to RFC4575.
565 11 Adrian Georgescu
566 15 Adrian Georgescu
<pre>
567 11 Adrian Georgescu
__all__ = ['namespace',
568 11 Adrian Georgescu
        'ConferenceApplication',
569 11 Adrian Georgescu
        'ConferenceDescription',
570 11 Adrian Georgescu
        'ConfUris',
571 11 Adrian Georgescu
        'ConfUrisEntry',
572 11 Adrian Georgescu
        'ServiceUris',
573 11 Adrian Georgescu
        'ServiceUrisEntry',
574 11 Adrian Georgescu
        'UrisTypeModified',
575 11 Adrian Georgescu
        'UrisTypeEntry',
576 11 Adrian Georgescu
        'AvailableMedia',
577 11 Adrian Georgescu
        'AvailableMediaEntry',
578 11 Adrian Georgescu
        'Users',
579 11 Adrian Georgescu
        'User',
580 11 Adrian Georgescu
        'AssociatedAors',
581 11 Adrian Georgescu
        'Roles',
582 11 Adrian Georgescu
        'Role',
583 11 Adrian Georgescu
        'Endpoint',
584 11 Adrian Georgescu
        'CallInfo',
585 11 Adrian Georgescu
        'Sip',
586 11 Adrian Georgescu
        'Referred',
587 11 Adrian Georgescu
        'JoiningInfo',
588 11 Adrian Georgescu
        'DisconnectionInfo',
589 11 Adrian Georgescu
        'HostInfo',
590 11 Adrian Georgescu
        'HostInfoUris',
591 11 Adrian Georgescu
        'ConferenceState',
592 11 Adrian Georgescu
        'SidebarsByRef',
593 11 Adrian Georgescu
        'SidebarsByVal',
594 11 Adrian Georgescu
        'Conference',
595 11 Adrian Georgescu
        'ConferenceDescriptionExtension']
596 15 Adrian Georgescu
</pre>
597 11 Adrian Georgescu
598 11 Adrian Georgescu
599 15 Adrian Georgescu
h2. Dialog Info
600 15 Adrian Georgescu
601 15 Adrian Georgescu
602 11 Adrian Georgescu
Implemented in [browser:sipsimple/payloads/dialoginfo.py]
603 11 Adrian Georgescu
604 11 Adrian Georgescu
Parses and produces conference-info messages according to RFC4575.
605 11 Adrian Georgescu
606 15 Adrian Georgescu
<pre>
607 11 Adrian Georgescu
608 11 Adrian Georgescu
__all__ = ['namespace',
609 11 Adrian Georgescu
        'DialogInfoApplication',
610 11 Adrian Georgescu
        'DialogState',
611 11 Adrian Georgescu
        'Replaces',
612 11 Adrian Georgescu
        'ReferredBy',
613 11 Adrian Georgescu
        'Identity',
614 11 Adrian Georgescu
        'Param',
615 11 Adrian Georgescu
        'Target',
616 11 Adrian Georgescu
        'Local',
617 11 Adrian Georgescu
        'Remote',
618 11 Adrian Georgescu
        'Dialog',
619 11 Adrian Georgescu
        'DialogInfo']
620 15 Adrian Georgescu
</pre>