db_url
(str)presentity_table
(str)active_watchers_table
(str)watchers_table
(str)xcap_table
(str)clean_period
(int)to_tag_pref
(str)lock_set_size
(int)expires_offset
(int)force_active
(int)max_expires
(int)server_address
(str)handle_publish()
handle_subscribe()
db_url
parameterpresentity_table
parameteractive_watchers_table
parameterwatchers_table
parameterxcap_table
parameterclean_period
parameterto_tag_pref
parameterlock_set_size
parameterexpires_offset
parameterforce_active
parametermax_expires
parameterserver_address
parameterhandle_publish
usagehandle_subscribe
usageThe modules implements a presence server. It handles PUBLISH and SUBSCRIBE messages and generates NOTIFY messages. It offers support for aggregation of published presence information for the same presentity using more devices. It can also filter the information provided to watchers according to privacy rules.
The modules works with database storage. It stores published information and Subscribe -Notify dialog characteristics. There is also an extra table which stores xcap documents with permission rules.
The server follows the specifications in: RFC3265, RFC3856, RFC3857, RFC3858.
The following modules must be loaded before this module:
a database module.
sl.
tm.
The following libraries or applications must be installed before running OpenSER with this module loaded:
libxml.
presentity_table
(str)The name of the db table where Publish information are stored.
Default value is "presentity".
active_watchers_table
(str)The name of the db table where active subscription information are stored.
Default value is "active_watchers".
watchers_table
(str)The name of the db table where subscription states are stored.
Default value is "watchers".
xcap_table
(str)The name of the db table where XCAP XMLs are stored.
Default value is "scap_xml".
clean_period
(int)The period at which to verify if there are expired messages stored in database.
Default value is "100".
to_tag_pref
(str)The prefix used when generating to_tag when sending replies for SUBSCRIBE requests.
Default value is "10".
lock_set_size
(int)The size of the lock used for synchronizing updating information from database.
Default value is "8".
expires_offset
(int)The value that should be subtracted from the expires value when sending a 200OK for a publish. It is used for forcing the client cu send an update before the old publish expires.
Default value is "0".
force_active
(int)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. Otherwise, the xcap_table is queried and the state is extracted from there. If no record exists, the subscriptions remains in pending state and the watcher receives Notify messages with no body. ( If not using an xcap server, you should set this parameter to 1).
Default value is "0".
max_expires
(int)The the maximum admissible expires value for PUBLISH/SUBSCRIBE message.
Default value is "3600".
server_address
(str)The presence server address which will become the value of Contact header filed for 200OK replyes to Subscribe and Publish and in Notify messages.
handle_publish()
The function handles PUBLISH requests. It stores and updates presence information in database and calls functions to send NOTIFY messages when changes in presence information occur.
This function can be used from REQUEST_ROUTE.
Return code:
1 - if success.
-1 - if error.
The module sends an appropriate stateless reply in all cases.
handle_subscribe()
The function which handles SUBSCRIBE requests. It stores or updates information in database and calls functions to send Notify messages when a Subscribe which initiate a dialog is received
This function can be used from REQUEST_ROUTE.
Return code:
1 - if success.
-1 - if error.
The module sends an appropriate stateless reply in all cases.
The module requires 4 table in OpenSER database. Next SQL statements shows the syntax to create them.
Example 1-15. PRESENCE tables
... use openser; CREATE TABLE `presentity` ( `id` int(10) NOT NULL auto_increment, `username` varchar(64) NOT NULL, `domain` varchar(124) NOT NULL, `event` varchar(64) NOT NULL, `etag` varchar(64) NOT NULL, `expires` int(11) NOT NULL, `received_time` int(11) NOT NULL, `body` text NOT NULL, UNIQUE KEY udee_presentity (`username`,`domain`,`event`,`etag`), PRIMARY KEY (id) ) ENGINE=MyISAM; CREATE TABLE `active_watchers` ( `id` int(10) NOT NULL auto_increment, `to_user` varchar(64) NOT NULL, `to_domain` varchar(128) NOT NULL, `from_user` varchar(64) NOT NULL, `from_domain` varchar(128) NOT NULL, `event` varchar(64) NOT NULL default 'presence', `event_id` varchar(64), `to_tag` varchar(128) NOT NULL, `from_tag` varchar(128) NOT NULL, `callid` varchar(128) NOT NULL, `remote_cseq` int(11) NOT NULL, `local_cseq` int(11) NOT NULL, `contact` varchar(128) NOT NULL, `record_route` varchar(255), `expires` int(11) NOT NULL, `status` varchar(32) NOT NULL default 'pending', `version` int(11) default '0', PRIMARY KEY (`id`), UNIQUE KEY `tt_watchers` (`to_tag`), KEY `due_activewatchers` (`to_domain`,`to_user`,`event`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `watchers` ( `id` int(10) NOT NULL auto_increment, `p_user` varchar(64) NOT NULL, `p_domain` varchar(128) NOT NULL, `w_user` varchar(64) NOT NULL, `w_domain` varchar(128) NOT NULL, `subs_status` varchar(64) NOT NULL, `reason` varchar(64), `inserted_time` int(11) NOT NULL, UNIQUE KEY udud_watchers (`p_user`,`p_domain`,`w_user`,`w_domain`), PRIMARY KEY (id) ) ENGINE=MyISAM; CREATE TABLE `xcap_xml` ( `id` int(10) NOT NULL auto_increment, `username` varchar(66) NOT NULL, `domain` varchar(128) NOT NULL, `xcap` text NOT NULL, `doc_type` int(11) NOT NULL, UNIQUE KEY udd_xcap (`username`,`domain`,`doc_type`), PRIMARY KEY (id) ) ENGINE=MyISAM; ...
Take a look at http://www.openser-project.org/.
First at all check if your question was already answered on one of our mailing lists:
User Mailing List - http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Developer Mailing List - http://lists.openser-project.org/cgi-bin/mailman/listinfo/devel
E-mails regarding any stable OpenSER release should be sent to
<users@lists.openser-project.org>
and e-mails regarding development versions
should be sent to <devel@lists.openser-project.org>
.
If you want to keep the mail private, send it to
<team@lists.openser-project.org>
.
Please follow the guidelines provided at: http://sourceforge.net/tracker/?group_id=139143.