Search Computer Help Please

Monday, November 30, 2009

ENUM FreePBX - Setup Enumlookup with Asterisk FreePBX

This walk through goes through the steps to setup enumlookup on the latest version of Asterisk with FREEPBX

The First Step is to Create the ENUM TRUNK



Then ADD an ENUM TRUNK



Click Submit Changes, and Apply Configuration Changes, make sure to save and apply changes whenever you add a trunk or change settings



Note: No changes need to be made on this page unless you want to customize it especially.
The next step is to setup your outbound routes in FreePBX

ENUM Outbound Routes in FreePBX

Open up the outbound route 0 9_outisde, here we will specify how outgoing calls will be routed.




Check the Trunk Sequence


Here I have the trunk sequence set as ENUM first and if an enumlookup fails it will fall back to SIP Trunk which will send calls to the PSTN. Apply changes once you have changed your trunk sequence.

Setting up Dial Patterns for ENUM - Here we setup what numbers will be sent to the enum function for example , you may want to setup your FreePBX to only send numbers dialed starting with 9 to enum and all other to the PSTN.

The picture below shows the Dial Patterns for enumlookup

X = any number from 0 - 9
.X_ = match any number , any digit any length (easy option)




ENUMLOOKUP - FREEPBX changing ENUM registry's to lookup default (e164.org)

FreePBX by default looks up e164.org for enum records, you can change which domains to lookup on by accessing the file /var/lib/asterisk/agi-bin/enumlookup.agi

Open up SSH client, e.g Putty and login to the server



Open up the enumlookup.agi script and add the enum domains you wish to lookup.

And that's pretty much it for the walkthrough if you have problems usually its due to incorrect settings with your extensions or the reciever of the call not accepting incoming calls.

To allow others to call you VIA ENUM - Allow Anonymous SIP CALLS or route based on DID number e.g


This setting is found under General Settings.



Tuesday, November 24, 2009

Setting up enumlookup Asterisk 1.4

The enumlookup function can be setup in Asterisk 1.4 simply by editing the extensions.conf file , the enum.conf file does not need to be used and I think its pretty much obsolete now.

First thing you want to do if identify which phones or services will be allowed to perform an enumlookup. e.g include localphones , your local extensions will be able to perform enumlookup's. lot of people forget to include the phone or service for example to add localphones and internal

[enumlookup]
include=> localphones
include=> enumlookup
include=> internal

ensure you include everyone with permission to use this function

The basic enumlookup script for Asterisk 1.4 looks like this

[enumlookup]

include => common

include => internal

include => enumlookup

; This example expects an ${EXTEN} that is an e.164 number (like

; 14102241145 or 437203001721)

; Search through e164.arpa and then also search through e164.org, you can change the e164.org to your own ;enum server or different enum registry

; to see if there are any valid SIP or IAX termination capabilities.

; If none, send call out via Zap channel 1, you could redirect it to a SIP trunk if it fails if you prefer

;

; Start first with e164.arpa zone...

;

exten => _X.,1,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c)}|counter=0)

exten => _X.,2,GotoIf($["${counter}"<"${sipcount}"]?3:6)

exten => _X.,3,Set(counter=$[${counter}+1])

exten => _X.,4,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,,${counter})})

exten => _X.,5,GotoIf($["${counter}"<"${sipcount}"]?3:6)

;

exten => _X.,6,Set(iaxcount=${ENUMLOOKUP(+${EXTEN},iax2,c)}|counter=0)

exten => _X.,7,GotoIf($["${counter}"<"${iaxcount}"]?8:11)

exten => _X.,8,Set(counter=$[${counter}+1])

exten => _X.,9,Dial(IAX2/${ENUMLOOKUP(+${EXTEN},iax2,,${counter})})

exten => _X.,10,GotoIf($["${counter}"<"${iaxcount}"]?8:11)

;

exten => _X.,11,NoOp("No valid entries in e164.arpa for ${EXTEN} - checking in e164.org")

;

; ...then also try e164.org, and look for SIP and IAX NAPTRs...

;

exten => _X.,12,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c,,e164.org)}|counter=0)

exten => _X.,13,GotoIf($["${counter}"<"${sipcount}"]?14:17)

exten => _X.,14,Set(counter=$[${counter}+1])

exten => _X.,15,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,,${counter},e164.org)})

exten => _X.,16,GotoIf($["${counter}"<"${sipcount}"]?14:17)

;

exten => _X.,17,Set(iaxcount=${ENUMLOOKUP(+${EXTEN},iax2,c,,e164.org)}|counter=0)

exten => _X.,18,GotoIf($["${counter}"<"${iaxcount}"]?19:22)

exten => _X.,19,Set(counter=$[${counter}+1])

exten => _X.,20,Dial(IAX2/${ENUMLOOKUP(+${EXTEN},iax2,,${counter},e164.org)})

exten => _X.,21,GotoIf($["${counter}"<"${iaxcount}"]?19:22)

;

; ...then send out PRI.

;

exten => _X.,22,NoOp("No valid entries in e164.org for ${EXTEN} - sending out via Zap")

exten => _X.,23,Dial(Zap/g1/${EXTEN})

;

; end example 3

Simply pasting this into your extensions.conf will work as long as you have specified who to include at the very beginning.

for the dialing pattern, here we use .X_ which specifies anything starting with the digit 0-9 and anything after that will be matched. So anything really.

that's about it , goodluck

How to Install Free Registry of Enum and Domains on Ubuntu Debian Linux (FRED.NIC.CZ)

For anyone that is interested in enum technology and setting up a professional enum registry service for there customers may have stumbled across FRED the free registry of enum and domains. Its basically an open source project that comes with all the packages and software needed to create a central enum registry. (fred.nic.cz)

- allows registrars to join
- input domain names
- service invoices and much more

Installing the FRED system can be painful using the manuals but there is a FRED script that will install and let you run all the components very easily the only trouble being installing all the correct packages for it to execute trouble free. I had FRED working and I will go through the basic steps

Download the Appropriate Packages (sudo su) must be in root mode

apt-get -y install

apt-get install apache2 postgresql gcc autoconf make bison
build-essential libpq-dev omniidl4 omniidl4-python libomniorb4-dev
libomnithread3-dev libdaemon-dev libboost-dev libboost-date-time-dev
libboost-program-options-dev libboost-regex-dev python-imaging
python-reportlab tinyerp-server xsltproc apache2-threaded-dev
liborbit2-dev libxml2-dev python-cherrypy3 python-simpletal
python-omniorb2 omniidl4-python libapache2-mod-python
omniorb4-nameserver omniorb4 python-clearsilver python-dnspython
python-pygresql fpdns whois openssl libidn11 libidn11-dev
python-trml2pdf ttf-freefont python-simplejson php5

apt-get -y install
python-pygresql omniidl4-python postgresql-plperl-8.3
build-essential postfix libpq-dev
omniidl4 omniidl4-python libomniorb4-dev libomnithread3-dev
libdaemon-dev libboost-dev libboost-date-time-dev
libboost-program-options-dev libboost-regex-dev
libboost-graph1.34.1 libboost-iostreams1.34.1 libboost-program-options1.34.1
libboost-regex1.34.1 libboost-serialization1.34.1
libboost-signals1.34.1 libboost-thread1.34.1
libboost-graph1.34.1 libboost-signals-dev libboost-thread-dev libboost-serialization-dev
libidn11-dev python-imaging python-reportlab tinyerp-server
xsltproc python-clearsilver orbit2 orbit2-nameserver liborbi t2-dev
python-simplejson libomniorb4-dev python-omniorb python-dnspython
python-cherrypy3 python-simpletal unzip zip libapache2-mod-python
apache2-prefork-dev omniorb4-nameserver libxml2-dev ttf-freefont

note: there may be some duplicates in there but I haven't removed them, just ensure that you have all the above packages. Tested on ubuntu 8.04, 8.10. Note ubuntu 9.04 has some IPV6 Omniorb-nameserver clashes which may be a pain to get around (reloading the kernel or disabling ipv6)

Now follow the steps

wget http://fred.nic.cz/sources/fred-manager
chmod 755 fred-manager
./fred-manager download
./fred-manager install
./fred-manager start

Here we download the fred-manager script to any directory , ppl recommend /usr/src , or /usr/yourusername

we modify the priveldges for the fred-manager script
download the neccessary files for FRED, install and then start

and there you have it , FRED , Free registry of enum and domains should be up and running you can reach it using fred client located at

./root/bing/fred-client

or reach the http gui at http://serverip:/22344 , 23445

hope this helps someone who see's this ,gooodluck


Monday, November 23, 2009

Setup ENUM Server with Linux and Bind9

This post will go through the steps for setting up a simple ENUM (Electronic Number Mapping) server on ubuntu linux operating system.

The basic idea behind ENUM is to map your regular E.164 telephone numbers to domain zone files for example your number 98997867 may become 7.6.8.7.9.9.8.9.e164.arpa. Each enum number is given its own zone file which contains a variety of contact methods available for that number. These records are referred to as NAPTR records.

Financial Savings of ENUM

The main reason ENUM exists is to try and connect the IP networks with the telephone networks, with the main objective of avoiding the PSTN (public switch telephone network) and the high costs associated with using these services and termination fee's.

Bind9 DNS Records in Ubuntu

This quick tutorial will go through setting up a simple bind9 enum server capable of hosting an number of records for enum numbers. If your planning on setting up a proper enum server I will cover this topic later on, and how you can hook it up to your Asterisk PBX.

Install Bind9

First ensure you are in root mode using "sudo su"
apt-get -y install bind9

Once bind9 is installed all files and information for bind9 will be found in the directory /etc/bind

once you are in the directory "cd /etc/bind"

you are ready to modify and create the zone files for your enum domain in this example the domain being e164.org

named.conf
named.conf.options
named.conf.enum
db.e164.org

1.) modify named.conf

Modify the file named.conf , using your preferred editor (e.g nano named.conf, or vim named.conf)

Add the following line to the file

include "/etc/bind/named.conf.enum";

This just specifies that the file named.conf.enum will be used to store DNS information used by bind9

2.) Create named.conf.enum (simply edit the file and a new file will be created)

Add the following line to the file, ensuring that the format stays intact

add following line

zone "e164.org" {
type master;
file "/etc/bind/db.e164.org";

};

Here we specify the name of the zone , the type of server (e.g master, slave) and the file that contains the information for the zone.

3.) Create file db.e164.org

add the following to db.e164.org

TTL 86400
e164.org. IN SOA ns.e164.org. root.e164.org. (
2004011522 ; Serial no., based on date
21600 ; Refresh after 6 hours
3600 ; Retry after 1 hour
604800 ; Expire after 7 days
3600 ; Minimum TTL of 1 hour
)
e164.org. 43200 IN NS ns.e164.org.
;
ns.e164.org. 43200 IN A 192.168.1.2

0.9.8.7.6.5.4.3.2.1.e164.org. NAPTR 10 100 "u" "E2U+sip" "!^.*$!sip:info@example.com!".
0.9.8.7.6.5.4.3.2.1.e164.org. NAPTR 10 101 "u" "E2U+h323" "!^.*$!h323:info@example.com!".
0.9.8.7.6.5.4.3.2.1.e164.org. NAPTR 10 102 "u" "E2U+msg" "!^.*$!mailto:info@example.com!".
8.1.2.7.5.9.3.3.1.6.1.e164.org. NAPTR 100 10 "U" "SIP+E2U" "!^.*$!sip:16133957218@example.com!".

The file contains information for the zone e164.org on the private enum server.

at the very bottom of the zone file contains the enum zone files and naptr contact methods associated with the zones.

The first one is E2U or e164 to URI type of NAPTR record which returns a sip uri of info@example.com, this is the URI that will later be used by your Asterisk PBX.


TESTING AND TROUBLESHOOTING

Remember whenever changes are made to zone files the naming service needs to restarted to apply the changes using

/etc/init.d/bind9 restart

To test an ENUM record use the DIG tool

dig @ 8.1.2.7.5.9.3.3.1.6.1.e164.org -t NAPTR

this will return an answer section containing the sip URI
16133957218@example.com


Note: Any problems you may have such as bind9 not restarting correctly or returning a fail are usually due to incorrect format being used or missing zone files.

always check your /var/log/syslog for errors when troubleshooting


Hope people find this useful, in my next posts I will talk about hosting a private domain name to serve enum records within a private network (I-ENUM private) , as well as testing enumlookup using Asterisk 1.4, 1.6.

I may also cover how to setup a more efficient DNS server using powerdns or similar tools which use databases instead of individual files to store zone records.