SipPayloadsApi

Version 15 (Adrian Georgescu, 05/20/2010 12:59 pm)

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