Debian Codegraph @

src/modules/presence_xml/README

raw
1 Presence_XML Module
2
3 Anca-Maria Vamanu
4
5 Voice Sistem SRL
6
7 Edited by
8
9 Anca-Maria Vamanu
10
11 Copyright © 2007 Voice Sistem SRL
12 __________________________________________________________________
13
14 Table of Contents
15
16 1. Admin Guide
17
18 1. Overview
19 2. Dependencies
20
21 2.1. Kamailio Modules
22 2.2. External Libraries or Applications
23
24 3. Parameters
25
26 3.1. db_url(str)
27 3.2. xcap_table(str)
28 3.3. disable_presence(int)
29 3.4. disable_winfo(int)
30 3.5. disable_bla(int)
31 3.6. disable_xcapdiff(int)
32 3.7. force_active (int)
33 3.8. integrated_xcap_server (int)
34 3.9. xcap_server (str)
35 3.10. passive_mode(int)
36 3.11. xcapauth_userdel_reason(str)
37 3.12. force_dummy_presence(int)
38 3.13. force_presence_single_body(int)
39 3.14. presence_single_body_priorities(str)
40 3.15. presence_single_body_lookup_element(str)
41 3.16. default_expires (int)
42
43 4. Functions
44
45 4.1. pres_check_basic(presentity_uri, status)
46 4.2. pres_check_activities(presentity_uri, activity)
47
48 5. Installation
49
50 2. Developer Guide
51
52 List of Examples
53
54 1.1. Set db_url parameter
55 1.2. Set xcap_table parameter
56 1.3. Set disable_presence parameter
57 1.4. Set disable_winfo parameter
58 1.5. Set disable_bla parameter
59 1.6. Set disable_xcapdiff parameter
60 1.7. Set force_active parameter
61 1.8. Set integrated_xcap_server parameter
62 1.9. Set xcap_server parameter
63 1.10. Set passive_mode parameter
64 1.11. Set xcapauth_userdel_reason parameter
65 1.12. Set force_dummy_presence parameter
66 1.13. Set force_presence_single_body parameter
67 1.14. Set presence_single_body_priorities parameter
68 1.15. Set presence_single_body_lookup_element parameter
69 1.16. Set default_expires parameter
70 1.17. pres_check_basic usage
71 1.18. pres_check_activities usage
72
73 Chapter 1. Admin Guide
74
75 Table of Contents
76
77 1. Overview
78 2. Dependencies
79
80 2.1. Kamailio Modules
81 2.2. External Libraries or Applications
82
83 3. Parameters
84
85 3.1. db_url(str)
86 3.2. xcap_table(str)
87 3.3. disable_presence(int)
88 3.4. disable_winfo(int)
89 3.5. disable_bla(int)
90 3.6. disable_xcapdiff(int)
91 3.7. force_active (int)
92 3.8. integrated_xcap_server (int)
93 3.9. xcap_server (str)
94 3.10. passive_mode(int)
95 3.11. xcapauth_userdel_reason(str)
96 3.12. force_dummy_presence(int)
97 3.13. force_presence_single_body(int)
98 3.14. presence_single_body_priorities(str)
99 3.15. presence_single_body_lookup_element(str)
100 3.16. default_expires (int)
101
102 4. Functions
103
104 4.1. pres_check_basic(presentity_uri, status)
105 4.2. pres_check_activities(presentity_uri, activity)
106
107 5. Installation
108
109 1. Overview
110
111 The module does specific handling for notify-subscribe events using xml
112 bodies. It is used with the general event handling module, presence. It
113 constructs and adds 3 events to it:
114 * presence - SIMPLE status presence: RFC 3856
115 * presence.winfo - SIMPLE watcher info: RFC 3857
116 * dialog;sla (or dialog;ma) - Bridged Line Appearances (BLA) (or
117 Multiple Line Appearances (MLA)): draft-anil-sipping-bla
118
119 You can control which events are enabled via module parameters.
120
121 This module takes the XCAP permission rule documents from xcap_table.
122 The presence permission rules are interpreted according to the
123 specifications in RFC 4745 and RFC 5025.
124
125 2. Dependencies
126
127 2.1. Kamailio Modules
128 2.2. External Libraries or Applications
129
130 2.1. Kamailio Modules
131
132 The following modules must be loaded before this module:
133 * a database module.
134 * presence.
135 * sl.
136 * xcap_client.
137 Needed only when not using the integrated xcap server (if
138 'integrated_xcap_server' parameter is set to 0).
139
140 2.2. External Libraries or Applications
141
142 The following libraries or applications must be installed before
143 running Kamailio with this module loaded:
144 * libxml.
145
146 3. Parameters
147
148 3.1. db_url(str)
149 3.2. xcap_table(str)
150 3.3. disable_presence(int)
151 3.4. disable_winfo(int)
152 3.5. disable_bla(int)
153 3.6. disable_xcapdiff(int)
154 3.7. force_active (int)
155 3.8. integrated_xcap_server (int)
156 3.9. xcap_server (str)
157 3.10. passive_mode(int)
158 3.11. xcapauth_userdel_reason(str)
159 3.12. force_dummy_presence(int)
160 3.13. force_presence_single_body(int)
161 3.14. presence_single_body_priorities(str)
162 3.15. presence_single_body_lookup_element(str)
163 3.16. default_expires (int)
164
165 3.1. db_url(str)
166
167 The database URL.
168
169 Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”.
170
171 Example 1.1. Set db_url parameter
172 ...
173 modparam("presence_xml", "db_url", "dbdriver://username:password@dbhost/dbname")
174 ...
175
176 3.2. xcap_table(str)
177
178 The name of the database table where XCAP documents are stored.
179
180 Default value is “xcap”.
181
182 Example 1.2. Set xcap_table parameter
183 ...
184 modparam("presence_xml", "xcap_table", "xcaps")
185 ...
186
187 3.3. disable_presence(int)
188
189 Set this parameter to disable the handling of the "presence" event.
190
191 Default value: “0”.
192
193 Example 1.3. Set disable_presence parameter
194 ...
195 modparam("presence_xml", "disable_presence", 1)
196 ...
197
198 3.4. disable_winfo(int)
199
200 Set this parameter to disable the handling of the "presence.winfo"
201 event.
202
203 Default value: “0”.
204
205 Example 1.4. Set disable_winfo parameter
206 ...
207 modparam("presence_xml", "disable_winfo", 1)
208 ...
209
210 3.5. disable_bla(int)
211
212 Set this parameter to disable the handling of the "dialog;sla" event.
213
214 Default value: “1” (0 - enabled, 1 - disabled).
215
216 Example 1.5. Set disable_bla parameter
217 ...
218 modparam("presence_xml", "disable_bla", 1)
219 ...
220
221 3.6. disable_xcapdiff(int)
222
223 Set this parameter to disable the handling of the "xcap-diff" event.
224
225 Default value: “0”.
226
227 Example 1.6. Set disable_xcapdiff parameter
228 ...
229 modparam("presence_xml", "disable_xcapdiff", 1)
230 ...
231
232 3.7. force_active (int)
233
234 This parameter is used for permissions when handling Subscribe
235 messages. If set to 1, subscription state is considered active and the
236 presentity is not queried for permissions (should be set to 1 if not
237 using an XCAP server). Otherwise, the XCAP server is queried and the
238 subscription states is according to user defined permission rules. If
239 no rules are defined for a certain watcher, the subscriptions remains
240 in pending state and the Notify sent will have no body.
241
242 Note: When switching from one value to another, the watchers table must
243 be emptied.
244
245 Default value is “0”.
246
247 Example 1.7. Set force_active parameter
248 ...
249 modparam("presence_xml", "force_active", 1)
250 ...
251
252 3.8. integrated_xcap_server (int)
253
254 This parameter is a flag for the type of XCAP servers used. If the XCAP
255 server is integrated with Kamailio presence_xml module and access the
256 same database tables directly, like the embedded XCAP server
257 implemented in xcap_server module, the parameter has to be set to 1.
258 Apart from updating in xcap table, if the integrated server is not
259 running on the same Kamailio instance, it must send an RPC command
260 presence.refreshWatchers [pres_uri] [event] when a user modifies a
261 rules document, to instruct the presence_xml module to update states
262 from the database and, if needed, send NOTIFY updates.
263
264 Otherwise (if set to 0) it uses xcap_client module to fetch documents
265 from the XCAP servers with HTTP requests.
266
267 Default value is “0”.
268
269 Example 1.8. Set integrated_xcap_server parameter
270 ...
271 modparam("presence_xml", "integrated_xcap_server", 1)
272 ...
273
274 3.9. xcap_server (str)
275
276 The address of the xcap servers used for storage. This parameter is
277 compulsory if the integrated_xcap_server parameter is not set. It can
278 be set more than once, to construct an address list of trusted XCAP
279 servers.
280
281 Example 1.9. Set xcap_server parameter
282 ...
283 modparam("presence_xml", "xcap_server", "xcap_server.example.org")
284 modparam("presence_xml", "xcap_server", "xcap_server.ag.org")
285 ...
286
287 3.10. passive_mode(int)
288
289 If set to 1, module acts in passive mode - no bind to presence module,
290 no connection to database. Useful when needing only to use $xml(...)
291 pseudo-variable.
292
293 Default value: “0” (0 - active mode, 1 - passive mode).
294
295 Example 1.10. Set passive_mode parameter
296 ...
297 modparam("presence_xml", "passive_mode", 1)
298 ...
299
300 3.11. xcapauth_userdel_reason(str)
301
302 This parameter represents the reason that will be included in the
303 Subscription-State header of the Notify when a rule is no longer found
304 in the XCAP pres-auth document for a user that was previously allowed.
305 The Subscription state in this case switches to "terminated". Because
306 it is not clear which reason is most appropriate in this case from the
307 ones defined by the RFC 3265, this parameter offers the possibility for
308 the admin to decide which one he wishes to use.
309
310 Default value: “probation” . Since probation also accepts a retry-after
311 parameter to specify after at least how may seconds the client should
312 reattempt to resubscribe, you can include this in the parameter also.
313
314 Example 1.11. Set xcapauth_userdel_reason parameter
315 ...
316 modparam("presence_xml", "xcapauth_userdel_reason", "probation;retry-after=30")
317 modparam("presence_xml", "xcapauth_userdel_reason", "rejected")
318 ...
319
320 3.12. force_dummy_presence(int)
321
322 Set this parameter to enable simple body notify with status 'open' when
323 presentity info is not available.
324
325 Default value: “0”.
326
327 Example 1.12. Set force_dummy_presence parameter
328 ...
329 modparam("presence_xml", "force_dummy_presence", 1)
330 ...
331
332 3.13. force_presence_single_body(int)
333
334 Set this parameter to enable single body notify. One presentity can
335 have multiple dialogs and will by default notify all the dialogs and
336 this can be a problem when dealing with large ring-groups or
337 attendants, use this parameter to only send one body. Look at
338 presence_single_body_priorities and presence_single_body_lookup_element
339 to customize the behaviour.
340
341 Default value: “0”.
342
343 Example 1.13. Set force_presence_single_body parameter
344 ...
345 modparam("presence_xml", "force_presence_single_body", 1)
346 ...
347
348 3.14. presence_single_body_priorities(str)
349
350 Change this parameter to set the priorities when choosing the dialog
351 that will be the final.
352
353 Importance is left to right.
354
355 Default value: “Available|Ringing|On the Phone”.
356
357 Example 1.14. Set presence_single_body_priorities parameter
358 ...
359 modparam("presence_xml", "presence_single_body_priorities", "Offline|Online|Busy
360 |Really Busy")
361 ...
362
363 3.15. presence_single_body_lookup_element(str)
364
365 Set the name of the element that should be used to get the priority. If
366 the value obtained is not in the list of
367 presence_single_body_priorities the priority is 0.
368
369 Default value: “note”.
370
371 Example 1.15. Set presence_single_body_lookup_element parameter
372 ...
373 modparam("presence_xml", "presence_single_body_lookup_element", "status")
374 ...
375
376 3.16. default_expires (int)
377
378 The default expires value used when missing from SUBSCRIBE message (in
379 seconds).
380
381 Default value is “3600”.
382
383 Example 1.16. Set default_expires parameter
384 ...
385 modparam("presence_xml", "default_expires", 3600)
386 ...
387
388 4. Functions
389
390 4.1. pres_check_basic(presentity_uri, status)
391 4.2. pres_check_activities(presentity_uri, activity)
392
393 4.1. pres_check_basic(presentity_uri, status)
394
395 Checks the /presence/tuple/status/basic nodes in the presentity for
396 presentity_uri against the value in status.
397
398 This function can be used from ANY_ROUTE.
399
400 Return code:
401 * 1 - if a match is found.
402 * -1 - if a match is not found.
403
404 Example 1.17. pres_check_basic usage
405 ...
406 if (pres_check_basic("$ru", "open")) {
407 ...
408 } else {
409 if (is_method("MESSAGE"))
410 m_store();
411 else
412 send_reply("404", "Not Found");
413 }
414 ...
415
416 4.2. pres_check_activities(presentity_uri, activity)
417
418 Checks whether a /presence/person/activities/activity node exists in
419 the presentity for presentity_uri.
420
421 This function can be used from ANY_ROUTE.
422
423 Return code:
424 * 1 - if a match is found.
425 * -1 - if a match is not found.
426 * -2 - if /presence/person or /presence/person/activity do not exist.
427
428 Example 1.18. pres_check_activities usage
429 ...
430 if (pres_check_basic("$ru", "open")) {
431 pres_check_activities("$ru", "unknown");
432 if ($retcode || $retcode == -2 || !is_method("INVITE"))
433 t_relay();
434 else
435 send_reply("486", "Busy Here");
436 } else {
437 ...
438 }
439 ...
440
441 5. Installation
442
443 The module requires one table in Kamailio database: “xcap”. The SQL
444 syntax to create it can be found in presence-create.sql script in the
445 database directories in the kamailio/scripts folder. You can also find
446 the complete database documentation on the project webpage,
447 https://www.kamailio.org/docs/db-tables/kamailio-db-devel.html.
448
449 Chapter 2. Developer Guide
450
451 The module exports no function to be used in other Kamailio modules.