SipPayloadsApi

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