Browse code

dialog: add ignore_non_local_dlg parameter

Riccardo Villa authored on 11/02/2022 12:07:40 • Daniel-Constantin Mierla committed on 11/02/2022 14:57:17
Showing 4 changed files
... ...
@@ -104,6 +104,7 @@ str dlg_extra_hdrs = {NULL,0};
104 104
 static int db_fetch_rows = 200;
105 105
 static int db_skip_load = 0;
106 106
 static int dlg_keep_proxy_rr = 0;
107
+int dlg_ignore_non_local_dlg = 0;
107 108
 int initial_cbs_inscript = 1;
108 109
 int dlg_wait_ack = 1;
109 110
 static int dlg_timer_procs = 0;
... ...
@@ -327,6 +328,7 @@ static param_export_t mod_params[]={
327 328
 	{ "h_id_start",            PARAM_INT, &dlg_h_id_start           },
328 329
 	{ "h_id_step",             PARAM_INT, &dlg_h_id_step            },
329 330
 	{ "keep_proxy_rr",         INT_PARAM, &dlg_keep_proxy_rr        },
331
+	{ "ignore_non_local_dlg",  INT_PARAM, &dlg_ignore_non_local_dlg },
330 332
 	{ 0,0,0 }
331 333
 };
332 334
 
... ...
@@ -71,6 +71,7 @@ extern int       dlg_send_bye;
71 71
 extern int       dlg_event_rt[DLG_EVENTRT_MAX];
72 72
 extern int       dlg_wait_ack;
73 73
 extern int       dlg_enable_dmq;
74
+extern int       dlg_ignore_non_local_dlg;
74 75
 int              spiral_detected = -1;
75 76
 
76 77
 extern struct rr_binds d_rrb;		/*!< binding to record-routing module */
... ...
@@ -1581,14 +1582,16 @@ void dlg_ontimeout(struct dlg_tl *tl)
1581 1582
 	dlg = ((struct dlg_cell*)((char *)(tl) -
1582 1583
 			(unsigned long)(&((struct dlg_cell*)0)->tl)));
1583 1584
 
1584
-	if (dlg->bind_addr[0] == NULL) {
1585
-		LM_DBG("skipping dialog without bind address\n");
1586
-		return 0;
1587
-	}
1585
+	if (dlg_ignore_non_local_dlg) {
1586
+		if (dlg->bind_addr[0] == NULL) {
1587
+			LM_DBG("skipping dialog without bind address\n");
1588
+			return;
1589
+		}
1588 1590
 
1589
-	if (lookup_local_socket(&(dlg->bind_addr[0]->sock_str)) == NULL) {
1590
-		LM_DBG("skipping non local dialog\n");
1591
-		return 0;
1591
+		if (lookup_local_socket(&(dlg->bind_addr[0]->sock_str)) == NULL) {
1592
+			LM_DBG("skipping non local dialog\n");
1593
+			return;
1594
+		}
1592 1595
 	}
1593 1596
 	
1594 1597
 	/* mark dialog as expired */
... ...
@@ -53,6 +53,7 @@
53 53
 extern str dlg_extra_hdrs;
54 54
 extern str dlg_lreq_callee_headers;
55 55
 extern int dlg_ka_failed_limit;
56
+extern int dlg_ignore_non_local_dlg;
56 57
 
57 58
 /**
58 59
  *
... ...
@@ -452,14 +453,16 @@ int dlg_send_ka(dlg_cell_t *dlg, int dir)
452 453
 	int result;
453 454
 	dlg_iuid_t *iuid = NULL;
454 455
 
455
-	if (dlg->bind_addr[dir] == NULL) {
456
-		LM_DBG("skipping dialog without bind address\n");
457
-		return 0;
458
-	}
456
+	if (dlg_ignore_non_local_dlg) {
457
+		if (dlg->bind_addr[dir] == NULL) {
458
+			LM_DBG("skipping dialog without bind address\n");
459
+			return 0;
460
+		}
459 461
 
460
-	if (lookup_local_socket(&(dlg->bind_addr[dir]->sock_str)) == NULL) {
461
-		LM_DBG("skipping non local dialog\n");
462
-		return 0;
462
+		if (lookup_local_socket(&(dlg->bind_addr[dir]->sock_str)) == NULL) {
463
+			LM_DBG("skipping non local dialog\n");
464
+			return 0;
465
+		}
463 466
 	}
464 467
 
465 468
 	/* do not send KA request for non-confirmed dialogs (not supported) */
... ...
@@ -1299,7 +1299,26 @@ modparam("dialog", "send_bye", 1)
1299 1299
 </programlisting>
1300 1300
 		</example>
1301 1301
 	</section>
1302
-
1302
+	<section id="dialog.p.ignore_non_local_dlg">
1303
+		<title><varname>ignore_non_local_dlg</varname> (int)</title>
1304
+		<para>
1305
+			If set to 1, don't send keepalives and
1306
+			do nothing on timeout if dialog is non local.
1307
+		</para>
1308
+		<para>
1309
+		<emphasis>
1310
+			Default value is <quote>0</quote>.
1311
+		</emphasis>
1312
+		</para>
1313
+		<example>
1314
+		<title>Set <varname>ignore_non_local_dlg</varname> parameter</title>
1315
+		<programlisting format="linespecific">
1316
+...
1317
+modparam("dialog", "ignore_non_local_dlg", 1)
1318
+...
1319
+</programlisting>
1320
+		</example>
1321
+	</section>
1303 1322
 	<section id="dialog.p.wait_ack">
1304 1323
 		<title><varname>wait_ack</varname> (int)</title>
1305 1324
 		<para>