Module: kamailio
Branch: master
Commit: cba555e2ea8309e510bd830747caf8beb3c370fc
URL: 
https://github.com/kamailio/kamailio/commit/cba555e2ea8309e510bd830747caf8beb3c370fc

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-08-27T13:39:11+02:00

Merge pull request #306 from zxcpoiu/master

usrloc: really do the ignore location record if it's a non-local socket

---

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/cba555e2ea8309e510bd830747caf8beb3c370fc.diff
Patch: 
https://github.com/kamailio/kamailio/commit/cba555e2ea8309e510bd830747caf8beb3c370fc.patch

---

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 9b31a3b..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;
+                       }
                }
        }
 
@@ -477,7 +480,7 @@ int preload_udomain(db1_con_t* _c, udomain_t* _d)
 
                        ci = dbrow2info(ROW_VALUES(row)+1, &contact, 0);
                        if (ci==0) {
-                               LM_ERR("sipping record for %.*s in table %s\n",
+                               LM_ERR("skipping record for %.*s in table %s\n",
                                                user.len, user.s, _d->name->s);
                                continue;
                        }
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 */


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to