|
Main
Resources
Training
Events
Development
|
Presence Server
- Features
- Architecture
- Module Description
- Configuration
- 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.
- 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.
- 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'.
- 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).
- 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:
- active_watchers : stores the active Subscribe dialogs
- presentity: stores the published information
- watchers: stores the subscription status of the watchers
- 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
| Field | Type | Null | Key | Default | Extra |
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| username | varchar(64) | NO | MUL | NULL | |
| domain | varchar(64) | NO | | NULL | |
| event | varchar(64) | NO | | NULL | |
| etag | varchar(64) | NO | | NULL | |
| expires | int(11) | NO | | NULL | |
| received_time | int(11) | NO | | NULL | |
| body | blob | NO | | 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
| Field | Type | Null | Key | Default | Extra |
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| presentity_uri | varchar(128) | NO | MUL | NULL | |
| watcher_username | varchar(64) | NO | | NULL | |
| watcher_domain | varchar(64) | NO | | NULL | |
| to_user | varchar(64) | NO | | NULL | |
| to_domain | varchar(64) | NO | | NULL | |
| event | varchar(64) | NO | | presence | |
| event_id | varchar(64) | YES | | NULL | |
| to_tag | varchar(64) | NO | | NULL | |
| from_tag | varchar(64) | NO | | NULL | |
| callid | varchar(64) | NO | | NULL | |
| local_cseq | int(11) | NO | | NULL | |
| remote_cseq | int(11) | NO | | NULL | |
| contact | varchar(64) | NO | | NULL | |
| record_route | text | YES | | NULL | |
| expires | int(11) | NO | | NULL | |
| status | int(11) | NO | | 2 | |
| reason | varchar(64) | NO | | NULL | |
| version | int(11) | NO | | 0 | |
| socket_info | varchar(64) | NO | | NULL | |
| local_contact | varchar(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
| Field | Type | Null | Key | Default | Extra |
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| presentity_uri | varchar(128) | NO | MUL | NULL | |
| watcher_username | varchar(64) | NO | | NULL | |
| watcher_domain | varchar(64) | NO | | NULL | |
| event | varchar(64) | NO | | presence | |
| status | int(11) | NO | | NULL | |
| reason | varchar(64) | YES | | NULL | |
| inserted_time | int(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
| Field | Type | Null | Key | Default | Extra |
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| username | varchar(64) | NO | MUL | NULL | |
| domain | varchar(64) | NO | | NULL | |
| doc | blob | NO | | NULL | |
| doc_type | int(11) | NO | | NULL | |
| etag | varchar(64) | NO | | NULL | |
| source | int(11) | NO | MUL | NULL | |
| doc_uri | varchar(128) | NO | | NULL | |
| port | int(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;
these four tables are pre-created in the database?
Alcon? — 19 November 2009, 01:20
Thanks for the explanation and the Databases !!
HI,how can i use utf-8 in mysql ?
| Your VoIP Account
News
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...
|