Revision: 5925
http://openser.svn.sourceforge.net/openser/?rev=5925&view=rev
Author: miconda
Date: 2009-09-14 08:10:48 +0000 (Mon, 14 Sep 2009)
Log Message:
-----------
- fixed copy&paste table name error
Modified Paths:
--------------
branches/1.5/modules/imc/README
branches/1.5/modules/imc/doc/imc_admin.xml
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
has something changed, because i noticed that now with 1.5 and
trunk pua_publish mi command fails. according to debug, everything goes
fine until 200 ok is received by pua module that then calls
mi_publ_rpl_cback with NULL parameter:
Sep 11 15:16:18 localhost /usr/sbin/pres-serv[3963]: DBG:pua:publ_cback_func: completed with status 200 [contact:sip:jh@vm.test.fi]
Sep 11 15:16:18 localhost /usr/sbin/pres-serv[3963]: DBG:pua:publ_cback_func: update record
Sep 11 15:16:18 localhost /usr/sbin/pres-serv[3963]: DBG:pua:run_pua_callbacks: found callback
Sep 11 15:16:18 localhost /usr/sbin/pres-serv[3963]: ERROR:pua_mi:mi_publ_rpl_cback: NULL parameter
according to the source, the test giving the error message is this:
if(reply== NULL || hentity== NULL || hentity->cb_param== NULL)
{
LM_ERR("NULL parameter\n");
return -1;
}
how come that a good 200 ok response to publish calls mi callback with
null parameter(s)?
-- juha
Module: sip-router
Branch: master
Commit: d22073013189ded58fffe3aad4ef65b9085bc99a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d220730…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Fri Sep 11 12:54:19 2009 +0200
cfg framework: CFG_CB_ONLY_ONCE documented
CFG_CB_ONLY_ONCE has been documented
---
doc/cfg.txt | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/doc/cfg.txt b/doc/cfg.txt
index 9b306ea..e7be888 100644
--- a/doc/cfg.txt
+++ b/doc/cfg.txt
@@ -120,6 +120,17 @@ Each row consists of the following items:
- CFG_READONLY The variable is read-only, its value cannot
be changed.
+ - CFG_CB_ONLY_ONCE The per-child process callback is called only once
+ after the changes to the global config have been
+ committed. (The first child process that updates
+ its local config calls the callback, and no other child
+ process does so.)
+ The per-child process cb is intended to be used to
+ update the config variables that are stored outside
+ of the cfg framework. By default this callback is
+ called by all the child processes separately,
+ this can be changed with this flag.
+
- minimum value for integers (optional)
- maximum value for integers (optional)
- fixup function (optional) that is called when the variable is going to be
@@ -132,7 +143,8 @@ Each row consists of the following items:
typedef int (*cfg_on_change)(void *temp_handle, str *group_name, str *var_name, void **value);
- per-child process callback function (optional) that is called by each child
- process separately, after the new values have been committed, and the
+ process separately (unless the CFG_CB_ONLY_ONCE flag is set, see above)
+ after the new values have been committed, and the
child process is updating its local configuration. The old value will no
longer be used by the process. (Useful for fix-ups that cannot be done
in shm memory, for example regexp compilation.)
Module: sip-router
Branch: master
Commit: ceef844014b6e4d93e319a3ff8ecf70983bdc30f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ceef844…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Fri Sep 11 12:08:13 2009 +0200
cfg framework: CFG_CB_ONLY_ONCE flag
CFG_CB_ONLY_ONCE flag indicates that the per-child
process callback is called only once after the changes
to the global config have been committed.
(The first child process that updates its local
config calls the callback, and no other child
process does so.)
The per-child process cb is intended to be used to
update the config variables that are stored outside
of the cfg framework. By default this callback is called
by all the child processes separately, this can be change
with this flag.
---
cfg/cfg.h | 2 ++
cfg/cfg_ctx.c | 6 ++++--
cfg/cfg_struct.c | 22 ++++++++++++++++++++--
cfg/cfg_struct.h | 17 ++++++++++++++---
4 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/cfg/cfg.h b/cfg/cfg.h
index ca511a5..4a77233 100644
--- a/cfg/cfg.h
+++ b/cfg/cfg.h
@@ -55,6 +55,8 @@
#define CFG_ATOMIC (1U<<(2*CFG_INPUT_SHIFT))
/* variable is read-only */
#define CFG_READONLY (1U<<(2*CFG_INPUT_SHIFT+1))
+/* per-child process callback needs to be called only once */
+#define CFG_CB_ONLY_ONCE (1U<<(2*CFG_INPUT_SHIFT+2))
typedef int (*cfg_on_change)(void *, str *, str *, void **);
typedef void (*cfg_on_set_child)(str *, str *);
diff --git a/cfg/cfg_ctx.c b/cfg/cfg_ctx.c
index ef3661c..a504588 100644
--- a/cfg/cfg_ctx.c
+++ b/cfg/cfg_ctx.c
@@ -317,7 +317,8 @@ int cfg_set_now(cfg_ctx_t *ctx, str *group_name, str *var_name,
s2.s = var->def->name;
s2.len = var->name_len;
child_cb = cfg_child_cb_new(&s, &s2,
- var->def->on_set_child_cb);
+ var->def->on_set_child_cb,
+ var->def->type);
if (!child_cb) {
LOG(L_ERR, "ERROR: cfg_set_now(): not enough shm memory\n");
goto error0;
@@ -749,7 +750,8 @@ int cfg_commit(cfg_ctx_t *ctx)
s2.s = changed->var->def->name;
s2.len = changed->var->name_len;
child_cb = cfg_child_cb_new(&s, &s2,
- changed->var->def->on_set_child_cb);
+ changed->var->def->on_set_child_cb,
+ changed->var->def->type);
if (!child_cb) goto error0;
if (child_cb_last)
diff --git a/cfg/cfg_struct.c b/cfg/cfg_struct.c
index c90b12e..ad613ee 100644
--- a/cfg/cfg_struct.c
+++ b/cfg/cfg_struct.c
@@ -319,7 +319,7 @@ int sr_cfg_init(void)
This stucture will be the entry point for the child processes, and
will be freed later, when none of the processes refers to it */
*cfg_child_cb_first = *cfg_child_cb_last =
- cfg_child_cb_new(NULL, NULL, NULL);
+ cfg_child_cb_new(NULL, NULL, NULL, 0);
if (!*cfg_child_cb_first) goto error;
@@ -591,7 +591,9 @@ void cfg_install_global(cfg_block_t *block, char **replaced,
}
/* creates a structure for a per-child process callback */
-cfg_child_cb_t *cfg_child_cb_new(str *gname, str *name, cfg_on_set_child cb)
+cfg_child_cb_t *cfg_child_cb_new(str *gname, str *name,
+ cfg_on_set_child cb,
+ unsigned int type)
{
cfg_child_cb_t *cb_struct;
@@ -612,6 +614,22 @@ cfg_child_cb_t *cfg_child_cb_new(str *gname, str *name, cfg_on_set_child cb)
cb_struct->cb = cb;
atomic_set(&cb_struct->refcnt, 0);
+ if (type & CFG_CB_ONLY_ONCE) {
+ /* The callback needs to be executed only once.
+ * Set the cb_count value to 1, so the first child
+ * process that executes the callback will decrement
+ * it to 0, and no other children will execute the
+ * callback again.
+ */
+ atomic_set(&cb_struct->cb_count, 1);
+ } else {
+ /* Set the cb_count to a high value, i.e. max signed integer,
+ * so all the child processes will execute the callback,
+ * the counter will never reach 0.
+ */
+ atomic_set(&cb_struct->cb_count, (1U<<(sizeof(int)*8-1))-1);
+ }
+
return cb_struct;
}
diff --git a/cfg/cfg_struct.h b/cfg/cfg_struct.h
index f0c2253..e7ac4e3 100644
--- a/cfg/cfg_struct.h
+++ b/cfg/cfg_struct.h
@@ -98,6 +98,12 @@ typedef struct _cfg_block {
typedef struct _cfg_child_cb {
atomic_t refcnt; /* number of child processes
referring to the element */
+ atomic_t cb_count; /* This counter is used to track
+ * how many times the callback needs
+ * to be executed.
+ * >0 the cb needs to be executed
+ * <=0 the cb no longer needs to be executed
+ */
str gname, name; /* name of the variable that has changed */
cfg_on_set_child cb; /* callback function that has to be called */
@@ -247,8 +253,11 @@ static inline void cfg_update_local(void)
CFG_UNLOCK();
}
}
- /* execute the callback */
- cfg_child_cb->cb(&cfg_child_cb->gname, &cfg_child_cb->name);
+ if (atomic_add(&cfg_child_cb->cb_count, -1) >= 0) /* the new value is returned
+ by atomic_add() */
+ /* execute the callback */
+ cfg_child_cb->cb(&cfg_child_cb->gname, &cfg_child_cb->name);
+ /* else the callback no longer needs to be executed */
}
}
@@ -296,7 +305,9 @@ void cfg_install_global(cfg_block_t *block, char **replaced,
cfg_child_cb_t *cb_first, cfg_child_cb_t *cb_last);
/* creates a structure for a per-child process callback */
-cfg_child_cb_t *cfg_child_cb_new(str *gname, str *name, cfg_on_set_child cb);
+cfg_child_cb_t *cfg_child_cb_new(str *gname, str *name,
+ cfg_on_set_child cb,
+ unsigned int type);
/* free the memory allocated for a child cb list */
void cfg_child_cb_free(cfg_child_cb_t *child_cb_first);
Hi all,
i just commited several parts related to number portability functionality to
the sr repository. This can be used as a source for routing informations
related to the ownership of the number.
This functionality consists of several parts.
1. pdb server
This server loads serialized routing data from the disk and stores it in
memory. It then listens on an UDP Port for requests containing a number and
returns ID of the carrier which owns the number. This server uses the same
datastructure as the carrierroute module and provides a really good
performance. According our experience it usually consumes only a few percent
CPU, even you use only one server for your complete callrouting cluster.
2. pdb connector module
This module connects the sip-router server to the pdb server. It supports
load-balancing and aggressive timeouts. Normally it not need more than a few
ms to query the remote server and return the reply to the configuration
script.
3. pdb tool (data compiler)
This tool provides the functionality to compile the carrier and number
informations into the binary data format the pdb server expect. It supports
optimizing the generated trie structure, so that for example the complete
number to carrier mapping for germany (app. 150 million numbers) don't need
more than a few hundred megabytes. You can also combine not interesting
carriers in order to save even more space and get better performance.
You find the module in the modules/pdb directory, the server and tool is in
utils/pdbt. This directory also contains documentation (README for module,
utils/pdbt/docs/* for data format and network protocol).
We decided to develop a custom solution as none of the alternatives that were
evaluated (like enum over DNS, databases e.g. berkeley DB, some commercial
products) provides the wanted performance, failure tolerance and storage
efficieny. This module has been in production use since some time, so if you
find some bugs they are most probably introduced from me because of the sr
adaption. The original implementation was done from Hardy Kahl.
Best regards,
Henning Westerholt
--
Henning Westerholt - Development Consumer Products / Consumer Core
1&1 Internet AG, Ernst-Frey-Str. 9, 76135 Karlsruhe, Germany
Module: sip-router
Branch: master
Commit: 170ad2a01ec5047a05222dab115955e2544e5845
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=170ad2a…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Sep 10 19:32:41 2009 +0200
pdbt: add one helper script, protocol and input data documentation
---
utils/pdbt/docs/data_format.txt | 29 +++++++++++++++++++++
utils/pdbt/docs/network_protocol.txt | 16 ++++++++++++
utils/pdbt/scripts/get_carrier_names_germany.sh | 31 +++++++++++++++++++++++
3 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/utils/pdbt/docs/data_format.txt b/utils/pdbt/docs/data_format.txt
new file mode 100644
index 0000000..e84be56
--- /dev/null
+++ b/utils/pdbt/docs/data_format.txt
@@ -0,0 +1,29 @@
+* File format off the number portability data *
+
+The number portability data consists only from the number or number block in
+the internation format followed by an semi-colon and the carrier identity.
+Each entry must be in a separate line.
+
+Format [0-9]{n,m}; [0-9][0-9][0-9]
+
+For example:
+
+495041748;012
+493687413;009
+
+The meaning of this entry is that the first number or block 495041748 belongs
+to the carrier 12, the second to the carrier 9.
+
+
+* File format of the carrier name file *
+
+Each carrier id and name must be in a separate line.
+
+Format: D[0-9][0-9][0-9] <name>
+
+For example:
+
+D001 Deutsche Telekom AG, Bonn
+D012 BT Germany GmbH & Co. OHG
+
+This means that the 495041748 block belongs to British Telecom Germany.
diff --git a/utils/pdbt/docs/network_protocol.txt b/utils/pdbt/docs/network_protocol.txt
new file mode 100644
index 0000000..2daff3b
--- /dev/null
+++ b/utils/pdbt/docs/network_protocol.txt
@@ -0,0 +1,16 @@
+* Network protocol of pdb server and sip-router module *
+
+The pdb server daemon listen only for UDP messages. The requests contains in
+the UDP payload the number starting with a internation prefix, e.g. '49' for
+germany. It must contain only numbers like this: '49721913742734'.
+
+The answer packet contains then the number string from the respective request,
+null-terminated and followed from two bytes which represents the result. This
+two bytes are interpreted as 16 bit signed integer value, the UDP payload is
+in network byte order (most significant byte first).
+
+Possible values for the search request:
+ * 0: the number could not be found
+ * 1-999 the number was found and the result represents its carrier ID
+ * 1000: the number could be found, but its owned from a carriers which is
+ not interesting for us and belongs to the "other carrier" group
diff --git a/utils/pdbt/scripts/get_carrier_names_germany.sh b/utils/pdbt/scripts/get_carrier_names_germany.sh
new file mode 100755
index 0000000..64bf83a
--- /dev/null
+++ b/utils/pdbt/scripts/get_carrier_names_germany.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Copyright (C) 2009 1&1 Internet AG
+#
+# This file is part of sip-router, a free SIP server.
+#
+# sip-router 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
+#
+# sip-router 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Small helper script for germany:
+# Download the directory of german carrier names and the respective IDs from
+# the 'Bundesnetzagentur' and convert this into the format which the pdbt tool
+# understands.
+
+url="http://www.bundesnetzagentur.de/enid/Portierungskennung/Verzeichnis_1ct.html"
+
+# fix LOCALE problem during filtering
+export LANG="C"
+
+wget -O - "$url" | recode latin1..utf8 | tr -d '\r' | tr '\n' '@' | sed 's/^.*Firma//' | sed 's/<\/table>.*$//' | tr '@' '\n' | sed 's/<\/p>/@/' | sed 's/<\/td>/@/' | egrep -v "^ *<" | tr -d '\n' | sed 's/@ *@/@/g' | tr '@' '\n' | sed 's/ */ /g' | sed 's/^ *//' | tr '\n' '@' | sed 's/\([^@]*\)@\(D[0-9][0-9][0-9]\)[^@]*@/\2 \1@/g' | tr '@' '\n' | sed 's/\ \;/ /g' | sed 's/\&\;/\&/g' | sed 's/ */ /g' | egrep -v '^$'
Module: sip-router
Branch: master
Commit: 008e40a3c1e948f2af213489a9eefd95ea3f51eb
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=008e40a…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Sep 10 18:22:07 2009 +0200
add pdb module to the 'stable, but for special use' group in Makefile
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 7a478c7..b7d2bbe 100644
--- a/Makefile
+++ b/Makefile
@@ -180,7 +180,7 @@ module_group_presence=dialog pa presence_b2b rls xcap
# jabber => expat (library)
# osp => OSP Toolkit (sipfoundry)
# sms => none (external modem)
-module_group_stable=cpl-c dbtext jabber osp sms
+module_group_stable=cpl-c dbtext jabber osp sms pdb
# Modules in this group are either not complete, untested, or without enough
# reports of usage to allow the module into the stable group. They may or may