Pārlūkot izejas kodu

dmq_usrloc: add new modparam to sync UL_CONTACT_EXPIRE actions

Stefan Mititelu 7 mēneši atpakaļ
vecāks
revīzija
2a1bd40c02

+ 3 - 0
src/modules/dmq_usrloc/dmq_usrloc.c

@@ -43,6 +43,7 @@ int _dmq_usrloc_batch_msg_size = 60000;
 int _dmq_usrloc_batch_usleep = 0;
 str _dmq_usrloc_domain = str_init("location");
 int _dmq_usrloc_delete = 1;
+int _dmq_usrloc_delete_expired = 0;
 
 usrloc_api_t dmq_ul;
 
@@ -59,6 +60,7 @@ static param_export_t params[] = {
 	{"batch_usleep", PARAM_INT, &_dmq_usrloc_batch_usleep},
 	{"usrloc_domain", PARAM_STR, &_dmq_usrloc_domain},
 	{"usrloc_delete", PARAM_INT, &_dmq_usrloc_delete},
+	{"usrloc_delete_expired", PARAM_INT, &_dmq_usrloc_delete_expired},
 	{0, 0, 0}
 };
 
@@ -116,6 +118,7 @@ static int mod_init(void)
 			LM_ERR("Error in dmq_usrloc_initialize()\n");
 		}
 	}
+
 	return 0;
 }
 

+ 20 - 1
src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml

@@ -303,11 +303,30 @@ modparam("dmq_usrloc", "replicate_socket_info", 1)
 		</emphasis>
 		</para>
 		<example>
-		<title>Set <varname>usrloc_domain</varname> parameter</title>
+		<title>Set <varname>usrloc_delete</varname> parameter</title>
 		<programlisting format="linespecific">
 ...
 modparam("dmq_usrloc", "usrloc_delete", 0)
 ...
+</programlisting>
+		</example>
+	</section>
+	<section id="usrloc_dmq.p.usrloc_delete_expired">
+		<title><varname>usrloc_delete_expired</varname> (int)</title>
+		<para>
+			Enable (1) or disable (0) synchronizing usrloc expire actions using delete actions. In other words, sync delete of (UL_CONTACT_EXPIRE) expired contacts.
+		</para>
+		<para>
+		<emphasis>
+			Default value is 0.
+		</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>usrloc_delete_expired</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("dmq_usrloc", "usrloc_delete_expired", 1)
+...
 </programlisting>
 		</example>
 	</section>

+ 4 - 1
src/modules/dmq_usrloc/usrloc_sync.c

@@ -66,6 +66,7 @@ extern int _dmq_usrloc_batch_size;
 extern int _dmq_usrloc_batch_usleep;
 extern str _dmq_usrloc_domain;
 extern int _dmq_usrloc_delete;
+extern int _dmq_usrloc_delete_expired;
 
 static int add_contact(str aor, ucontact_info_t *ci)
 {
@@ -1043,7 +1044,9 @@ void dmq_ul_cb_contact(ucontact_t *ptr, int type, void *param)
 				}
 				break;
 			case UL_CONTACT_EXPIRE:
-				//usrloc_dmq_send_contact(ptr, aor, DMQ_UPDATE);
+				if(_dmq_usrloc_delete_expired >= 1) {
+					usrloc_dmq_send_contact(ptr, aor, DMQ_RM, 0);
+				}
 				LM_DBG("Contact <%.*s> expired\n", aor.len, aor.s);
 				break;
 		}