Module: kamailio
Branch: master
Commit: ec3f9634c8474ff4dc9e5cb0ac451064e912734d
URL:
https://github.com/kamailio/kamailio/commit/ec3f9634c8474ff4dc9e5cb0ac45106…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-08-20T08:01:25+02:00
ruxc: added modparams to set libruxc logtype and debug
---
Modified: src/modules/ruxc/doc/ruxc_admin.xml
Modified: src/modules/ruxc/ruxc_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ec3f9634c8474ff4dc9e5cb0ac45106…
Patch:
https://github.com/kamailio/kamailio/commit/ec3f9634c8474ff4dc9e5cb0ac45106…
---
diff --git a/src/modules/ruxc/doc/ruxc_admin.xml b/src/modules/ruxc/doc/ruxc_admin.xml
index d0cd3bf7f7..2c1aec6285 100644
--- a/src/modules/ruxc/doc/ruxc_admin.xml
+++ b/src/modules/ruxc/doc/ruxc_admin.xml
@@ -140,6 +140,45 @@ modparam("ruxc", "http_reuse", 1)
...
modparam("ruxc", "http_retry", 2)
...
+</programlisting>
+ </example>
+ </section>
+ <section id="ruxc.p.http_logtype">
+ <title><varname>http_logtype</varname> (int)</title>
+ <para>
+ Set the log type for libruxc http functions: 0 - stdout; 1 - syslog.
+ </para>
+ <para>
+ <emphasis>
+ Default value is 0.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>http_logtype</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("ruxc", "http_logtype", 1)
+...
+</programlisting>
+ </example>
+ </section>
+ <section id="ruxc.p.http_debug">
+ <title><varname>http_debug</varname> (int)</title>
+ <para>
+ Set the debug mode for libruxc http functions: 0 - no debug; 1 - errors;
+ 2 - debug.
+ </para>
+ <para>
+ <emphasis>
+ Default value is 0.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>http_debug</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("ruxc", "http_debug", 1)
+...
</programlisting>
</example>
</section>
diff --git a/src/modules/ruxc/ruxc_mod.c b/src/modules/ruxc/ruxc_mod.c
index 13c4a54b52..a31f650873 100644
--- a/src/modules/ruxc/ruxc_mod.c
+++ b/src/modules/ruxc/ruxc_mod.c
@@ -42,6 +42,8 @@ static int _ruxc_http_timeout = 5000;
static int _ruxc_http_tlsmode = 0;
static int _ruxc_http_reuse = 0;
static int _ruxc_http_retry = 0;
+static int _ruxc_http_logtype = 0;
+static int _ruxc_http_debug = 0;
static int mod_init(void);
static int child_init(int);
@@ -77,6 +79,8 @@ static param_export_t params[]={
{"http_tlsmode", PARAM_INT, &_ruxc_http_tlsmode},
{"http_reuse", PARAM_INT, &_ruxc_http_reuse},
{"http_retry", PARAM_INT, &_ruxc_http_retry},
+ {"http_logtype", PARAM_INT, &_ruxc_http_logtype},
+ {"http_debug", PARAM_INT, &_ruxc_http_debug},
{0, 0, 0}
};
@@ -101,6 +105,13 @@ struct module_exports exports = {
*/
static int mod_init(void)
{
+ if(_ruxc_http_logtype==1 && log_stderr==1) {
+ LM_INFO("setting http logtype to 0\n");
+ _ruxc_http_logtype = 0;
+ } else if(_ruxc_http_logtype==0 && log_stderr==0) {
+ LM_INFO("setting http logtype to 1\n");
+ _ruxc_http_logtype = 1;
+ }
return 0;
}
@@ -138,6 +149,8 @@ static int ki_ruxc_http_get_helper(sip_msg_t *_msg, str *url, str
*hdrs,
v_http_request.tlsmode = _ruxc_http_tlsmode;
v_http_request.reuse = _ruxc_http_reuse;
v_http_request.retry = _ruxc_http_retry;
+ v_http_request.logtype = _ruxc_http_logtype;
+ v_http_request.debug = _ruxc_http_debug;
v_http_request.url = url->s;
v_http_request.url_len = url->len;
@@ -237,6 +250,8 @@ static int ki_ruxc_http_post_helper(sip_msg_t *_msg, str *url, str
*body, str *h
v_http_request.tlsmode = _ruxc_http_tlsmode;
v_http_request.reuse = _ruxc_http_reuse;
v_http_request.retry = _ruxc_http_retry;
+ v_http_request.logtype = _ruxc_http_logtype;
+ v_http_request.debug = _ruxc_http_debug;
v_http_request.url = url->s;
v_http_request.url_len = url->len;