Module: kamailio
Branch: master
Commit: 027871f7a91cf288d36029a4f339801e8b620d10
URL:
https://github.com/kamailio/kamailio/commit/027871f7a91cf288d36029a4f339801…
Author: Oriol Capsada <ocapsada(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-12T10:42:48+02:00
cplc: use route names to set proxy_route modparam
- Changed proxy_route modparam type to string. The route to be executed
needs to be defined by name as the current id definition led to some
unpredictable behavior.
---
Modified: src/modules/cplc/cplc.c
Modified: src/modules/cplc/doc/cplc_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/027871f7a91cf288d36029a4f339801…
Patch:
https://github.com/kamailio/kamailio/commit/027871f7a91cf288d36029a4f339801…
---
diff --git a/src/modules/cplc/cplc.c b/src/modules/cplc/cplc.c
index 5a2b8972dc..cb47ffc4e0 100644
--- a/src/modules/cplc/cplc.c
+++ b/src/modules/cplc/cplc.c
@@ -62,6 +62,7 @@ static str db_table = str_init("cpl"); /* database
table */
static char *dtd_file = 0; /* name of the DTD file for CPL parser */
static char *lookup_domain = 0;
static str timer_avp = STR_NULL; /* name of variable timer AVP */
+static str proxy_route = STR_NULL;
struct cpl_enviroment cpl_env = {
@@ -132,7 +133,7 @@ static param_export_t params[] = {
{"db_table", PARAM_STR, &db_table },
{"cpl_dtd_file", PARAM_STRING, &dtd_file },
{"proxy_recurse", INT_PARAM, &cpl_env.proxy_recurse },
- {"proxy_route", INT_PARAM, &cpl_env.proxy_route },
+ {"proxy_route", PARAM_STR, &proxy_route },
{"log_dir", PARAM_STRING, &cpl_env.log_dir },
{"case_sensitive", INT_PARAM, &cpl_env.case_sensitive },
{"realm_prefix", PARAM_STR, &cpl_env.realm_prefix },
@@ -232,6 +233,14 @@ static int cpl_init(void)
goto error;
}
+ if (proxy_route.len>0) {
+ cpl_env.proxy_route=route_lookup(&main_rt, proxy_route.s);
+ if (cpl_env.proxy_route==-1) {
+ LM_CRIT("route <%s> defined in proxy_route does not
exist\n",proxy_route.s);
+ goto error;
+ }
+ }
+
/* fix the timer_avp name */
if (timer_avp.s && timer_avp.len > 0) {
if (pv_parse_spec(&timer_avp, &avp_spec)==0
diff --git a/src/modules/cplc/doc/cplc_admin.xml b/src/modules/cplc/doc/cplc_admin.xml
index ac832a1e5f..9d7ed7749e 100644
--- a/src/modules/cplc/doc/cplc_admin.xml
+++ b/src/modules/cplc/doc/cplc_admin.xml
@@ -280,7 +280,7 @@ modparam("cpl-c","proxy_recurse",2)
</example>
</section>
<section>
- <title><varname>proxy_route</varname> (int)</title>
+ <title><varname>proxy_route</varname> (string)</title>
<para>
Before doing proxy (forward), a script route can be executed.
All modifications made by that route will be reflected only for
@@ -288,14 +288,14 @@ modparam("cpl-c","proxy_recurse",2)
</para>
<para>
<emphasis>
- Default value of this parameter is 0 (none).
+ Default value of this parameter is NULL (none).
</emphasis>
</para>
<example>
<title>Set <varname>proxy_route</varname> parameter</title>
<programlisting format="linespecific">
...
-modparam("cpl-c","proxy_route",1)
+modparam("cpl-c","proxy_route","1")
...
</programlisting>
</example>