I am trying to activate the pike module on a 3.0.3 server.
When I load the module, kamailio will not handle any incoming messages. Regardless if I use the pike_check_req function or not. - NOthing enters the routing script at all.
Has anyone seen this?
Btw, the pike docs doesn't specify the time units - if it's eons, centuries or milliseconds.
Cheers,
/O
Module: sip-router
Branch: tirpi/cfg_framework_multivalue
Commit: cd8c0719514877dd1973fa556002e65396afb0b2
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cd8c071…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Tue Oct 5 16:15:44 2010 +0200
cfg_rpc: cfg.set and cfg.set_delayed commands added
cfg.set is a shortcut to cfg.set_now_int and cfg.set_now_string
depending on the parameter type, i.e the syntax is:
cfg.set <group> <var> <int/string value>
or
cfg.set <group>[id] <var> <int/string value>
Similarly, cfg.set_delayed is a shortcut to cfg.set_delayed_int/string
---
modules/cfg_rpc/README | 12 +++++++++
modules/cfg_rpc/cfg_rpc.c | 58 +++++++++++++++++++++++++++++++++++++++++++
modules/cfg_rpc/doc/rpc.xml | 22 ++++++++++++++++
3 files changed, 92 insertions(+), 0 deletions(-)
diff --git a/modules/cfg_rpc/README b/modules/cfg_rpc/README
index 4217506..385ee8d 100644
--- a/modules/cfg_rpc/README
+++ b/modules/cfg_rpc/README
@@ -29,6 +29,12 @@ Miklos Tirpak
commit the change immediately. The function accepts three
parameters: group name, variable name, string value. The group name
can optionally contain the group instance id, for example foo[5].
+ * cfg.set - Set the value of a configuration variable and commit the
+ change immediately. This is a wrapper command for cfg.set_now_int
+ and cfg.set_now_string depending on the type of the value provided.
+ The function accepts three parameters: group name, variable name,
+ int/string value. The group name can optionally contain the group
+ instance id, for example foo[5].
* cfg.set_delayed_int - Prepare the change of a configuration
variable, but does not commit the new value yet. The function
accepts three parameters: group name, variable name, integer value.
@@ -39,6 +45,12 @@ Miklos Tirpak
accepts three parameters: group name, variable name, string value.
The group name can optionally contain the group instance id, for
example foo[5].
+ * cfg.set_delayed - Prepare the change of a configuration variable,
+ but does not commit the new value yet. This is a wrapper command
+ for cfg.set_delayed_int and cfg.set_delayed_string depending on the
+ type of the value provided. The function accepts three parameters:
+ group name, variable name, int/string value. The group name can
+ optionally contain the group instance id, for example foo[5].
* cfg.commit - Commit the previously prepared configuration changes.
The function does not have any parameters.
* cfg.rollback - Drop the prepared configuration changes. The
diff --git a/modules/cfg_rpc/cfg_rpc.c b/modules/cfg_rpc/cfg_rpc.c
index f982d40..0ec588f 100644
--- a/modules/cfg_rpc/cfg_rpc.c
+++ b/modules/cfg_rpc/cfg_rpc.c
@@ -128,6 +128,34 @@ static void rpc_set_now_string(rpc_t* rpc, void* c)
}
}
+static void rpc_set(rpc_t* rpc, void* c)
+{
+ str group, var;
+ int i, err;
+ char *ch;
+ unsigned int *group_id;
+
+ if (rpc->scan(c, "SS", &group, &var) < 2)
+ return;
+
+ if (get_group_id(&group, &group_id)) {
+ rpc->fault(c, 400, "Wrong group syntax. Use either \"group\", or \"group[id]\"");
+ return;
+ }
+
+ if (rpc->scan(c, "d", &i) == 1)
+ err = cfg_set_now_int(ctx, &group, group_id, &var, i);
+ else if (rpc->scan(c, "s", &ch) == 1)
+ err = cfg_set_now_string(ctx, &group, group_id, &var, ch);
+ else
+ return; /* error */
+
+ if (err) {
+ rpc->fault(c, 400, "Failed to set the variable");
+ return;
+ }
+}
+
static const char* rpc_set_delayed_doc[2] = {
"Prepare the change of a configuration variable, but does not commit the new value yet",
0
@@ -173,6 +201,34 @@ static void rpc_set_delayed_string(rpc_t* rpc, void* c)
}
}
+static void rpc_set_delayed(rpc_t* rpc, void* c)
+{
+ str group, var;
+ int i, err;
+ char *ch;
+ unsigned int *group_id;
+
+ if (rpc->scan(c, "SS", &group, &var) < 2)
+ return;
+
+ if (get_group_id(&group, &group_id)) {
+ rpc->fault(c, 400, "Wrong group syntax. Use either \"group\", or \"group[id]\"");
+ return;
+ }
+
+ if (rpc->scan(c, "d", &i) == 1)
+ err = cfg_set_delayed_int(ctx, &group, group_id, &var, i);
+ else if (rpc->scan(c, "s", &ch) == 1)
+ err = cfg_set_delayed_string(ctx, &group, group_id, &var, ch);
+ else
+ return; /* error */
+
+ if (err) {
+ rpc->fault(c, 400, "Failed to set the variable");
+ return;
+ }
+}
+
static const char* rpc_commit_doc[2] = {
"Commit the previously prepared configuration changes",
0
@@ -419,8 +475,10 @@ static void rpc_del_group_inst(rpc_t* rpc, void* c)
}
static rpc_export_t rpc_calls[] = {
+ {"cfg.set", rpc_set, rpc_set_now_doc, 0},
{"cfg.set_now_int", rpc_set_now_int, rpc_set_now_doc, 0},
{"cfg.set_now_string", rpc_set_now_string, rpc_set_now_doc, 0},
+ {"cfg.set_delayed", rpc_set_delayed, rpc_set_delayed_doc, 0},
{"cfg.set_delayed_int", rpc_set_delayed_int, rpc_set_delayed_doc, 0},
{"cfg.set_delayed_string", rpc_set_delayed_string, rpc_set_delayed_doc, 0},
{"cfg.commit", rpc_commit, rpc_commit_doc, 0},
diff --git a/modules/cfg_rpc/doc/rpc.xml b/modules/cfg_rpc/doc/rpc.xml
index 47528d3..24c5769 100644
--- a/modules/cfg_rpc/doc/rpc.xml
+++ b/modules/cfg_rpc/doc/rpc.xml
@@ -30,6 +30,17 @@
</listitem>
<listitem>
<para>
+ <emphasis>cfg.set</emphasis> - Set the value of
+ a configuration variable and commit the change immediately.
+ This is a wrapper command for cfg.set_now_int and cfg.set_now_string
+ depending on the type of the value provided.
+ The function accepts three parameters: group name, variable
+ name, int/string value. The group name can optionally contain the
+ group instance id, for example foo[5].
+ </para>
+ </listitem>
+ <listitem>
+ <para>
<emphasis>cfg.set_delayed_int</emphasis> - Prepare the change of
a configuration variable, but does not commit the new value yet.
The function accepts three parameters: group name, variable
@@ -48,6 +59,17 @@
</listitem>
<listitem>
<para>
+ <emphasis>cfg.set_delayed</emphasis> - Prepare the change of
+ a configuration variable, but does not commit the new value yet.
+ This is a wrapper command for cfg.set_delayed_int and cfg.set_delayed_string
+ depending on the type of the value provided.
+ The function accepts three parameters: group name, variable
+ name, int/string value. The group name can optionally contain the
+ group instance id, for example foo[5].
+ </para>
+ </listitem>
+ <listitem>
+ <para>
<emphasis>cfg.commit</emphasis> - Commit the previously
prepared configuration changes. The function does not have
any parameters.
While compiling db_postgres on CentOS I got the following warnings:
+ make every-module group_include=kpostgres
CC (gcc) [M db_postgres.so] km_db_postgres.o
CC (gcc) [M db_postgres.so] km_dbase.o
CC (gcc) [M db_postgres.so] km_pg_con.o
CC (gcc) [M db_postgres.so] km_res.o
CC (gcc) [M db_postgres.so] km_val.o
CC (gcc) [M db_postgres.so] pg_cmd.o
pg_cmd.c: In function 'get_types':
pg_cmd.c:206: warning: implicit declaration of function 'PQdescribePrepared'
pg_cmd.c:206: warning: assignment makes pointer from integer without a cast
pg_cmd.c: In function 'pg_cmd_exec':
pg_cmd.c:449: warning: assignment makes pointer from integer without a cast
CC (gcc) [M db_postgres.so] pg_con.o
CC (gcc) [M db_postgres.so] pg_fld.o
pg_fld.c: In function 'pg_resolve_param_oids':
pg_fld.c:485: warning: implicit declaration of function 'PQnparams'
pg_fld.c:492: warning: implicit declaration of function 'PQparamtype'
CC (gcc) [M db_postgres.so] pg_mod.o
CC (gcc) [M db_postgres.so] pg_oid.o
CC (gcc) [M db_postgres.so] pg_res.o
CC (gcc) [M db_postgres.so] pg_sql.o
CC (gcc) [M db_postgres.so] pg_uri.o
make[2]: `libsrdb2.so.1.0' is up to date.
make[2]: `libsrdb1.so.1.0' is up to date.
LD (gcc) [M db_postgres.so] db_postgres.so
Regards,
Ovidiu Sas
app_lua fails to install on CentOS due to the following error:
+ make every-module group_include=klua
CC (gcc) [M app_lua.so] app_lua_api.o
CC (gcc) [M app_lua.so] app_lua_exp.o
CC (gcc) [M app_lua.so] app_lua_mod.o
CC (gcc) [M app_lua.so] app_lua_sr.o
make[2]: `libkcore.so.1.0' is up to date.
LD (gcc) [M app_lua.so] app_lua.so
/usr/bin/ld: cannot find -llua5.1
collect2: ld returned 1 exit status
make[1]: *** [app_lua.so] Error 1
make: *** [modules] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.57650 (%build)
With the attached patch, it installs ok:
diff --git a/modules/app_lua/Makefile b/modules/app_lua/Makefile
index a466ab9..f703ac7 100644
--- a/modules/app_lua/Makefile
+++ b/modules/app_lua/Makefile
@@ -8,7 +8,7 @@
include ../../Makefile.defs
auto_gen=
NAME=app_lua.so
-LIBS= -llua5.1
+LIBS= -llua-5.1
DEFS+=-I/usr/include/lua5.1
DEFS+=-DOPENSER_MOD_INTERFACE
The library is lua-5.1:
# rpm -q --list lua
/usr/bin/lua
/usr/bin/luac
/usr/lib/liblua-5.1.so
/usr/share/doc/lua-5.1.2
/usr/share/doc/lua-5.1.2/COPYRIGHT
/usr/share/doc/lua-5.1.2/HISTORY
/usr/share/doc/lua-5.1.2/README
/usr/share/doc/lua-5.1.2/amazon.gif
/usr/share/doc/lua-5.1.2/contents.html
/usr/share/doc/lua-5.1.2/cover.png
/usr/share/doc/lua-5.1.2/logo.gif
/usr/share/doc/lua-5.1.2/lua.css
/usr/share/doc/lua-5.1.2/lua.html
/usr/share/doc/lua-5.1.2/luac.html
/usr/share/doc/lua-5.1.2/manual.css
/usr/share/doc/lua-5.1.2/manual.html
/usr/share/doc/lua-5.1.2/readme.html
/usr/share/man/man1/lua.1.gz
/usr/share/man/man1/luac.1.gz
Most likely the above patch will break app_lua on other platform.
We need a way to properly identify the proper lua lib that needs to be
passed during the linking process.
Also, on CentOS the lua include files are under /usr/include:
# rpm -q --list lua-devel
/usr/include/lauxlib.h
/usr/include/lua.h
/usr/include/lua.hpp
/usr/include/luaconf.h
/usr/include/lualib.h
/usr/lib/liblua.so
/usr/lib/pkgconfig/lua.pc
As a result, 'DEFS+=-I/usr/include/lua5.1' is not needed on CentOS
(having it defined is harmless).
Regards,
Ovidiu Sas
Hello Daniel,
I have still corrected the initial request mail in June and explained
that the tables "acc" and "missed_calls" do not need any change. They
are / were working fine.
However, in a first quick try of testing the pre-release I found out
that the "not NULL" options in the relations "presentity" and "pua" are
still wrong. They must be adapted manually for Kamailio being able to
insert an entry into the database.
I will follow up with deeper tests of the presence related stuff and
will send an updated message about what is working fine and what not.
regards,
Klaus Feichtinger
> Hello,
>
> I have reapplied part of Henning's patch to solve the non null
> terminated blobs causing issues with presence modules. Please give it
> at
> try as well and report if works fine.
>
> From the discussion done in June (the link you provided), I didn't
> get
> why acc and missed_calls need to allow null for id columns - they
> should
> be auto-incremented, being a sequence like in the other tables. Here
> is your initial email in that thread:
> http://lists.sip-router.org/pipermail/sr-dev/2010-June/007882.html
>
> If you can refresh what is still not working after last fixes, would
> be great.
>
> Thanks,
> Daniel
>
> On 9/30/10 10:19 AM, klaus.lists(a)inode.at wrote:
>> Hello,
>>
>> I've heard your appeal to support testing the new pre-release 3.1 of
>> kamailio. So I started with compiling and installing it. My focus is
>> / was testing kamailio 3.1 with DB engine POSTGRESQL.
>>
>> However, my testing phase was stopped very early, because "kamdbctl
>> create" was stopped by an error message related to creating the table
>> "lcr". AFAIK the tables / table names have changed, because Juha has
>> modified this module as discussed earlier in this list. Could this be
>> the reason why kamdbctl stopped? It seems that the script still knows
>> only the old relations within the DB.
>>
>> The error message looks as follows:
>>
>> voiceserver1:/usr/local/etc/kamailio# kamdbctl create
>> INFO: creating database openser ...
>> NOTICE: CREATE TABLE will create implicit sequence "acc_id_seq" for
>> serial column "acc.id"
>> [...]
>> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
>> "dialplan_pkey" for table "dialplan"
>> ERROR: relation "lcr" does not exist
>> ERROR: relation "lcr" does not exist
>> ERROR: relation "lcr_id_seq" does not exist
>> ERROR: relation "lcr_id_seq" does not exist
>> ERROR: Grant privileges to standard tables failed!
>>
>>
>> I recommend CHECKING the initialisation script(s) for POSTGRESQL in
>> general. Because in the previous release 3.0.3 the problem / error
>> with wrong settings for column attributes especially for presence
>> related tables (as discussed in spring this year - see
>> http://lists.sip-router.org/pipermail/sr-dev/2010-June/007896.html)
>> is still present!
>>
>> regards,
>> Klaus Feichtinger
>>
>>
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev(a)lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
> --
> Daniel-Constantin Mierla
> http://www.asipto.com
Hello,
I've heard your appeal to support testing the new pre-release 3.1 of
kamailio. So I started with compiling and installing it. My focus is / was
testing kamailio 3.1 with DB engine POSTGRESQL.
However, my testing phase was stopped very early, because "kamdbctl
create" was stopped by an error message related to creating the table
"lcr". AFAIK the tables / table names have changed, because Juha has
modified this module as discussed earlier in this list. Could this be the
reason why kamdbctl stopped? It seems that the script still knows only the
old relations within the DB.
The error message looks as follows:
voiceserver1:/usr/local/etc/kamailio# kamdbctl create
INFO: creating database openser ...
NOTICE: CREATE TABLE will create implicit sequence "acc_id_seq" for
serial column "acc.id"
[...]
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"dialplan_pkey" for table "dialplan"
ERROR: relation "lcr" does not exist
ERROR: relation "lcr" does not exist
ERROR: relation "lcr_id_seq" does not exist
ERROR: relation "lcr_id_seq" does not exist
ERROR: Grant privileges to standard tables failed!
I recommend CHECKING the initialisation script(s) for POSTGRESQL in
general. Because in the previous release 3.0.3 the problem / error with
wrong settings for column attributes especially for presence related
tables (as discussed in spring this year - see
http://lists.sip-router.org/pipermail/sr-dev/2010-June/007896.html) is
still present!
regards,
Klaus Feichtinger