Asterisk cmd EnumLookup


Lookup number in ENUM

This command is deprecated in Asterisk 1.4 See Asterisk func ENUMLOOKUP for the replacement.



Looks up an extension via ENUM and sets the variable Asterisk variable ENUM. 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 46XXXXXXXX_ for a Swedish phone number.

Update Oct. 2005: It appears that Enum now requires a + character at the beginning of the exetension, e.g.: EnumLookup(+${EXTEN})

Return codes

Currently, the enumservices SIP, IAX and TEL are recognized. A good SIP entry will result in normal priority handling, whereas a good TEL entry will increase the priority by 51 (if existing)
If the lookup was not successful and there ex ists a priority n + 101, then that priority will be taken next.


exten=> _0[1-9]XXX.,1,BackGround(
exten=> _0[1-9]XXX.,2,EnumLookup(+431${EXTEN:1})
1} is the number dialedby user with the leading 0 stripped.
Thus "431${EXTEN
1}" is the E.164 number.
;EnumLookupsets ${ENUM} on success. On failure jumps to priority+101.
exten=> _0[1-9]XXX.,3,BackGround(

exten=> _0[1-9]XXX.,4,Dial(${ENUM},30)
exten=> _0[1-9]XXX.,5,Goto(104); No answer on SIP, fallback to PSTN
exten=> _0[1-9]XXX.,103,BackGround(
exten=> _0[1-9]XXX.,104,Dial,${TRUNK}/${EXTEN:1}

For other examples, see Asterisk E164 Call Routing or RFC Compliant ENUM Macro

Please note

  • By implementing your local ENUM-alike DNS system to support E.164 reverse phone number lookups in DNS, you disable the possibility to lookup in the global ENUM-tree that is implemented in some countries around the world. To configure ENUM lookup in multiple domains, add your Enum-alike DNS root domain before the Enum designated domain, in Asterisk config enum.conf.
  • To get wildcard constructs with regular expression matching working, you need to make sure that you have a recent version of DNS servers, for BIND at least version 9. Otherwise, the slave servers might get a faulty zone, with the "\\" constructs being replaced by a single backslah.
  • When returning a TEL uri, EnumLookup only returns the number part of the URI, not the "tel:" prefix. For other URL:s, the prefix is SIP/ etc to make it easier to use the dial application in your dial plan.
  • Asterisk only reads the first offered NAPTR pointer, it doesn't read all of them or use the priority scheme.

If you want to read ALL ENUM-entries and work with the user-defined priorities in the ENUM-registry look here: Asterisk and multiple ENUM entries

See also

Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: oej, Last modification: Sun 25 of Nov, 2007 (11:22) by JustRumours
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+