[sr-dev] git:master: modules_k/presence : Added parameter to allow disabling of sending an initial empty NOTIFY by presence , as this confused some CPEs

Marius Zbihlei marius.zbihlei at 1and1.ro
Wed Aug 17 12:53:41 CEST 2011


Module: sip-router
Branch: master
Commit: aa7b306e24ba1c9b5bdb4e18b88cfc74ad00733b
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=aa7b306e24ba1c9b5bdb4e18b88cfc74ad00733b

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Thu Jun 23 11:42:53 2011 +0300

modules_k/presence : Added parameter to allow disabling of sending an initial empty NOTIFY by presence, as this confused some CPEs

Default is enabled, so behavior is left the existing one. Sending of the NOTIFY (carrying the initial/default state) is left now to the application.

---

 modules_k/presence/README                 |   63 +++++++++++++++++++----------
 modules_k/presence/doc/presence_admin.xml |   21 ++++++++++
 modules_k/presence/presence.c             |    2 +
 modules_k/presence/presence.h             |    1 +
 modules_k/presence/subscribe.c            |    2 +-
 5 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/modules_k/presence/README b/modules_k/presence/README
index 51ae45e..4384d71 100644
--- a/modules_k/presence/README
+++ b/modules_k/presence/README
@@ -47,8 +47,9 @@ Juha Heinanen
               3.12. db_mode (int)
               3.13. subs_htable_size (int)
               3.14. pres_htable_size (int)
-              3.15. enable_sphere_check (int)
-              3.16. timeout_rm_subs (int)
+              3.15. send_fast_notify (int)
+              3.16. enable_sphere_check (int)
+              3.17. timeout_rm_subs (int)
 
         4. Exported Functions
 
@@ -99,13 +100,14 @@ Juha Heinanen
    1.12. Set db_mode parameter
    1.13. Set subs_htable_size parameter
    1.14. Set pres_htable_size parameter
-   1.15. Set enable_sphere_check parameter
-   1.16. Set timeout_rm_subs parameter
-   1.17. handle_publish usage
-   1.18. handle_subscribe usage
-   1.19. pres_auth_status usage
-   1.20. pres_refresh_watchers usage
-   1.21. pres_update_watchers usage
+   1.15. Set send_fast_notify parameter
+   1.16. Set enable_sphere_check parameter
+   1.17. Set timeout_rm_subs parameter
+   1.18. handle_publish usage
+   1.19. handle_subscribe usage
+   1.20. pres_auth_status usage
+   1.21. pres_refresh_watchers usage
+   1.22. pres_update_watchers usage
    2.1. presence_api_t structure
 
 Chapter 1. Admin Guide
@@ -134,8 +136,9 @@ Chapter 1. Admin Guide
         3.12. db_mode (int)
         3.13. subs_htable_size (int)
         3.14. pres_htable_size (int)
-        3.15. enable_sphere_check (int)
-        3.16. timeout_rm_subs (int)
+        3.15. send_fast_notify (int)
+        3.16. enable_sphere_check (int)
+        3.17. timeout_rm_subs (int)
 
    4. Exported Functions
 
@@ -220,8 +223,9 @@ Chapter 1. Admin Guide
    3.12. db_mode (int)
    3.13. subs_htable_size (int)
    3.14. pres_htable_size (int)
-   3.15. enable_sphere_check (int)
-   3.16. timeout_rm_subs (int)
+   3.15. send_fast_notify (int)
+   3.16. enable_sphere_check (int)
+   3.17. timeout_rm_subs (int)
 
 3.1. db_url(str)
 
@@ -401,7 +405,22 @@ modparam("presence", "subs_htable_size", 11)
 modparam("presence", "pres_htable_size", 11)
 ...
 
-3.15. enable_sphere_check (int)
+3.15. send_fast_notify (int)
+
+   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.
+
+   Default value is “1 ”.
+
+   Example 1.15. Set send_fast_notify parameter
+...
+modparam("presence", "send_fast_notify", 0)
+...
+
+3.16. enable_sphere_check (int)
 
    This parameter is a flag that should be set if permission rules include
    sphere checking. The sphere information is expected to be present in
@@ -411,12 +430,12 @@ modparam("presence", "pres_htable_size", 11)
 
    Default value is “0 ”.
 
-   Example 1.15. Set enable_sphere_check parameter
+   Example 1.16. Set enable_sphere_check parameter
 ...
 modparam("presence", "enable_sphere_check", 1)
 ...
 
-3.16. timeout_rm_subs (int)
+3.17. timeout_rm_subs (int)
 
    This parameter is a flag that should be set if subscriptions should be
    removed from the active_watchers when a NOTIFY times out. RFC3265
@@ -426,7 +445,7 @@ modparam("presence", "enable_sphere_check", 1)
 
    Default value is “1”.
 
-   Example 1.16. Set timeout_rm_subs parameter
+   Example 1.17. Set timeout_rm_subs parameter
 ...
 modparam("presence", "timeout_rm_subs", 0)
 ...
@@ -459,7 +478,7 @@ modparam("presence", "timeout_rm_subs", 0)
 
    The module sends an appropriate stateless reply in all cases.
 
-   Example 1.17. handle_publish usage
+   Example 1.18. handle_publish usage
 ...
         if(is_method("PUBLISH"))
         {
@@ -485,7 +504,7 @@ modparam("presence", "timeout_rm_subs", 0)
 
    The module sends an appropriate stateless reply in all cases.
 
-   Example 1.18. handle_subscribe usage
+   Example 1.19. handle_subscribe usage
 ...
 if(method=="SUBSCRIBE")
     handle_subscribe();
@@ -502,7 +521,7 @@ if(method=="SUBSCRIBE")
 
    This function can be used from REQUEST_ROUTE.
 
-   Example 1.19. pres_auth_status usage
+   Example 1.20. pres_auth_status usage
 ...
 if (method=="MESSAGE") {
     pres_auth_status("$fu", $ru");
@@ -533,7 +552,7 @@ if (method=="MESSAGE") {
 
    This function can be used from ANY_ROUTE.
 
-   Example 1.20. pres_refresh_watchers usage
+   Example 1.21. pres_refresh_watchers usage
 ...
 pres_refresh_watchers("sip:test at kamailio.org", "presence", 1);
 ...
@@ -551,7 +570,7 @@ pres_refresh_watchers("sip:test at kamailio.org", "presence", 1);
 
    This function can be used from ANY_ROUTE.
 
-   Example 1.21. pres_update_watchers usage
+   Example 1.22. pres_update_watchers usage
 ...
 pres_update_watchers("sip:test at kamailio.org", "presence");
 ...
diff --git a/modules_k/presence/doc/presence_admin.xml b/modules_k/presence/doc/presence_admin.xml
index b2a1629..49c8730 100644
--- a/modules_k/presence/doc/presence_admin.xml
+++ b/modules_k/presence/doc/presence_admin.xml
@@ -359,6 +359,27 @@ modparam("presence", "pres_htable_size", 11)
 		</example>
 	</section>
 	<section>
+		<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 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>
+		<para>
+		<emphasis>Default value is <quote>1 </quote>.
+		</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>send_fast_notify</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("presence", "send_fast_notify", 0)
+...
+	</programlisting>
+		</example>
+	</section>
+
+	<section>
 		<title><varname>enable_sphere_check</varname> (int)</title>
 		<para>
 		This parameter is a flag that should be set if permission rules include
diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c
index d211b53..8dd866c 100644
--- a/modules_k/presence/presence.c
+++ b/modules_k/presence/presence.c
@@ -137,6 +137,7 @@ int dbmode = 0;
 int fallback2db = 0;
 int sphere_enable= 0;
 int timeout_rm_subs = 1;
+int send_fast_notify = 1;
 
 int phtable_size= 9;
 phtable_t* pres_htable;
@@ -177,6 +178,7 @@ static param_export_t params[]={
 	{ "fallback2db",            INT_PARAM, &fallback2db},
 	{ "enable_sphere_check",    INT_PARAM, &sphere_enable},
 	{ "timeout_rm_subs",        INT_PARAM, &timeout_rm_subs},
+	{ "send_fast_notify",	    INT_PARAM, &send_fast_notify},
     {0,0,0}
 };
 
diff --git a/modules_k/presence/presence.h b/modules_k/presence/presence.h
index 88520f3..16e5177 100644
--- a/modules_k/presence/presence.h
+++ b/modules_k/presence/presence.h
@@ -75,6 +75,7 @@ extern int max_expires;
 extern int dbmode;
 extern int sphere_enable;
 extern int timeout_rm_subs;
+extern int send_fast_notify;
 extern int shtable_size;
 extern shtable_t subs_htable;
 
diff --git a/modules_k/presence/subscribe.c b/modules_k/presence/subscribe.c
index d37518a..3fb1668 100644
--- a/modules_k/presence/subscribe.c
+++ b/modules_k/presence/subscribe.c
@@ -607,7 +607,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int to_tag_gen,
 		}		
 		*sent_reply= 1;
 		
-		if(notify(subs, NULL, NULL, 0 )< 0)
+		if(send_fast_notify && (notify(subs, NULL, NULL, 0 )< 0))
 		{
 			LM_ERR("sending notify request\n");
 			goto error;




More information about the sr-dev mailing list