• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Apr-2021-

doc/H15-Apr-2021-599558

MakefileH A D15-Apr-2021870 4234

READMEH A D15-Apr-202112.6 KiB436319

add_events.cH A D15-Apr-20214.5 KiB175119

add_events.hH A D15-Apr-20211.1 KiB365

api.hH A D15-Apr-20211.7 KiB5525

notify_body.cH A D15-Apr-202119.6 KiB835687

notify_body.hH A D15-Apr-20211.2 KiB407

pidf.cH A D15-Apr-20214.3 KiB196134

pidf.hH A D15-Apr-20211.5 KiB4913

pres_check.cH A D15-Apr-20214.8 KiB186141

pres_check.hH A D15-Apr-20211.1 KiB349

presence_xml.cH A D15-Apr-202112.8 KiB546401

presence_xml.hH A D15-Apr-20211.5 KiB5723

xcap_auth.cH A D15-Apr-202114.2 KiB567452

xcap_auth.hH A D15-Apr-20211.4 KiB4713

README

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