Module: kamailio
Branch: master
Commit: 3e12b407643b2d0578aa831923eb769b493473cf
URL:
https://github.com/kamailio/kamailio/commit/3e12b407643b2d0578aa831923eb769…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2017-03-09T12:40:14+01:00
Merge pull request #1017 from lazedo/presence-cseq-offset-master
presence: add a offset for allowed cseq difference
---
Modified: src/modules/presence/doc/presence_admin.xml
Modified: src/modules/presence/presence.c
Modified: src/modules/presence/presence.h
Modified: src/modules/presence/subscribe.c
---
Diff:
https://github.com/kamailio/kamailio/commit/3e12b407643b2d0578aa831923eb769…
Patch:
https://github.com/kamailio/kamailio/commit/3e12b407643b2d0578aa831923eb769…
---
diff --git a/src/modules/presence/doc/presence_admin.xml
b/src/modules/presence/doc/presence_admin.xml
index 1640fe7..f3b9d1a 100644
--- a/src/modules/presence/doc/presence_admin.xml
+++ b/src/modules/presence/doc/presence_admin.xml
@@ -175,7 +175,25 @@ modparam("presence", "clean_period", 100)
</programlisting>
</example>
</section>
- <section id="presence.p.db_update_period">
+ <section id="presence.p.cseq_offset">
+ <title><varname>cseq_offset</varname> (int)</title>
+ <para>
+ The allowed offset between server and client cseq.
+ </para>
+ <para>
+ <emphasis>Default value is <quote>0</quote>.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>cseq_offset</varname>
parameter</title>
+ <programlisting format="linespecific">
+ ...
+ modparam("presence", "cseq_offset", 1)
+ ...
+ </programlisting>
+ </example>
+ </section>
+ <section id="presence.p.db_update_period">
<title><varname>db_update_period</varname> (int)</title>
<para>
The period at which to synchronize cached subscriber info with the
diff --git a/src/modules/presence/presence.c b/src/modules/presence/presence.c
index f9e40bb..5d3ce1a 100644
--- a/src/modules/presence/presence.c
+++ b/src/modules/presence/presence.c
@@ -145,6 +145,7 @@ char prefix='a';
int startup_time=0;
str db_url = {0, 0};
int expires_offset = 0;
+int pres_cseq_offset = 0;
uint32_t min_expires= 0;
int min_expires_action= 1;
uint32_t max_expires= 3600;
@@ -231,6 +232,7 @@ static param_export_t params[]={
{ "retrieve_order", PARAM_INT, &pres_retrieve_order},
{ "retrieve_order_by", PARAM_STR, &pres_retrieve_order_by},
{ "sip_uri_match", PARAM_INT, &pres_uri_match},
+ { "cseq_offset", PARAM_INT, &pres_cseq_offset},
{0,0,0}
};
diff --git a/src/modules/presence/presence.h b/src/modules/presence/presence.h
index 62afa7d..4dbc324 100644
--- a/src/modules/presence/presence.h
+++ b/src/modules/presence/presence.h
@@ -71,6 +71,7 @@ extern int pid;
extern int startup_time;
extern char *to_tag_pref;
extern int expires_offset;
+extern int pres_cseq_offset;
extern str server_address;
extern uint32_t min_expires;
extern int min_expires_action;
diff --git a/src/modules/presence/subscribe.c b/src/modules/presence/subscribe.c
index 1d96dbf..e8c9cea 100644
--- a/src/modules/presence/subscribe.c
+++ b/src/modules/presence/subscribe.c
@@ -1666,7 +1666,7 @@ int get_stored_info(struct sip_msg* msg, subs_t* subs, int*
reply_code,
subs->local_cseq= s->local_cseq +1;
- if(subs->remote_cseq<= s->remote_cseq)
+ if(subs->remote_cseq + pres_cseq_offset <= s->remote_cseq)
{
LM_ERR("wrong sequence number;received: %d - stored: %d\n",
subs->remote_cseq, s->remote_cseq);
@@ -1782,7 +1782,7 @@ int get_database_info(struct sip_msg* msg, subs_t* subs, int*
reply_code, str* r
row_vals = ROW_VALUES(row);
remote_cseq= row_vals[remote_cseq_col].val.int_val;
- if(subs->remote_cseq<= remote_cseq)
+ if(subs->remote_cseq + pres_cseq_offset <= remote_cseq)
{
LM_ERR("wrong sequence number received: %d - stored: %d\n",
subs->remote_cseq, remote_cseq);