XCAP Module

Table of Contents

1. Admin Guide
1.1. Overview
1.2. Dependencies
1.2.1. OpenSIPS Modules
1.3. External Libraries or Applications
1.4. Exported Parameters
1.4.1. db_url(str)
1.4.2. xcap_table(str)
1.4.3. integrated_xcap_server (int)
1.5. Exported Functions
2. Developer Guide
2.1. bind_xcap_api(xcap_api_t* api)
2.2. normalize_xcap_uri
2.3. parse_xcap_uri
2.4. get_xcap_doc
2.5. db_url
2.6. xcap_table
2.7. integrated_server
3. Contributors
3.1. By Commit Statistics
3.2. By Commit Activity
4. Documentation
4.1. Contributors

List of Tables

3.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
3.2. Most recently active contributors(1) to this module

List of Examples

1.1. Set db_url parameter
1.2. Set xcap_table parameter
1.3. Set integrated_xcap_server parameter
2.1. xcap_api structure

Chapter 1. Admin Guide

1.1. Overview

The module contains several parameters and functions common to all modules using XCAP capabilities.

The module is currently used by the following modules: presence_xml, rls and xcap_client.

1.2. Dependencies

1.2.1. OpenSIPS Modules

The following modules must be loaded before this module:

  • a database module.

1.3. External Libraries or Applications

The following libraries or applications must be installed before running OpenSIPS with this module loaded:

  • libxml-dev.

1.4. Exported Parameters

1.4.1. db_url(str)

The database url.

Default value is mysql://opensips:opensipsrw@localhost/opensips.

Example 1.1. Set db_url parameter

modparam("xcap", "db_url", "dbdriver://username:password@dbhost/dbname")

1.4.2. xcap_table(str)

The name of the db table where XCAP documents are stored.

Default value is xcap.

Example 1.2. Set xcap_table parameter

modparam("xcap", "xcap_table", "xcap")

1.4.3. integrated_xcap_server (int)

This parameter is a flag for the type of XCAP server or servers used. If integrated ones, like OpenXCAP from AG Projects, with direct access to database table, the parameter should be set to a positive value. Apart from updating in xcap table, the integrated server must send an MI command refershWatchers [pres_uri] [event] when a user modifies a rules document.

Default value is 0.

Example 1.3. Set integrated_xcap_server parameter

modparam("xcap", "integrated_xcap_server", 1)

1.5. Exported Functions

None to be used in configuration file.

Chapter 2. Developer Guide

The module exports a number of parameters and functions that are used in several other modules.

2.1.  bind_xcap_api(xcap_api_t* api)

This function allows binding the needed functions.

Example 2.1. xcap_api structure

typedef struct xcap_api {
        int integrated_server;
        str db_url;
        str xcap_table;
        normalize_sip_uri_t normalize_sip_uri;
        parse_xcap_uri_t parse_xcap_uri;
        get_xcap_doc_t get_xcap_doc;
} xcap_api_t;

2.2.  normalize_xcap_uri

This function normalizes a SIP URI found in a XCAP document. It un-escapes it and adds the SIP scheme in case it was missing. Returns a statically allocated string buffer containing the normalized form.


  • uri- the URI that needs to be normalized

2.3.  parse_xcap_uri

This function parses the given XCAP URI.


  • uri- the URI that needs to be parsed in string format

  • xcap_uri- xcap_uri_t structure that will be filled with the parsed information

    Parameter type:
    typedef struct {
        char buf[MAX_URI_SIZE];
        str uri;
        str root;
        str auid;
        str tree;
        str xui;
        str filename;
        str selector;
    } xcap_uri_t;

2.4.  get_xcap_doc

This function queries the local DB for the required XCAP document. It will return the document and its corresponding etag.


  • user- user part od the URI of the document owner

  • domain- domain part od the URI of the document owner

  • type- type of the requested document, represents the AUID, can be one of PRES_RULES, RESOURCE_LISTS, RLS_SERVICES, PIDF_MANIPULATION, OMA_PRES_RULES

  • filename- if specified it will be used to match the document filename, it defaults to 'index'

  • match_etag- if specified the document is only returned its etag matches this one

  • doc- reference to the storage for the returned document

  • etag- reference to the storage for the returned document's etag

2.5.  db_url

URL of the database to which the XCAP mdoules witll connect.

2.6.  xcap_table

Name of the table used to store XCAP documents. Defaults to 'xcap'.

2.7.  integrated_server

Boolean flag indicating if the XCAP server has access to the local database or xcap_client will be used to fetch documents.

Chapter 3. Contributors

3.1. By Commit Statistics

Table 3.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)

 NameDevScoreCommitsLines ++Lines --
1. Saúl Ibarra Corretgé (@saghul)143126053
2. Liviu Chircu (@liviuchircu)10755102
3. Razvan Crainea (@razvancrainea)311515
4. Ovidiu Sas (@ovidiusas)31133
5. Bogdan-Andrei Iancu (@bogdan-iancu)2120
6. Vlad Patrascu (@rvlad-patrascu)2120

(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)

(2) including any documentation-related commits, excluding merge commits. Regarding imported patches/code, we do our best to count the work on behalf of the proper owner, as per the "fix_authors" and "mod_renames" arrays in opensips/doc/build-contrib.sh. If you identify any patches/commits which do not get properly attributed to you, please submit a pull request which extends "fix_authors" and/or "mod_renames".

(3) ignoring whitespace edits, renamed files and auto-generated files

3.2. By Commit Activity

Table 3.2. Most recently active contributors(1) to this module

 NameCommit Activity
1. Liviu Chircu (@liviuchircu)Jul 2014 - Jun 2018
2. Vlad Patrascu (@rvlad-patrascu)May 2017 - May 2017
3. Razvan Crainea (@razvancrainea)Aug 2015 - Aug 2015
4. Bogdan-Andrei Iancu (@bogdan-iancu)Oct 2014 - Oct 2014
5. Ovidiu Sas (@ovidiusas)Jan 2013 - Jan 2013
6. Saúl Ibarra Corretgé (@saghul)Nov 2012 - Jan 2013

(1) including any documentation-related commits, excluding merge commits

Chapter 4. Documentation

4.1. Contributors

Last edited by: Liviu Chircu (@liviuchircu), Saúl Ibarra Corretgé (@saghul).

Documentation Copyrights:

Copyright © 2012 AG Projects