Table of Contents
Database Tables for Presence Module
presentity
The table is used for storing PUBLISH messages information.
| Keys | Type | Actions | Description |
|---|---|---|---|
| username | varchar(64) | primary | the presentity username |
| domain | varchar(128) | primary | the presentity domain |
| event | varchar(64) | primary | the only value it can take now is “presence” |
| etag | varchar(64) | primary | the generated etag value for a new PUBLISH, contained in the Sip-if-Match header field for the next PUBLISH update messages from the same dialog |
| expires | int | the time at which the published information expires - Expires header field value + time() | |
| received_time | int | the time at which the PUBLISH request was received | |
| body | text | the xml body containing presence information |
CREATE TABLE `presentity` ( `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, PRIMARY KEY (`username`,`domain`,`event`,`etag`) ) ENGINE=MyISAM;
active-watchers
The table is used for storing the information about the dialog initiated by a Subscribe request, used for sending Notify with presence or presence.winfo information. The to and from from the names of the columns have the same meaning as in the Subscribe message.
| Keys | Type | Actions | Description |
|---|---|---|---|
| to_user | varchar(64) | the presentity's username | |
| to_domain | varchar(124) | the presentity's domain | |
| from_user | varchar(64) | the subscriber's/watcher's username | |
| from_domain | varchar(124) | the watchers's domain | |
| event | varchar(64) | it can be either “presence” or “presence.winfo” | |
| event_id | varchar(128) | the Event id parameter value | |
| from_tag | varchar(128) | the tag value from the From header filed in the Subscribe message | |
| to_tag | varchar(128) | the tag value from the To header filed in the Subscribe message | |
| callid | varchar(128) | the Call-ID header field value | |
| cseq | int | the current cseq value incremented each time a Notify is sent in the same dialog | |
| contact | varchar(128) | the Contact header field value from the Subscribe message | |
| record_route | varchar(255) | the Record-Route that should be included in Notify messages | |
| expires | int | the time at which the subscription expires - Expires header field value + time() | |
| staus | varchar(32) | the subscribtions status: “active”, “pending”, “terminated” or “waiting” | |
| version | int | used for sending Notify for presence.winfo events ; incremented each time a new Notify is sent |
CREATE TABLE `active_watchers` ( `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, `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 (`from_tag`) ) ENGINE=MyISAM;
xcap_xml
The table is used for storing xcap files containing authorization information.
| Keys | Type | Actions | Description |
|---|---|---|---|
| username | varchar(64) | primary | the presentity username |
| domain | varchar(128) | primary | the presentity domain |
| xcap | text | the xcap file | |
| doc_type | varchar(64) | primary | the type of the xml doc |
CREATE TABLE `xcap_xml` ( `username` varchar(64) NOT NULL, `domain` varchar(128) NOT NULL, `xcap` text NOT NULL, `doc_type` int NOT NULL, PRIMARY KEY (`username`,`domain`,`doc_type`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
- doc_type can have one of the following values:
1 - presence_rules; 2 - resource-list; 3 - rls-services;
watchers
This table is used for storing informations about acceptance for Subscribe messages for presence. The subscription state when sending a new notify is take from this table if it exists. Otherwise it takes a default value which is: 'pending' if the force_active parameter is set to 0 and 'active' if the parameter is not 0.
| Keys | Type | Actions | Description |
|---|---|---|---|
| p_user | varchar(64) | primary | presentity username |
| p_domain | varchar(128) | primary | presentity domain |
| w_user | varchar(64) | primary | watcher username |
| w_domain | varchar(128) | primary | watcher domain |
| subs_status | varchar(64) | the current subscription status | |
| reason | varchar(64) | if the status is terminated this field records the reason that lead to this | |
| inserted_time | int(11) | timestamp of insertion |
CREATE TABLE `watchers` ( `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, PRIMARY KEY (`p_user`,`p_domain`,`w_user`,`w_domain`) ) ENGINE=MyISAM;