Currently you are not logged in.

 Login | Register 

Main

Resources

Training

Events

Development

Resources -> Documentation -> Presence -> Presence Server

Presence Server

  1. Features
  2. Architecture
  3. Module Description
  4. Configuration
  5. Database

Features

  • privacy rules with XCAP storage
    • a faster integrated xcap mode that uses database as an interface with the XCAP server ( works with OpenXCAP )
  • fast caching with periodic update in database
    • a fallback to database mode can be configured useful when more that one server is used for a domain
  • extensible - new events to be handled by the server can be added easily due to the layered architecture

Architecture

Presence Diagrame (click to enlarge)

Module Description

  • PRESENCE module - a general, event package independent Subscribe, Publish handler – Notify generator according to RFCs 3265 and 3903
  • PRESENCE_XML and **PRESENCE_MWI modules - clients for PRESENCE module; register specific events to be handled by PRESENCE module:
    • presence_xml: 'presence'( RFC 3856) , 'presence.winfo' (RFC 3857), 'dialog;sla' (draft-anil-sipping- bla-03.txt)
    • presence_mwi: 'message-summary' (RFC 3842)
  • XCAP_CLIENT module - an XCAP client interface with data retrieving functionality only, for OpenSER modules.

Configuration

The architecture in the diagram corresponds to a full configuration, when no restrictions are imposed, with privacy permission rules handling enabled and the use of a general XCAP server. There is the possibility to simplify the scheme according to the needs and resources. This can be done by configuring the modules so that some connections are removed or others appear.

  1. The most simple configuration is a presence server without privacy rules, when anybody is allowed to see the presence status of anybody and there is no need for an xcap server. In this case the xcap part disappears from the scheme. You can see a configuration file example for this case here. This mode of operation is configured by setting the flag force_active which is a module parameter for presence_xml module.
  2. If you want presence privacy rules enabled and you use a XCAP server, but one that communicates with the OpenSIPS Presence Server through a database table ( like OpenXCAP) than you can configure the presence server to work in an integrated xcap sever mode. For this you have to set the integrated_xcap_server parameter from presence_xml module. In this case the scheme simplifies by removing the xcap_client module and having the presence_xml module communicates only with the database. See configuration file example here.
    You will notice in the configuration file that the mi_xmlrpc module is also loaded. The MI interface needs to be activated, so that OpenXCAP can signal to OpenSIPS when a change occurs in the presence rules documents. In this way the changes be effective immediately.The MI command that is sent in this case is 'refreshWatchers'.
  3. If you decide to have a presence server with privacy authorization and not use an integrated xcap server, an improvement can be made in this case also. For a non integrated XCAp server, xcap_client module has to be used and the address of the server( or servers) must be set using the presence_xml modules parameter - xcap_server. The xcap_client module has the task to retrieve XCAP documents from XCAP servers and store them in database. Also the module can be asked to synchronize documents saved in database with those on the server. For this a mean of detecting an update is required. The general mean, that apply to every XCAP server is periodical query. There is however the possibility for the server to signal an update to the module. For this the module has to be able to send refreshXcapDoc MI command when an update occurs. If you are using a XCAP server able to send this command then you can configure the server to work in no periodical query mode. For this you have to unset the xcap_client module parameter periodical_query ( set it to 0).
  4. Another configuration option refers to the way the presence module stores information. The default method is caching with periodical update in database for fast processing. However, if you have more presence servers serving the same domain and sharing the same database, this mode will not work. In this case you need to ensure that the servers will be able to communicate through the database. This can be achieved by setting the presence module parameter fallback2db.

Database

Presence Server requires 4 tables in database:

  1. active_watchers : stores the active Subscribe dialogs
  2. presentity: stores the published information
  3. watchers: stores the subscription status of the watchers
  4. xcap: stores the XCAP documents

The first three tables are only used internally by the server. The xcap table is either used as a communication interface between the XCAP server (if the server is working in 'integrated_xcap' mode) or as a communication means between the xcap_client module which populates the table and presence_xml module which uses that information.

The description of the tables

presentity

FieldTypeNullKeyDefaultExtra
idint(10) unsignedNOPRINULLauto_increment
usernamevarchar(64)NOMULNULL 
domainvarchar(64)NO NULL 
eventvarchar(64)NO NULL 
etagvarchar(64)NO NULL 
expiresint(11)NO NULL 
received_timeint(11)NO NULL 
bodyblobNO NULL 
CREATE TABLE `presentity` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `domain` varchar(64) NOT NULL,
  `event` varchar(64) NOT NULL,
  `etag` varchar(64) NOT NULL,
  `expires` int(11) NOT NULL,
  `received_time` int(11) NOT NULL,
  `body` blob NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `presentity_idx` (`username`,`domain`,`event`,`etag`)
) ENGINE=MyISAM;

active_watchers

FieldTypeNullKeyDefaultExtra
idint(10) unsignedNOPRINULLauto_increment
presentity_urivarchar(128)NOMULNULL 
watcher_usernamevarchar(64)NO NULL 
watcher_domainvarchar(64)NO NULL 
to_uservarchar(64)NO NULL 
to_domainvarchar(64)NO NULL 
eventvarchar(64)NO presence 
event_idvarchar(64)YES NULL 
to_tagvarchar(64)NO NULL 
from_tagvarchar(64)NO NULL 
callidvarchar(64)NO NULL 
local_cseqint(11)NO NULL 
remote_cseqint(11)NO NULL 
contactvarchar(64)NO NULL 
record_routetextYES NULL 
expiresint(11)NO NULL 
statusint(11)NO 2 
reasonvarchar(64)NO NULL 
versionint(11)NO 0 
socket_infovarchar(64)NO NULL 
local_contactvarchar(128)NO NULL 
CREATE TABLE `active_watchers` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `presentity_uri` varchar(128) NOT NULL,
  `watcher_username` varchar(64) NOT NULL,
  `watcher_domain` varchar(64) NOT NULL,
  `to_user` varchar(64) NOT NULL,
  `to_domain` varchar(64) NOT NULL,
  `event` varchar(64) NOT NULL default 'presence',
  `event_id` varchar(64) default NULL,
  `to_tag` varchar(64) NOT NULL,
  `from_tag` varchar(64) NOT NULL,
  `callid` varchar(64) NOT NULL,
  `local_cseq` int(11) NOT NULL,
  `remote_cseq` int(11) NOT NULL,
  `contact` varchar(64) NOT NULL,
  `record_route` text,
  `expires` int(11) NOT NULL,
  `status` int(11) NOT NULL default '2',
  `reason` varchar(64) NOT NULL,
  `version` int(11) NOT NULL default '0',
  `socket_info` varchar(64) NOT NULL,
  `local_contact` varchar(128) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `active_watchers_idx` (`presentity_uri`,`callid`,`to_tag`,`from_tag`)
) ENGINE=MyISAM; 

watchers

FieldTypeNullKeyDefaultExtra
idint(10) unsignedNOPRINULLauto_increment
presentity_urivarchar(128)NOMULNULL 
watcher_usernamevarchar(64)NO NULL 
watcher_domainvarchar(64)NO NULL 
eventvarchar(64)NO presence 
statusint(11)NO NULL 
reasonvarchar(64)YES NULL 
inserted_timeint(11)NO NULL 
CREATE TABLE `watchers` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `presentity_uri` varchar(128) NOT NULL,
  `watcher_username` varchar(64) NOT NULL,
  `watcher_domain` varchar(64) NOT NULL,
  `event` varchar(64) NOT NULL default 'presence',
  `status` int(11) NOT NULL,
  `reason` varchar(64) default NULL,
  `inserted_time` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `watcher_idx` (`presentity_uri`,`watcher_username`,`watcher_domain`,`event`)
) ENGINE=MyISAM;

xcap

FieldTypeNullKeyDefaultExtra
idint(10) unsignedNOPRINULLauto_increment
usernamevarchar(64)NOMULNULL 
domainvarchar(64)NO NULL 
docblobNO NULL 
doc_typeint(11)NO NULL 
etagvarchar(64)NO NULL 
sourceint(11)NOMULNULL 
doc_urivarchar(128)NO NULL 
portint(11)NO NULL 
CREATE TABLE `xcap` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `domain` varchar(64) NOT NULL,
  `doc` blob NOT NULL,
  `doc_type` int(11) NOT NULL,
  `etag` varchar(64) NOT NULL,
  `source` int(11) NOT NULL,
  `doc_uri` varchar(128) NOT NULL,
  `port` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `account_doc_type_idx` (`username`,`domain`,`doc_type`,`doc_uri`),
  KEY `source_idx` (`source`)
) ENGINE=MyISAM;

Shreyas?27 August 2009, 11:14

Great!!!!!!!

Sanjeev?09 September 2009, 06:21

these four tables are pre-created in the database?
[bogdan] yes, they are created with "opesipsdbctl" tool

CheeWii?01 November 2009, 08:00

yehn..

Alcon?19 November 2009, 01:20

Thanks for the explanation and the Databases !!

china users?15 December 2009, 10:20

HI,how can i use utf-8 in mysql ?
[bogdan] when creating the tables, you can select a charset to be used

Add Comment 
Sign as Author 
Enter code 447

Your VoIP Account

News

OpenSIPS LiveDVD

04th of August 2010 OpenSIPS Virtual Machine is now available ...
Read more...

OpenSIPS 1.6.3

02nd of August 2010 OpenSIPS 1.6.3 major release gets better...
Read more...

OpenSIPS @ ClueCon

29th of July 2010 OpenSIPS 2.0 @ ClueCon 2010.
Read more...

OpenSIPS eBootcamp

12th of July 2010 Remote OpenSIPS learning with Ebootcamp program.
Read more...

OpenSIPS @ Amoocon 2010

4th of May 2010 OpenSIPS had 2 papers at Amoocon 2010.
Read more...

SIMPLE Aggregation

14th of April 2010 Presence and BLF state aggregation.
Read more...

OpenSIPS Certified Professional

13th of April 2010 OpenSIPS certification program launched.
Read more...

OpenSIPS webinar

30th of March 2010 Next webinars is Variables in OpenSIPS scripting
Read more...

OpenSIPS 1.6.2

11th of March 2010 OpenSIPS 1.6.2 is brings new features...
Read more...

OpenSIPS Control Panel 4.0

08th of March 2010 OpenSIPS CP 4.0 comes with user provisioning...
Read more...

Conference on "OpenSIPS 2.0"

5th of March 2010 VoIP Users Conference will host an audio conference
Read more...

OpenSIPS webinar

25th of February 2010 Next webinars is Explaining the default script
Read more...

OpenSIPS 2.0 Design

15th of February 2010 Design of OpenSIPS 2.0 is unveiled
Read more...

OpenSIPS webinar

28th of January 2010 Next OpenSIPS webinars is SIP Introduction
Read more...

Building Telephony Systems with OpenSIPS 1.6

21st of January 2010 New edition is available...
Read more...

OpenSIPS 1.6.1 is released

21st of December 2009 OpenSIPS 1.6.1 minor release is out...
Read more...

OpenSIPS Development Course

17th of December 2009 OpenSIPS Devel Course for 2010...
Read more...

OpenSIPS Bootcamps 2010

09th of December 2009 2010 Schedule for Bootcamp events...
Read more...

User Location is faster

13th of November 2009 USRLOC is 3 time faster than before...
Read more...

OpenSIPS Control Panel 3.0

30th of October 2009 OpenSIPS CP 3.0 major release is out...
Read more...

OpenSIPS 1.6.0 is released

16th of October 2009 OpenSIPS 1.6.0 major release is out...
Read more...

OpenSIPS VoIP Service

21th of September 2009 OpenSIPS project offers free VoIP services...
Read more...

OpenSIPS & Astricon

21th of September 2009 OpenSIPS talks and exhibits at Astricon 2009...
Read more...

SVN freeze

17th of September 2009 SVN trunk gets frozen to prepare 1.6 release...
Read more...

New types of script routes

10th of September 2009 New additions to configuration file routes...
Read more...

STUN server

7th of September 2009 OpenSIPS has now a built-in STUN server...
Read more...

Pseudovariable implementation extended

3rd of September 2009 Added new operations for pvars to give more power to the script writer...
Read more...

OpenSIPS Asterisk Integration

30th of August 2009 Tutorial for realtime integration...
Read more...

OpenSIPS 1.5.3 is released

27th of August 2009 OpenSIPS 1.5.3 minor release is out...
Read more...

AAA and RADIUS support

18th of April 2009 New AAA API and RADIUS enhancements in OpenSIPS
Read more...

OpenSIPS webinar

4th of April 2009 Next OpenSIPS webinars is Types of Routs in OpenSIPS
Read more...

B2BUA

3rd of August 2009 A B2BUA signaling implementation in OpenSIPS
Read more...

DB virtual

23th of July 2009 A DB conn mixer for failover, parallel and LB
Read more...

Codec manipulation

23th of July 2009 SDP codecs and priorities manipulation
Read more...

Memcached interfacing

16th of July 2009 memcached support for memory caching API
Read more...

OpenSIPS 1.5.2 is released

15th of July 2009 OpenSIPS 1.5.2 minor release is out...
Read more...

OpenSIPS@ClueCon

14th of July 2009 OpenSIPS talks at ClueCon
Read more...

OpenSIPS webinar

30th of June 2009 Next OpenSIPS webinars is Routing in SIP
Read more...

REGISTRAR enhancements

29th of June 2009 REGISTRAR module becomes more flexible
Read more...

OpenSIPS free webinars

01st of June 2009 OpenSIPS webinars program was launched
Read more...

OpenSIPS-CP 2.0 is released

13rd of April 2009 OpenSIPS Control Panel 2.0 major release is out...
Read more...

OpenSIPS 1.5.1 is released

13rd of April 2009 OpenSIPS 1.5.1 minor release is out...
Read more...

OpenSIPS 1.5.0 is released

23rd of March 2009 OpenSIPS 1.5.0 major release is out...
Read more...

OpenSIPS 1.4.5 is released

23rd of March 2009 OpenSIPS 1.4.5 minor release is out...
Read more...

OpenSIPS as Load Balancer

4th of March 2009
How to do real Load-Balancing for media servers ...
Read more...

OpenSIPS at Amoocon (AsteriskTAG)

24th of February 2009
3 hot topics presented at Amoocon ...
Read more...


Edit | History | Print | Recent Changes | Search
Page last modified on February 18, 2010, at 11:15 AM