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