Note
It seems that Asterisk 1.2.0 comes with a new powerful ENUMLOOKUP. So there is probably no need to use this script anymore.Indeed. You can use RFC Compliant ENUM Macro instead.
Synopsis
Enumlookup.agi is intended as a replacement for Asterisk's EnumLookup whosedevelopment probably was stopped.
Description
Lookup number in ENUM and return all entries of service type SIP, IAX, IAX2, H.323, TEL and MAILTOin consideration of given order and preference.
Looks up an extension given in ${ENUMEXTEN} via ENUM and returns a couple of variables which can be used in
dialplan extensions.conf.
The extension needs to include a full international telephone number, including the country code but with no zeros
or other characters before the country code, like 49XXXXXXXX for a German phone number (see examples below).
Download
Current version can be found here:Also see requirements below!
Parameters
There are some parameters, which may be used to control behavior of enumlookup.agi and its results:- ENUMEXTEN (phone number)
- ENUMSEPARATETEL (yes|no)
separate variables.
- ENUMIAXPREFIX (by default IAX/)
- ENUMIAX2PREFIX (by default IAX2/)
- ENUMSIPPREFIX (by default SIP/)
- ENUMTELPREFIX (by default empty)
- ENUMH323PREFIX (by default H323/)
- ENUMMAILTOPREFIX (by default mailto:)
These parameters may be defined in "globals" section of extensions.conf.
NOTE: The SETVAR command has been replaced. Use SET instead.
[globals] ENUMSEPARATETEL => no ENUMIAXPREFIX => IAX2/
or may be given to enumlookup.agi directly at startup of AGI-script
[enum]
exten => s,1,SetVar(ENUMSEPARATETEL=no)
exten => s,n,SetVar(ENUMIAXPREFIX=IAX2/)
exten => s,n,SetVar(ENUMEXTEN=49${EXTEN:1}) ; when called with "usual" German number, e.g. 034160019876
exten => s,n,agi,enumlookup.agi
Return codes
Currently, the enumservices SIP, IAX, IAX2, H.323, TEL and MAILTO are recognized.We have to look at two possibilities:
1.) AGI script called with ENUMSEPARATETEL = no
returned variables:
- ${ENUMENTRIES} total number of ENUM entries
- ${ENUMENTRY1},${ENUMENTRY2} ... ${ENUMENTRY${ENUMENTRIES}} ENUM entries
Found entries are sorted by user given order/preference scheme at ENUM registrar.
Entries with same order/preference are concatenated with "&".
Mailto entries are treated as if they had lower preference. They are concatenated with ",".
2.) AGI script called with ENUMSEPARATETEL = yes
returned variables:
- ${ENUMENTRIES} total number of ENUM entries
- ${ENUMENTRY1},${ENUMENTRY2} ... ${ENUMENTRY${ENUMENTRIES}} ENUM entries
Found entries are sorted by user given order/preference scheme at ENUM-registrar.
Entries with same order/preference are concatenated with "&".
Mailto entries are treated as if they had lower preference. They are concatenated with ",".
- ${ENUMTELENTRIES} total number of ENUM entries
- ${ENUMTELENTRY1},${ENUMTELENTRY2} ... ${ENUMTELENTRY${ENUMTELENTRIES}} ENUM entries
Found entries are sorted by user given order/preference scheme at ENUM registrar.
Configuration file enumagi.conf
Starting with version 0.13 of enumlookup.agi, configuration data can be storedin new conf file enumagi.conf.
Example Dialplan #1 - With Voicemail
[globals]
ENUMIAXPREFIX => IAX2/ ; I don't have support for IAX protocol
ENUMSEPARATETEL => YES ; tel entries should use separate variables
[dial-out-with-enum]
exten => _50.,1,SetVar(ENUMEXTEN=49${EXTEN:2}) ; I only use german numbers
exten => _50.,2,SetVar(ENUMTELPREFIX=SIP/my-sip-peer/) ; I want to use
; my SIP-Provider for dialing tel entries
exten => _50.,3,agi,enumlookup.agi
exten => _50.,4,SetVar(EINTRAG=0)
exten => _50.,5,GotoIf($[${ENUMENTRIES}]?10:31) ; Look if there are entries
exten => _50.,10,SetVar(EINTRAG=$[${EINTRAG} + 1])
exten => _50.,11,GotoIf($[$[${ENUMENTRY${EINTRAG}:0:3} = IAX] | $[${ENUMENTRY${EINTRAG}:0:3} = SIP]]?12:21)
; What to do with IAX(2) and SIP entries:
exten => _50.,12,Dial(${ENUMENTRY${EINTRAG}},10,T)
exten => _50.,13,GotoIf($[${EINTRAG} < ${ENUMENTRIES}]?10:31) ; Repeat if there
; are more entries else look for tel entries
; What to do with mailto entries:
exten => _50.,21,GotoIf($[${ENUMENTRY${EINTRAG}:0:6} = mailto]?22:30)
exten => _50.,22,Playback(vm-nobodyavail)
exten => _50.,23,Playback(vm-intro)
exten => _50.,24,Playback(beep)
exten => _50.,25,Monitor(wav,/tmp/nachricht)
exten => _50.,26,MeetMe(20,pqs) ; You have to configure MeetMe
exten => _50.,27,System(nail -a /tmp/nachricht-in.wav -s Voicemail ${ENUMENTRY${EINTRAG}:7} < /dev/null)
exten => _50.,28,Hangup
exten => _50.,30,GotoIf($[${EINTRAG} < ${ENUMENTRIES}]?10:31) ; Repeat if there
; are more entries else look for tel entries
exten => _50.,31,GotoIf($[${ENUMTELENTRIES}]?32:51)
; What to do with tel entries (is only used if all the other entries fail):
exten => _50.,32,SetVar(EINTRAG=0)
exten => _50.,33,SetVar((EINTRAG=$[${EINTRAG} + 1])
exten => _50.,34,Playback(beep) ; Playing beep means that this call isn't for
; free
exten => _50.,35,Dial(${ENUMTELENTRY${EINTRAG}},10,T)
exten => _50.,36,GotoIf($[${EINTRAG} < ${ENUMTELENTRIES}]?33:51)
; If there are no enum entries or if all of them fail:
exten => _50.,51,Playback(beep)
exten => _50.,52,Dial(SIP/my-sip-peer/${EXTEN:1})
exten => _50.,53,Hangup
Requirements
Fortunately the following software is installed by default on almost every LINUX system.You need:
- dig in your $PATH: dig is part of bind. (see here for installation instructions)
- a bash compatible shell: Type /bin/sh --version to see if it is installed. (see here for installation instructions) Perhaps you have to change /bin/sh to /bin/bash or similar in enumlookup.agi depending on location where your bash is installed.
- sed: (see here for installation instructions)
- awk: (see here for installation instructions)
- grep: (see here for installation instructions)
Register Domain
At present the e164.arpa structure isn't widespread worldwide. But you can use e164.org instead. The registration is fairly straight forward. Read the documentation at e164.org!See also
- Asterisk config enumagi.conf
- Asterisk cmd MeetMe
- Installation of mail client nail
- ENUM: The ENUM standard
- Asterisk cmd EnumLookup
- Asterisk variables
- NIC.AT presentation on Asterisk and ENUM
- VPF ENUM Registry
- IPPF - German IP-Phone-Forum
- cnum.info - provides ENUM services which add Call-by-Call rates for LCR within Germany
Back to Asterisk - documentation of application commands
Page Changes