Hi,
I need to define variables as string explicitly.
What I have in the code:
in prefix_list is 123,456,789
$var(matched_prefix) = $(var(prefix_list){s.select,$var(i),,});
then in MAIN route:
$var(matched_prefix) = route(INCOMING_AUTH);
and this check
if ($var(matched_prefix) != "nullprefix")
returns:
WARNING: <core> [rvalue.c:1012]: automatic string to int conversion for
"nullprefix" failed
WARNING: <core> [rvalue.c:1916]: rval expression conversion to int failed
(153,32-153,43)
I would like to have all values as string to avoid these errors.
Thanks,
Mino
I tried to get ruid by using this feature.
http://kamailio.org/docs/modules/stable/modules/registrar.html#idp1752184.
I use source code from git repo from June 7th.
Have added modparam("registrar", "xavp_cfg", "ulrcd") in the config.
In route[REGISTRAR], i try to print it's value by using this code in
kamailio config :
pv_printf("$var(ruidd)", "$xavp(ulrcd=>ruid)");
xlog("L_ERR", "registrasi $var(ruidd)");
xlog("L_ERR", "registrasi $xavp(ulrcd=>ruid)");
both codes give me : registrasi <null>.
How to obtain that value? I think i missed something.
--
Iwan Budi Kusnanto
Hello,
I have a kamailio 3.3.4 server running on x86-64 Linux, and I have a
script which looks something like this:
$var(gwruri) = $rU;
if ($(var(gwruri){s.substr,0,1}) == "+") {
$var(gwruri) = $(var(gwruri){s.substr,1,0});
}
When this script is run with say $rU = "+0000009724" (real number
removed). $var(gwruri) should contain the same but without the +, this
is not the case, $var(gwruri) ends up being "0000007724".
This smells memory corruption. When run under valgrind, valgrind
generates this error when that code is run:
==1206== Source and destination overlap in strncpy(0x55e3b2a, 0x55e3b2b, 10)
==1206== at 0x4C25ACF: strncpy (mc_replace_strmem.c:339)
==1206== by 0x2A28BB92: set_var_value (pv_svar.c:122)
==1206== by 0x2A2800D1: pv_set_scriptvar (pv_core.c:1683)
==1206== by 0x45E8F8: lval_assign (lvalue.c:353)
==1206== by 0x416A78: do_action (action.c:1524)
==1206== by 0x41E465: run_actions (action.c:1644)
==1206== by 0x4177FD: do_action (action.c:1136)
==1206== by 0x41E465: run_actions (action.c:1644)
==1206== by 0x4177FD: do_action (action.c:1136)
==1206== by 0x41E465: run_actions (action.c:1644)
==1206== by 0x419C67: do_action (action.c:1140)
==1206== by 0x41E465: run_actions (action.c:1644)
==1206==
I am not very familiar with the kamailio source code, but as far as I
can tell this happens because the strncpy() in set_var_value() in
pv_svar.c copies the string directly within the same overlapping memory
area. The same memory area is used because the tr_eval_string() function
and the TR_S_SUBSTR-code in pv_trans.c reuses the input buffer and just
increments the pointer and since the source pvar is the same as the
destination pvar the strncpy() ends up copying between overlapping
memory area.
I am not sure what the best fix would be for that, but I have attached a
patch which copies the string in the TR_S_SUBST code to _tr_buffer and
returns that buffer instead like a lot of the other transformations in
that function does.
If this fix is correct some other transformation functions probably
needs to be corrected as well.
--
Martin Mikkelsen, Zisson AS
Hello,
I am considering to release kamailio v4.0.2 next week on Wednesday, June
12. Developers that committed fixes on master branch and should be
backported, have to do it before. Overall, everyone should keep an eye
and be sure their demanded fixes are backported.
Cheers,
Daniel
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
* http://asipto.com/u/katu *
Hi List,
I've been trying to make the Presence thing work with kamailio but the very
basic presence doesn't seem to work. I've tried multiple modules and
different how-tos for running successful presence aware configuration but
seems something is missing. The ultimate goal is to give user
online/busy/offline status updaes to Subscribers.
My Kamailio version is: kamailio 4.0.1 (i386/linux) 55f7de
I've loaded the following modules.
loadmodule "presence.so"
loadmodule "presence_xml.so"
loadmodule "presence_dialoginfo.so"
loadmodule "presence_reginfo"
loadmodule "pua.so"
#loadmodule "sca.so"
loadmodule "pua_dialoginfo.so"
loadmodule "pua_usrloc.so"
loadmodule "pua_reginfo"
The Presence route contains this:
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;
xlog("L_INFO", "[$fU@$si:$sp]{$rm} In Presence Route \n");
#!ifdef WITH_PRESENCE
if (!t_newtran())
{
sl_reply_error();
exit;
};
if(is_method("PUBLISH"))
{
handle_publish();
t_release();
}
else
if( is_method("SUBSCRIBE"))
{
handle_subscribe();
t_release();
}
exit;
#!endif
# if presence enabled, this part will not be executed
if (is_method("PUBLISH") || $rU==$null)
{
sl_send_reply("404", "Not here");
exit;
}
return;
}
Then I've my x-lite phone (which is known to work with Presence in
Asterisk) tries to register and subscribe to its own extensions. Nothing
happens. The trace from sipgrep is attached.
Please help me in making presence work.
Thanks,
Sammy
Hi,
I have to iterate string like 1,2,3,4 in kamailio. How could you do this? I
know we have s.select,index,separator but I dont know how to go through all
elements. Thanks,
Mino
I was just looking over:
http://kb.asipto.com/asterisk:realtime:kamailio-3.3.x-asterisk-10.7.0-astdb
A couple of things I noticed:
- Kamailio is using a column sippasswd which is not hashed. Asterisk
doesn't use that column at all. Is there any reason this can't be done
with the H(A1) and H(A1b) columns? The INSERT example shows a
non-encrypted password.
- Is it all considered valid for Kamailio 4 and Asterisk 11? (maybe a
disclaimer could be added at the top)
- The Asterisk columns `md5secret' and `secret' are left empty so that
Asterisk won't challenge. I believe there are other ways of doing this:
for example, telling Kamailio to be the registrar and forcing Asterisk
to use outbound proxy mode. I managed to make this work against repro -
Asterisk no longer receives any REGISTER messages, but all INVITEs go
through Asterisk, so the double-challenge problem only arises for
INVITEs. Maybe Asterisk can be told that Kamailio's source IP:port is
`trusted' and doesn't need to be challenged - is anybody aware of such
an option in Asterisk?