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 '^$'