Table of Contents
List of Examples
db_url
parameterxcap_table
parameterdisable_presence
parameterdisable_winfo
parameterdisable_bla
parameterforce_active
parameterpidf_manipulation
parameterintegrated_xcap_server
parameterxcap_server
parameterpassive_mode
parameterpres_check_basic
usagepres_check_activities
usageTable of Contents
The module does specific handling for notify-subscribe events using xml bodies. It is used with the general event handling module, presence. It constructs and adds 3 events to it:
presence - SIMPLE status presence: RFC 3856
presence.winfo - SIMPLE watcher info: RFC 3857
dialog;sla (or dialog;ma) - Bridged Line Appearances (BLA) (or Multiple Line Appearances (MLA)): draft-anil-sipping-bla
You can control which events are enabled via module parameters.
This module takes the XCAP permission rule documents from xcap_table. The presence permission rules are interpreted according to the specifications in RFC 4745 and RFC 5025.
The following modules must be loaded before this module:
a database module.
presence.
sl.
xcap_client.
Only compulsory if not using an integrated xcap server (if 'integrated_xcap_server' parameter is not set).
The database URL.
Default value is “mysql://openser:openserrw@localhost/openser”.
Example 1.1. Set db_url
parameter
... modparam("presence_xml", "db_url", "dbdriver://username:password@dbhost/dbname") ...
The name of the database table where XCAP documents are stored.
Default value is “xcap”.
Set this parameter to disable the handling of the "presence" event.
Default value: “0”.
Set this parameter to disable the handling of the "presence.winfo" event.
Default value: “0”.
Set this parameter to disable the handling of the "dialog;sla" event.
Default value: “1” (0 - enabled, 1 - disabled).
This parameter is used for permissions when handling Subscribe messages. If set to 1, subscription state is considered active and the presentity is not queried for permissions (should be set to 1 if not using an XCAP server). Otherwise, the XCAP server is queried and the subscription states is according to user defined permission rules. If no rules are defined for a certain watcher, the subscriptions remains in pending state and the Notify sent will have no body.
Note: When switching from one value to another, the watchers table must be emptied.
Default value is “0”.
Setting this parameter to 1 enables the features described in RFC 4827. It gives the possibility to have a permanent state notified to the users even in the case in which the phone is not online. The presence document is taken from the XCAP server and aggregated together with the other presence information, if any exist, for each Notify that is sent to the watchers. It is also possible to have information notified even if not issuing any Publish (useful for services such as email, SMS, MMS).
Default value is “0”.
Example 1.7. Set pidf_manipulation
parameter
... modparam("presence_xml", "pidf_manipulation", 1) ...
This parameter is a flag for the type of XCAP servers used. If the XCAP server is integrated with Kamailio presence_xml module and access the same database tables directly, like the embedded XCAP server implemented in xcap_server module, the parameter should be set to a positive value. Apart from updating in xcap table, if the integrated server is not running on the same Kamailio instance, it must send an MI command refershWatchers [pres_uri] [event] when a user modifies a rules document, to instruct the presence_xml module to update states from the database and, if needed, send NOTIFY updates.
Otherwise, it uses xcap_client module to fetch documents from the XCAP servers with HTTP requests. This mode is currently not supported.
Default value is “0”.
Example 1.8. Set integrated_xcap_server
parameter
... modparam("presence_xml", "integrated_xcap_server", 1) ...
The address of the xcap servers used for storage. This parameter is compulsory if the integrated_xcap_server parameter is not set. It can be set more that once, to construct an address list of trusted XCAP servers.
Example 1.9. Set xcap_server
parameter
... modparam("presence_xml", "xcap_server", "xcap_server.example.org") modparam("presence_xml", "xcap_server", "xcap_server.ag.org") ...
If set to 1, module acts in passive mode - no bind to presence module, no connection to database. Useful when needing only to use $xml(...) pseudoc-variable.
Default value: “0” (0 - active mode, 1 - passive mode).
Checks the /presence/tuple/status/basic nodes in the presentity for presentity_uri against the value in status.
This function can be used from ANY_ROUTE.
Return code:
1 - if a match is found.
-1 - if a match is not found.
Example 1.11. pres_check_basic
usage
... if (pres_check_basic("$ru", "open")) { ... } else { if (is_method("MESSAGE")) m_store(); else send_reply("404", "Not Found"); } ...
Checks whether a /presence/person/activities/activity node exists in the presentity for presentity_uri.
This function can be used from ANY_ROUTE.
Return code:
1 - if a match is found.
-1 - if a match is not found.
-2 - if /presence/person or /presence/person/activity do not exist.
Example 1.12. pres_check_activities
usage
... if (pres_check_basic("$ru", "open")) { pres_check_activities("$ru", "unknown"); if ($retcode || $retcode == -2 || !is_method("INVITE")) t_relay(); else send_reply("486", "Busy Here"); } else { ... } ...
The module requires one table in Kamailio database: “xcap”. The SQL syntax to create it can be found in presence-create.sql script in the database directories in the kamailio/scripts folder. You can also find the complete database documentation on the project webpage, http://www.kamailio.org/docs/db-tables/kamailio-db-devel.html.
$xml(name=>spec)
Exported pseudo-variables are documented at http://www.kamailio.org/dokuwiki/.