Răsfoiți Sursa

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.
Marius Zbihlei 14 ani în urmă
părinte
comite
aa7b306e24

+ 41 - 22
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:[email protected]", "presence", 1);
 ...
@@ -551,7 +570,7 @@ pres_refresh_watchers("sip:[email protected]", "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:[email protected]", "presence");
 ...

+ 21 - 0
modules_k/presence/doc/presence_admin.xml

@@ -358,6 +358,27 @@ modparam("presence", "pres_htable_size", 11)
 	</programlisting>
 		</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>

+ 2 - 0
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}
 };
 

+ 1 - 0
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;
 

+ 1 - 1
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;