Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presence: introduce new module parameter force_delete #601

Merged
merged 3 commits into from May 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
94 changes: 58 additions & 36 deletions modules/presence/doc/presence_admin.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding='ISO-8859-1'?>
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [

Expand All @@ -11,12 +11,12 @@

<chapter>
<title>&adminguide;</title>

<section>
<title>Overview</title>
<para> The Presence module implements the core functionality of SIP event notification.
It handles PUBLISH and SUBSCRIBE messages and generates
NOTIFY messages in a general, event independent way. It is extensible and allows registering
NOTIFY messages in a general, event independent way. It is extensible and allows registering
events to it from other &kamailio; modules.
Supported SIP event packages are presence, presence.winfo, dialog;sla from the presence_xml
module and message-summary from the presence_mwi module.
Expand All @@ -26,7 +26,7 @@
For subscriptions it supports the 4 storage modes: Memory Only, Write Back,
Write Through and DB Only. For publishes, it stores the state documents in
database only(because of the large size) and it can store a publish cache in
memory to avoid unnecessairy database queries. Read the
memory to avoid unnecessairy database queries. Read the
<emphasis>subs_db_mode</emphasis> and <emphasis>publ_cache</emphasis> parameter
sections to decide which is the best storage configuration for you.
</para>
Expand All @@ -35,7 +35,7 @@
This mode of operation is enabled if the db_url parameter is not set to any value.
</para>
<para>
The &kamailio; Presence module implements the specifications in: RFC3265, RFC3856, RFC3857,
The &kamailio; Presence module implements the specifications in: RFC3265, RFC3856, RFC3857,
RFC3858.
</para>
</section>
Expand Down Expand Up @@ -78,7 +78,7 @@

</section>
</section>

<section>
<title>Parameters</title>
<section id="presence.p.db_url">
Expand All @@ -87,7 +87,7 @@
The database url.
</para>
<para>If set, the module is a fully operational
presence server. Otherwise, it is used as a 'library', for
presence server. Otherwise, it is used as a 'library', for
its exported functions.
</para>
<para>
Expand All @@ -97,7 +97,7 @@
<title>Set <varname>db_url</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("presence", "db_url",
modparam("presence", "db_url",
"&defaultdb;")
...
</programlisting>
Expand All @@ -124,7 +124,7 @@ modparam("presence", "presentity_table", "presentity")
<section id="presence.p.active_watchers_table">
<title><varname>active_watchers_table</varname>(str)</title>
<para>
The name of the db table where active subscription information is stored.
The name of the db table where active subscription information is stored.
</para>
<para>
<emphasis> Default value is <quote>active_watchers</quote>.
Expand Down Expand Up @@ -278,6 +278,28 @@ modparam("presence", "notifier_processes", 2)
</example>
</section>

<section id="presence.p.force_delete">
<title><varname>force_delete</varname> (int)</title>
<para>
Enabling this parameter will delete expired presentity records without updating watchers.
</para>
<para>
Set this parameter to <quote>1<quote> to enable.
</para>
<para>
<emphasis>Default value is <quote>0</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>force_delete</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("presence", "force_delete", 1)
...
</programlisting>
</example>
</section>

<section id="presence.p.to_tag_pref">
<title><varname>to_tag_pref</varname> (str)</title>
<para>
Expand Down Expand Up @@ -397,7 +419,7 @@ modparam("presence", "max_expires", 3600)
<section id="presence.p.server_address">
<title><varname>server_address</varname> (str)</title>
<para>
The presence server address which will become the value of Contact header filed
The presence server address which will become the value of Contact header filed
for 200 OK replies to SUBSCRIBE and PUBLISH and in NOTIFY messages.
</para>
<example>
Expand Down Expand Up @@ -547,7 +569,7 @@ modparam("presence", "pres_htable_size", 11)
<section id="presence.p.send_fast_notify">
<title><varname>send_fast_notify</varname> (int)</title>
<para>
This parameter enables or disables the sending of an initial empty NOTIFY after a SUBSCRIBE/reSUBSCRIBE.
This parameter enables or disables the sending of an initial empty NOTIFY after a SUBSCRIBE/reSUBSCRIBE.
This caused problems for MWI application, because some CPEs (like Samsung) fail to understand an empty
NOTIFY to an message-summary event. This parameter is enabled by default, thus addering to the standard.
</para>
Expand Down Expand Up @@ -638,8 +660,8 @@ modparam("presence", "fetch_rows", 1000)
with a MySQL-Databases in "DB-Only" mode.
</para>
<para>
In order to use the Presence-Module in "DB_ONLY"-mode with a
MySQL-Backend, set this parameter to "0", otherwise the
In order to use the Presence-Module in "DB_ONLY"-mode with a
MySQL-Backend, set this parameter to "0", otherwise the
MySQL-Operations will fail. The Presence-Module will generate
a "500 Server error" due to the failed MySQL-queries.
</para>
Expand Down Expand Up @@ -794,17 +816,17 @@ modparam("presence", "retrieve_order", 1)
<function moreinfo="none">handle_publish([sender_uri])</function>
</title>
<para>
Handles PUBLISH requests by storing and updating
published information in memory cache and database, then calls functions to send
Handles PUBLISH requests by storing and updating
published information in memory cache and database, then calls functions to send
NOTIFY messages when changes in the published information occur.
It takes one argument -> sender_uri. The parameter was added
It takes one argument -> sender_uri. The parameter was added
for enabling BLA implementation. If present, notification of
a change in published state is not sent to the respective uri
even though a subscription exists.
It should be taken from the Sender header. It was left at the
decision of the administrator whether or not to transmit the
content of this header as parameter for handle_publish, to
prevent security problems.
decision of the administrator whether or not to transmit the
content of this header as parameter for handle_publish, to
prevent security problems.
</para>
<para>
This function can be used from REQUEST_ROUTE.
Expand Down Expand Up @@ -840,7 +862,7 @@ modparam("presence", "retrieve_order", 1)
else
handle_publish();
t_release();
}
}
...
</programlisting>
</example>
Expand All @@ -851,8 +873,8 @@ modparam("presence", "retrieve_order", 1)
<function moreinfo="none">handle_subscribe([watcher_uri])</function>
</title>
<para>
The function which handles SUBSCRIBE requests. It stores or
updates information in memory and database and calls functions to send NOTIFY
The function which handles SUBSCRIBE requests. It stores or
updates information in memory and database and calls functions to send NOTIFY
messages when a SUBSCRIBE which initiate a dialog is received.
</para>
<para>
Expand Down Expand Up @@ -1131,11 +1153,11 @@ pres_update_watchers("sip:test@kamailio.org", "presence");

<section>
<title>Pseudo Variables</title>

<section>
<title><varname>$subs(attr)</varname></title>
<para>
Access the attributes of handled subscription.
Access the attributes of handled subscription.
It must be used after a successful call of
<quote>handle_subscription()</quote> or in the following events.
<itemizedlist>
Expand All @@ -1147,7 +1169,7 @@ pres_update_watchers("sip:test@kamailio.org", "presence");
<para><emphasis>present:notify-reply</emphasis> - after notify is sent
</para>
</listitem>
</itemizedlist>
</itemizedlist>
</para>
<para>
The <quote>attr</quote> can be:
Expand All @@ -1156,27 +1178,27 @@ pres_update_watchers("sip:test@kamailio.org", "presence");
<listitem>
<para><emphasis>uri</emphasis> - subscription presentity uri
</para>
</listitem>
</listitem>
<listitem>
<para><emphasis>pres_uri</emphasis> - alias for presentity uri
</para>
</listitem>
</listitem>
<listitem>
<para><emphasis>to_user</emphasis>
</para>
</listitem>
</listitem>
<listitem>
<para><emphasis>to_domain</emphasis>
</para>
</listitem>
</listitem>
<listitem>
<para><emphasis>from_user</emphasis>
</para>
</listitem>
</listitem>
<listitem>
<para><emphasis>from_domain</emphasis>
</para>
</listitem>
</listitem>
<listitem>
<para><emphasis>watcher_username</emphasis>
</para>
Expand Down Expand Up @@ -1263,18 +1285,18 @@ if(handle_subscription())
</programlisting>
</example>
</section>

<section>
<title><varname>$notify_reply(attr)</varname></title>
<para>
Access the reply message received when notifying subscriber.
Access the reply message received when notifying subscriber.
It must be used in the following events.
<itemizedlist>
<listitem>
<para><emphasis>present:notify-reply</emphasis> - after notify is sent
</para>
</listitem>
</itemizedlist>
</itemizedlist>
</para>
<para>
The <quote>attr</quote> can be any pseudo var that accesses attributes of msg
Expand Down Expand Up @@ -1320,8 +1342,8 @@ event_route[presence:notify-reply]
<title>Installation</title>
<para>
The module requires 3 tables in the &kamailio; database: "presentity",
"active_watchers" and "watchers". The SQL
syntax to create them can be found in presence-create.sql
"active_watchers" and "watchers". The SQL
syntax to create them can be found in presence-create.sql
script in the database directories in the kamailio/scripts folder.
You can also find the complete database documentation on the
project webpage, &kamailiodbdocslink;.
Expand Down
5 changes: 5 additions & 0 deletions modules/presence/presence.c
Expand Up @@ -155,6 +155,7 @@ int publ_cache_enabled = 1;
int pres_waitn_time = 5;
int pres_notifier_poll_rate = 10;
int pres_notifier_processes = 1;
int pres_force_delete = 0;
str pres_xavp_cfg = {0};
int pres_retrieve_order = 0;

Expand Down Expand Up @@ -199,6 +200,7 @@ static param_export_t params[]={
{ "waitn_time", INT_PARAM, &pres_waitn_time },
{ "notifier_poll_rate", INT_PARAM, &pres_notifier_poll_rate },
{ "notifier_processes", INT_PARAM, &pres_notifier_processes },
{ "force_delete", INT_PARAM, &pres_force_delete },
{ "to_tag_pref", PARAM_STRING, &to_tag_pref },
{ "expires_offset", INT_PARAM, &expires_offset },
{ "max_expires", INT_PARAM, &max_expires },
Expand Down Expand Up @@ -431,6 +433,9 @@ static int mod_init(void)
register_basic_timers(pres_notifier_processes);
}

if (pres_force_delete > 0)
pres_force_delete = 1;

if (db_table_lock_type != 1)
db_table_lock = DB_LOCKING_NONE;

Expand Down
1 change: 1 addition & 0 deletions modules/presence/presence.h
Expand Up @@ -88,6 +88,7 @@ extern int pres_fetch_rows;
extern int pres_waitn_time;
extern int pres_notifier_poll_rate;
extern int pres_notifier_processes;
extern int pres_force_delete;
extern str pres_xavp_cfg;
extern int pres_retrieve_order;

Expand Down