When Sweden implemented number portability for mobiles (MNP – Mobile Number Portability) and fixed lines there where some people who stated that this information should be published in DNS or a DNS like system so it would be cheap and available for everyone to use. Naturally the telcos wanted to do it the way they always did things. With a centralized fat solution.
So Sweden ended up with a Oracle based central database (CRDB) solution system implemented by Cap Gemini and Oracle. This system is now run by SNPAC AB (Owned by Swedens large telcos) who charges approx. 19200 Euros to connect and 14400 Euros per year. Which really is out of the reach for small scale actors on the market or hobbyists running an Asterisk pbx that would like to do choose the cheapest route to place a call.
The other day the Swedish PTS (The Swedish Post and Telecom Agency) launched a web page where you could check which operator was terminating which number. So i decided to go ahead and implement a DNS based look up method.
First a little rant about their service. Well it is nice that they offer different interfaces, today they support SOAP 1.1, SOAP 1.2, HTTP GET and HTTP POST. But why should the end user have to care about dividing the into NDC and SN? (NDC – National Destination Code and SN – Subscriber Number) after all the PTS is authorative of the NDC’s so why couldn’t they split the number for us? And why not a whole MSISDN (Mobile Subscriber Integrated Services Digital Network Number) or why not a whole E.164 number? Or what about actually implementing a ENUM (E.164 NUmber Mapping) look up?
Ok enough rant. I had a couple of hours over so i sat down with a FreeBSD box and pwerdns and started to code. So now i (and the rest of the world) can do the following lookups with their favorite DNS tool:
% dig 733441006.tel.arnold.se TXT
% dig 220.127.116.11.18.104.22.168.22.214.171.124.tel.arnold.se TXT
The result is a string containing the name of the operator handling the number. (I have included a full output below) Not the best reply to do automatic call routing but good enough as a proof of concept implementation of bridging DNS and MNP database. Right now i’m implementing a ENUM type so you could automatically integrate this into your Asterisk PBX and choose the best outgoing line for your calls. Since operators often have “Call free within our network” deals this would be a great tool for low cost routing of your phone calls.
But before starting to implementing stuff using this a couple of notes:
- This is an experiment.
- I have not fully tuned caching and performance yet.
- I currently only support the follwing NDC’s: 8, 31, 40, 70, 72, 73, 76 (Swedens 3 biggest cities and the GSM and 3G networks) More NDC’s will follow when i have found a machine readable list so i don’t have to type them all in…
So a couple questions to you reading this:
- Would you like this as a permanent service?
- Any other useful stuff you want to look up over DNS?
- Which information would you like returned in the ENUM? (I’m especially interested in the needs of non Asterisk users.)
Please give me some feedback below and i will try to take your ideas into consideration.
A full example of a search using dig:
% dig 733441006.tel.arnold.se. txt
; <<>> DiG 9.6.1-P2 <<>> 733441006.tel.arnold.se. txt
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57824
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;733441006.tel.arnold.se. IN TXT
;; ANSWER SECTION:
733441006.tel.arnold.se. 3600 IN TXT “Telenor Sverige AB”
;; Query time: 39 msec
;; SERVER: 126.96.36.199#53(188.8.131.52)
;; WHEN: Sat Aug 20 13:44:06 2011
;; MSG SIZE rcvd: 72