Module: sip-router
Branch: master
Commit: 29e63735632a379df5d6b49130d05d47e2829a60
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=29e6373…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Oct 8 00:14:32 2009 +0200
core: fix cfg_update() on config error
Don't try to use the cfg framework if it was not initialized (it
could happen if for example config parsing fails and shutdown is
triggered before the cfg framework is initialized).
---
main.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/main.c b/main.c
index c1f9d07..01a6fde 100644
--- a/main.c
+++ b/main.c
@@ -473,6 +473,9 @@ unsigned long shm_mem_size=SHM_MEM_SIZE * 1024 * 1024;
int my_argc;
char **my_argv;
+/* set to 1 when the cfg framework and core cfg is initialized/registered */
+static int cfg_ok=0;
+
#define MAX_FD 32 /* maximum number of inherited open file descriptors,
(normally it shouldn't be bigger than 3) */
@@ -511,10 +514,12 @@ void cleanup(show_status)
/* restore the original core configuration before the
* config block is freed, otherwise even logging is unusable,
* it can case segfault */
- cfg_update();
- /* copy current config into default_core_cfg */
- if (core_cfg)
- default_core_cfg=*((struct cfg_group_core*)core_cfg);
+ if (cfg_ok){
+ cfg_update();
+ /* copy current config into default_core_cfg */
+ if (core_cfg)
+ default_core_cfg=*((struct cfg_group_core*)core_cfg);
+ }
core_cfg = &default_core_cfg;
cfg_destroy();
#ifdef USE_TCP
@@ -2080,6 +2085,7 @@ try_again:
LOG(L_CRIT, "could not declare the core configuration\n");
goto error;
}
+ cfg_ok=1;
#ifdef USE_TCP
if (tcp_register_cfg()){
LOG(L_CRIT, "could not register the tcp configuration\n");
Henning,
The memcached module is very useful. But I think it would be about
10x more useful if expiration values could be controlled on a per-key
basis rather than just globally as a modparam, because different kinds
of data needs to be aged out at different intervals.
What do you think?
-- Alex
--
Alex Balashov - Principal
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Module: sip-router
Branch: master
Commit: da3327522527211fcd76aba394de9f2f538d8b9d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=da33275…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Oct 7 18:35:00 2009 +0200
unit test(sr): add initial small test for memcache module
---
test/unit/45.cfg | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
test/unit/45.sh | 50 +++++++++++++++++++++++++++++++++++++
2 files changed, 122 insertions(+), 0 deletions(-)
diff --git a/test/unit/45.cfg b/test/unit/45.cfg
new file mode 100644
index 0000000..e434654
--- /dev/null
+++ b/test/unit/45.cfg
@@ -0,0 +1,72 @@
+# Kamailio config for lookup / registrar testing
+
+#------------------------Global configuration----------------------------------
+debug=2
+fork=yes
+log_stderror=no
+listen=127.0.0.1
+port=5060
+dns=no
+rev_dns=no
+
+#-----------------------Loading Modules-------------------------------------
+mpath="../../modules_k/"
+loadmodule "../../modules/db_mysql/db_mysql.so"
+loadmodule "usrloc/usrloc.so"
+loadmodule "registrar/registrar.so"
+loadmodule "sl/sl.so"
+loadmodule "../../modules/tm/tm.so"
+loadmodule "maxfwd/maxfwd.so"
+loadmodule "pv/pv.so"
+loadmodule "cfgutils.so"
+loadmodule "memcached.so"
+#for debugging purposes only
+loadmodule "mi_fifo/mi_fifo.so"
+loadmodule "xlog/xlog.so"
+
+
+#-----------------------Module parameters-------------------------------------
+modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+modparam("usrloc", "db_mode", 3)
+modparam("usrloc", "db_url", "mysql://openser:openserrw@localhost/openser")
+
+#-----------------------Routing configuration---------------------------------#
+route{
+ if (!mf_process_maxfwd_header("10")) {
+ sl_send_reply("483","Too Many Hops");
+ exit();
+ }
+
+ $mct(test) = "1";
+ $mct(test) = 5;
+ xlog("stored value is $mct(test)");
+# not work at the moment?
+# $mct(test) = null;
+# xlog("stored value is $mct(test)");
+
+ $mct(cnt) = 1;
+ $mcinc(cnt) = 1; # increment by 1
+ xlog("counter is now $mct(cnt)");
+ $mcdec(cnt) = 1; # decrement by 1
+ xlog("counter is now $mct(cnt)");
+
+ $mct(test) = 111;
+ xlog("stored value is $mct(test)");
+ $mctex(test) = 1;
+# also not work at the moment?
+# sleep("2");
+ xlog("stored value is now $mct(test)");
+
+ if (registered("location")) {
+ xlog("contact registered");
+ }
+
+ if(!lookup ("location")){
+ sl_send_reply("404", "Not Found");
+ }
+
+ if (!t_relay()) {
+ sl_reply_error();
+ }
+}
+
diff --git a/test/unit/45.sh b/test/unit/45.sh
new file mode 100755
index 0000000..7b28c64
--- /dev/null
+++ b/test/unit/45.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+# check memcached module with a basic usrloc scenario
+
+# Copyright (C) 2007 1&1 Internet AG
+#
+# This file is part of Kamailio, a free SIP server.
+#
+# Kamailio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version
+#
+# Kamailio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+source include/common
+source include/require
+source include/database
+
+if ! (check_sipp && check_kamailio && check_module "db_mysql" && check_mysql && check_module "memcached"); then
+ exit 0
+fi ;
+
+CFG=45.cfg
+SRV=5060
+UAS=5070
+UAC=5080
+
+
+# add an registrar entry to the db;
+$MYSQL "INSERT INTO location (username,contact,socket,user_agent,cseq,q) VALUES (\"foo\",\"sip:foo@localhost:$UAS\",\"udp:127.0.0.1:$UAS\",\"ser_test\",1,-1);"
+
+$BIN -w . -f $CFG &> /dev/null
+sipp -sn uas -bg -i localhost -m 10 -f 2 -p $UAS &> /dev/null
+sipp -sn uac -s foo 127.0.0.1:$SRV -i localhost -m 10 -f 2 -p $UAC &> /dev/null
+
+ret=$?
+
+# cleanup
+killall -9 sipp > /dev/null 2>&1
+$KILL > /dev/null 2>&1
+
+$MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"ser_test\"));"
+exit $ret;
Module: sip-router
Branch: master
Commit: f3528b2e48a8dca862f61ebef2dd2eb2bd843234
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f3528b2…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Oct 7 18:31:08 2009 +0200
memcached(sr): add support for setting of value expiration - $mctex(key)
- add support for setting of value expiration. As the memcache library
don't provide functions to later change the expire value of an existing
key we need to fetch the value and then store it again with the given
time. This should be changed with a different (improved) library
- refactor functions a bit, use a helper method instead of duplicating
the cache access functions
- update documentation
---
modules_k/memcached/README | 30 +++-
modules_k/memcached/doc/memcached_admin.xml | 19 +++
modules_k/memcached/mcd_var.c | 223 ++++++++++++++++-----------
modules_k/memcached/mcd_var.h | 13 ++
modules_k/memcached/memcached.c | 4 +-
5 files changed, 191 insertions(+), 98 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=f35…
sip-router.org home page looks a bit odd, because there is nothing
on top of the page. if no logo is available, heading text SIP Router
Project of something like that using a big font would be fine.
-- juha
Hi all,
i'm happy to announce a new developer for the kamailio and sip-router project:
Marius Zbihlei.
Marius is a experienced C/C++ developer in our offices in Bukarest (Romania).
He develops since a few years internal applications for the web hosting
plattform of 1&1. Since app. a half year he is part of the team that handles
the development and maintenance of our VoIP backend systems. Most of his work
so far was targeted to our internal repositories, but Marius also already
contributed a bunch of patches to the project. He'll support us with the
maintenance of the kamailio code we contributed to the project in the past,
and also work on new sip-router features in the future.
Best regards,
Henning
--
Henning Westerholt - Development Consumer Products / Consumer Core
1&1 Internet AG, Ernst-Frey-Str. 9, 76135 Karlsruhe, Germany
Daniel once taught me in a mailing list post how to use AVP arrays
syntactically - i.e. to iterate through them and to implicitly create
them - for which I am very grateful. For example:
$var(i) = 0;
while($var(i) < $dbr(ra=>rows)) {
$(avp(s:rows_of_things)[$var(i)]) = $dbr(ra=>[$var(i),0]);
}
But I don't see anywhere in the documentation - for the avpops module or
otherwise - where someone else can learn to use them. They are not
mentioned explicitly anywhere as having potentially nonscalar properties.
I think it is a good idea to fix that.
--
Alex Balashov - Principal
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671