Hi,
When I'm trying to update $ru, $fu & $fd in Kamailio conf:
$rU = "1000";
$fu = "sip:something@mydomain.com";
$fd = "newdomain.com";
And later I'm trying to print out $rU, $fu, $fU & $fd in onsend_route:
xlog("ALERT: From URI $fu \n");
xlog("ALERT: From domain $fd \n");
xlog("ALERT: From user $fU \n");
xlog("ALERT: Request user $rU \n");
Kamailio 4.3.3 prints out following:
ALERT: From URI sip:2000@some_ip
ALERT: From domain some_ip
ALERT: From user 2000
ALERT: Request user 1000
But I believe it should:
ALERT: From URI sip:something@mydomain.com
ALERT: From domain mydomain.com
ALERT: From user something
ALERT: Request user 1000
I'm using default Kamailio config with minor changes, you can check it in attachment.
Thank you!
[kamailio.txt](https://github.com/kamailio/kamailio/files/51994/kamailio.txt)
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/430
i think i couldnt explain situation. with this commit dont change anything because this braces only work if ru_avp is null. so ruri_avps already filled first load_gws.
i think we need to add this delete_avp to line 2044 before add_gws_into_avps function in load_gws.
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/commit/d8991897275b5681bbe79cd4552b516…
Module: kamailio
Branch: master
Commit: d8991897275b5681bbe79cd4552b516ffa57894c
URL: https://github.com/kamailio/kamailio/commit/d8991897275b5681bbe79cd4552b516…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: 2015-12-04T13:21:47+02:00
modules/lcr: delete possible earlier ruri_user_avp value
when calling next_gws() first time after reload_gws()
- Credits to Yasin Caner
---
Modified: modules/lcr/lcr_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/d8991897275b5681bbe79cd4552b516…
Patch: https://github.com/kamailio/kamailio/commit/d8991897275b5681bbe79cd4552b516…
---
diff --git a/modules/lcr/lcr_mod.c b/modules/lcr/lcr_mod.c
index 81247d2..10d584f 100644
--- a/modules/lcr/lcr_mod.c
+++ b/modules/lcr/lcr_mod.c
@@ -2409,10 +2409,9 @@ void ping_timer(unsigned int ticks, void* param)
* transport parts of R-URI based on first gw_uri_avp value, which is then
* destroyed. Saves R-URI user to ruri_user_avp for later use.
*
- * On other calls, rewrites R-URI, where scheme, host, port,
- * and transport of URI are taken from the first gw_uri_avp value,
- * which is then destroyed. URI user is taken either from ruri_user_avp
- * value saved earlier.
+ * On other calls, rewrites R-URI, where scheme, host, port, and
+ * transport of URI are taken from the first gw_uri_avp value, which is then
+ * destroyed. URI user is taken from ruri_user_avp value saved earlier.
*
* Returns 1 upon success and -1 upon failure.
*/
@@ -2451,6 +2450,7 @@ static int next_gw(struct sip_msg* _m, char* _s1, char* _s2)
/* Save Request-URI user into uri_user_avp for use in subsequent
* invocations. */
+ delete_avp(ruri_user_avp_type|AVP_VAL_STR, ruri_user_avp);
val.s = _m->parsed_uri.user;
add_avp(ruri_user_avp_type|AVP_VAL_STR, ruri_user_avp, val);
LM_DBG("added ruri_user_avp <%.*s>\n", val.s.len, val.s.s);
Hi all,
I'm looking into different prepaid modules to work with kamailio for a
simple closed network setup (ie no outbound calls, internal calls only).
I have looked into the cnxcc module which I believe should work nicely with
this setup but I am confused regarding its connection to a db to lookup
credits for each user, max call time, etc.
I see in the module configs that it connects to a redis db on localhost,
but then I also see hardcoded variables in the example config as seen below.
I know the example hardcoded variables are for illustrative purposes only,
but then what is the redis connection there for?
Ideally I'd like to use MySQL to store the cnxcc variables since I already
use it for AUTH and registration purpose since I have the client's auth
info in there and am already using Siremis to intercat with the DB.
Is this possible or am I going about this the wrong way?
Anyone have a cnxcc config they could share that grabs those values from
MySQL?
Cheers,
Peter
Here's the relevant snippet from cnxcc.cfg with the hardcoded variables:
route[CNXCC]{ # # In real life scenarios, all the authorization values #
are retrieved from a database and calculed on-the-fly. # # This hardcoded
values are just for illustrative purposes # $var(client) = "customer1"; #!ifdef
CNXCC_MONEY xlog("L_INFO", "Setting up money based credit control");
$var(credit)
= "10"; # 10$ of credit $var(cost_per_sec) = "1"; # 1$ per sec
$var(i_pulse) = "1"; # 1$ to establish the call $var(f_pulse) = "1"; # 1$
per second # if only one call is established, that call should last 9
seconds. if (!cnxcc_set_max_credit("$var(client)", "$var(credit)", "
$var(cost_per_sec)", "$var(i_pulse)", "$var(f_pulse)")) { xlog("Error
setting up credit control"); sl_reply_error(); exit; }#!endif
Hi all,
i think at some point a wrong boolean condition was introduced to
fix_all_socket_lists in socket_info.c. Attached is a fix.
I am in the process of getting kamailio to run on my Solaris 11.3. I
observed that add_interfaces does not work properly on Solaris for IPv6
interfaces. Modern Solarises, however, have getifaddrs() which linuxes
have since glibc-2.3 (2005 or so) and freebsd has it as well (don't know
since when).
My plan is:
1. Replace add_interfaces with a getifaddrs() based implementation and
get feedback from the community re: Solaris, FreeBSD and other platforms
2. Drop add_interfaces_via_netlink in favour of the above as well (for
Linux).
What do you think?
Regards,
Christian
--- socket_info.c.orig 2015-11-25 14:42:32.000000000 +0100
+++ socket_info.c 2015-12-02 13:45:51.130418762 +0100
@@ -1809,7 +1809,7 @@
#ifdef __OS_linux
&& (!auto_bind_ipv6 || add_interfaces_via_netlink(0,
AF_INET6, 0, PROTO_UDP, &ai_lst) == 0)
#else
- && ( !auto_bind_ipv6 || add_interfaces(0, AF_INET6, 0,
PROTO_UDP, &ai_lst) !=0 ) /* add_interface does not work for IPv6 on
Linux */
+ && ( !auto_bind_ipv6 || add_interfaces(0, AF_INET6, 0,
PROTO_UDP, &ai_lst) ==0 ) /* add_interface does not work for IPv6 on
Linux */
#endif /* __OS_linux */
) && (addr_info_to_si_lst(ai_lst, 0,
PROTO_UDP, 0, &udp_listen)==0)){
free_addr_info_lst(&ai_lst);
Module: kamailio
Branch: master
Commit: e2853a8ac22bc26d47153731f65479f03a756c52
URL: https://github.com/kamailio/kamailio/commit/e2853a8ac22bc26d47153731f65479f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-12-03T12:31:01+01:00
app_python: basic documentation for params and functions
- based on quick look at the code
---
Modified: modules/app_python/doc/app_python_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/e2853a8ac22bc26d47153731f65479f…
Patch: https://github.com/kamailio/kamailio/commit/e2853a8ac22bc26d47153731f65479f…
---
diff --git a/modules/app_python/doc/app_python_admin.xml b/modules/app_python/doc/app_python_admin.xml
index 56aa4df..ef726c4 100644
--- a/modules/app_python/doc/app_python_admin.xml
+++ b/modules/app_python/doc/app_python_admin.xml
@@ -20,6 +20,11 @@
This module allows executing Python scripts from config file,
exporting functions to access the SIP message from Python.
</para>
+ <para>
+ For some basic examples of Python scripts that can be used with
+ this module, look at the files inside source tree located at
+ 'modules/app_python/python_examples/'.
+ </para>
</section>
<section>
<title>Dependencies</title>
@@ -56,18 +61,19 @@
<section>
<title><varname>script_name</varname> (string)</title>
<para>
- TBD.
+ The path to the fiel with Python code to be executed
+ from configuration file.
</para>
<para>
<emphasis>
- Default value is <quote>/usr/local/etc/sip-router/handler.py</quote>.
+ Default value is <quote>/usr/local/etc/kamailio/handler.py</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>script_name</varname> parameter</title>
<programlisting format="linespecific">
...
-modparam("app_python", "script_name", "/usr/local/etc/sip-router/myscript.py")
+modparam("app_python", "script_name", "/usr/local/etc/kamailio/myscript.py")
...
</programlisting>
</example>
@@ -76,7 +82,8 @@ modparam("app_python", "script_name", "/usr/local/etc/sip-router/myscript.py")
<section>
<title><varname>mod_init_function</varname> (string)</title>
<para>
- TBD.
+ The Python function to be executed by this module when
+ it is initialied by &kamailio;.
</para>
<para>
<emphasis>
@@ -96,7 +103,8 @@ modparam("app_python", "mod_init_function", "my_mod_init")
<section>
<title><varname>child_init_method</varname> (string)</title>
<para>
- TBD.
+ The Python function to be executed by this module when
+ a new worker process (child) is initialied by &kamailio;.
</para>
<para>
<emphasis>
@@ -119,17 +127,19 @@ modparam("app_python", "child_init_method", "my_child_init")
<title>Functions</title>
<section>
<title>
- <function moreinfo="none">python_exec(method [, mystr])</function>
+ <function moreinfo="none">python_exec(method [, args])</function>
</title>
<para>
- TBD.
+ Execute the Python function with the name given by the parameter 'method'.
+ Optionally can be provided a second string with parameters to be passed
+ to the Python function.
</para>
<example>
<title><function>python_exec</function> usage</title>
<programlisting format="linespecific">
...
-python_exec("...");
-python_exec("...", "...");
+python_exec("my_python_function");
+python_exec("my_python_function", "my_params");
...
</programlisting>
</example>