Module: kamailio
Branch: master
Commit: e737942fbabc1f5d6d50a51c667cc0533cfe5777
URL:
https://github.com/kamailio/kamailio/commit/e737942fbabc1f5d6d50a51c667cc05…
Author: zxcpoiu <zxcpoiu(a)gmail.com>
Committer: zxcpoiu <zxcpoiu(a)gmail.com>
Date: 2015-08-27T16:34:42+08:00
usrloc: new param to skip non-local location record
- If set, kamailio will skip record if socket value doesn't in
listening socket list when loading record from database.
---
Modified: modules/usrloc/doc/usrloc_admin.xml
Modified: modules/usrloc/udomain.c
Modified: modules/usrloc/ul_mod.c
Modified: modules/usrloc/ul_mod.h
---
Diff:
https://github.com/kamailio/kamailio/commit/e737942fbabc1f5d6d50a51c667cc05…
Patch:
https://github.com/kamailio/kamailio/commit/e737942fbabc1f5d6d50a51c667cc05…
---
diff --git a/modules/usrloc/doc/usrloc_admin.xml b/modules/usrloc/doc/usrloc_admin.xml
index 6e65399..1d2b0c8 100644
--- a/modules/usrloc/doc/usrloc_admin.xml
+++ b/modules/usrloc/doc/usrloc_admin.xml
@@ -1064,6 +1064,28 @@ modparam("usrloc", "db_insert_null", 1)
</example>
</section>
+ <section id="usrloc.p.skip_remote_socket">
+ <title><varname>skip_remote_socket</varname> (int)</title>
+ <para>
+ If set to 1, Kamailio will skip location record when loading from
+ database, if socket value of the record does not in kamailio
+ listening socket list.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote>0</quote>.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>skip_remote_socket</varname>
parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("usrloc", "skip_remote_socket", 1)
+...
+</programlisting>
+ </example>
+ </section>
+
</section>
<section>
diff --git a/modules/usrloc/udomain.c b/modules/usrloc/udomain.c
index 50592fb..6d135da 100644
--- a/modules/usrloc/udomain.c
+++ b/modules/usrloc/udomain.c
@@ -311,6 +311,9 @@ static inline ucontact_info_t* dbrow2info(db_val_t *vals, str
*contact, int rcon
ci.sock = grep_sock_info( &host, (unsigned short)port, proto);
if (ci.sock==0) {
LM_DBG("non-local socket <%s>...ignoring\n", p);
+ if (skip_remote_socket) {
+ return 0;
+ }
}
}
diff --git a/modules/usrloc/ul_mod.c b/modules/usrloc/ul_mod.c
index fc54f46..1b41f26 100644
--- a/modules/usrloc/ul_mod.c
+++ b/modules/usrloc/ul_mod.c
@@ -161,6 +161,7 @@ int use_domain = 0; /*!< Whether usrloc should use domain
part of aor */
int desc_time_order = 0; /*!< By default do not enable timestamp ordering */
int handle_lost_tcp = 0; /*!< By default do not remove contacts before expiration
time */
int close_expired_tcp = 0; /*!< By default do not close TCP connections for expired
contacts */
+int skip_remote_socket = 0; /*!< By default do not skip remote socket */
int ul_fetch_rows = 2000; /*!< number of rows to fetch from result */
int ul_hash_size = 10;
@@ -221,6 +222,7 @@ static param_export_t params[] = {
{"nat_bflag", INT_PARAM, &nat_bflag },
{"handle_lost_tcp", INT_PARAM, &handle_lost_tcp },
{"close_expired_tcp", INT_PARAM, &close_expired_tcp },
+ {"skip_remote_socket", INT_PARAM, &skip_remote_socket },
{"preload", PARAM_STRING|USE_FUNC_PARAM,
(void*)ul_preload_param},
{"db_update_as_insert", INT_PARAM, &ul_db_update_as_insert},
{"timer_procs", INT_PARAM, &ul_timer_procs},
diff --git a/modules/usrloc/ul_mod.h b/modules/usrloc/ul_mod.h
index b8a20ec..e038762 100644
--- a/modules/usrloc/ul_mod.h
+++ b/modules/usrloc/ul_mod.h
@@ -86,6 +86,7 @@ extern int ul_db_check_update;
extern int ul_keepalive_timeout;
extern int handle_lost_tcp;
extern int close_expired_tcp;
+extern int skip_remote_socket;
/*! nat branch flag */