diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index a25224318cd..ddcb3b134b1 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -104,6 +104,7 @@ str dlg_extra_hdrs = {NULL,0};
static int db_fetch_rows = 200;
static int db_skip_load = 0;
static int dlg_keep_proxy_rr = 0;
+int dlg_ignore_non_local_dlg = 0;
int initial_cbs_inscript = 1;
int dlg_wait_ack = 1;
static int dlg_timer_procs = 0;
@@ -327,6 +328,7 @@ static param_export_t mod_params[]={
{ "h_id_start", PARAM_INT, &dlg_h_id_start },
{ "h_id_step", PARAM_INT, &dlg_h_id_step },
{ "keep_proxy_rr", INT_PARAM, &dlg_keep_proxy_rr },
+ { "ignore_non_local_dlg", INT_PARAM, &dlg_ignore_non_local_dlg },
{ 0,0,0 }
};
diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c
index 3f8adefb795..dd8cef6fd88 100644
--- a/src/modules/dialog/dlg_handlers.c
+++ b/src/modules/dialog/dlg_handlers.c
@@ -71,6 +71,7 @@ extern int dlg_send_bye;
extern int dlg_event_rt[DLG_EVENTRT_MAX];
extern int dlg_wait_ack;
extern int dlg_enable_dmq;
+extern int dlg_ignore_non_local_dlg;
int spiral_detected = -1;
extern struct rr_binds d_rrb; /*!< binding to record-routing module */
@@ -1581,6 +1582,18 @@ void dlg_ontimeout(struct dlg_tl *tl)
dlg = ((struct dlg_cell*)((char *)(tl) -
(unsigned long)(&((struct dlg_cell*)0)->tl)));
+ if (dlg_ignore_non_local_dlg) {
+ if (dlg->bind_addr[0] == NULL) {
+ LM_DBG("skipping dialog without bind address\n");
+ return;
+ }
+
+ if (lookup_local_socket(&(dlg->bind_addr[0]->sock_str)) == NULL) {
+ LM_DBG("skipping non local dialog\n");
+ return;
+ }
+ }
+
/* mark dialog as expired */
dlg->dflags |= DLG_FLAG_EXPIRED;
diff --git a/src/modules/dialog/dlg_req_within.c b/src/modules/dialog/dlg_req_within.c
index 809834527ff..c38d2062ccd 100644
--- a/src/modules/dialog/dlg_req_within.c
+++ b/src/modules/dialog/dlg_req_within.c
@@ -53,6 +53,7 @@
extern str dlg_extra_hdrs;
extern str dlg_lreq_callee_headers;
extern int dlg_ka_failed_limit;
+extern int dlg_ignore_non_local_dlg;
/**
*
@@ -452,6 +453,18 @@ int dlg_send_ka(dlg_cell_t *dlg, int dir)
int result;
dlg_iuid_t *iuid = NULL;
+ if (dlg_ignore_non_local_dlg) {
+ if (dlg->bind_addr[dir] == NULL) {
+ LM_DBG("skipping dialog without bind address\n");
+ return 0;
+ }
+
+ if (lookup_local_socket(&(dlg->bind_addr[dir]->sock_str)) == NULL) {
+ LM_DBG("skipping non local dialog\n");
+ return 0;
+ }
+ }
+
/* do not send KA request for non-confirmed dialogs (not supported) */
if (dlg->state != DLG_STATE_CONFIRMED) {
LM_DBG("skipping non-confirmed dialogs\n");
diff --git a/src/modules/dialog/doc/dialog_admin.xml b/src/modules/dialog/doc/dialog_admin.xml
index 290e68d4d63..1850a08de63 100644
--- a/src/modules/dialog/doc/dialog_admin.xml
+++ b/src/modules/dialog/doc/dialog_admin.xml
@@ -1299,7 +1299,26 @@ modparam("dialog", "send_bye", 1)
-
+
+ ignore_non_local_dlg (int)
+
+ If set to 1, don't send keepalives and
+ do nothing on timeout if dialog is non local.
+
+
+
+ Default value is 0
.
+
+
+
+ Set ignore_non_local_dlg parameter
+
+...
+modparam("dialog", "ignore_non_local_dlg", 1)
+...
+
+
+