SER module enum

Enum module implements enum_query function that makes an enum query based on the user part of the current request URI. The function assumes that the user part consists of an international phone number of the form +decimal-digits, where the number of digits is at least 2 and at most 15. Out of this number enum_query forms a domain name, where the digits are in reverse order and separated by dots followed by domain suffix that by default is "".

For example, if the user part is +35831234567, the domain name will be "".

After forming the name, enum_queryenum_query queries from DNS its NAPTR records. From the possible response the current version of enum_query chooses the FIRST record, whose flags field has string value "u" and whose services field has string value "e2u+[service:]sip" (case is ignored in both cases).

"service" is given to enum_query as a parameter. If its value is "", then "e2u+sip" is looked for. If no such record is found, enum_query returns -1.

If such a record is found, enum_query checks if its regexp field is of the form !pattern!replacement!. If yes, enum_query replaces the current Request-URI with replacement, which it assumes to contain a SIP or SIPS type URI, and returns value 1.

If the regexp field is not of the form !pattern!replacement!, enum_query returns -1.

In addition to enum_query, enum module implements is_from_user_e164 function that checks if the user part of from URI is an E164 number.


  1. is this an ENUM destination (leading +?)
if (method=="INVITE" && uri=~"sip:\+[0-9]+ at iptel\.org") {
if (!enum_query("voice")) # if parameter empty, it defaults to "e2u+sip"
enum_query(""); # E2U+sip

See also

Please note

Stock SER module enum only handles one Enum DNS tree. If you implement your own ENUM-like DNS tree, the SER Module will not be able to handle the ENUM tree in parallell. There are patches that were incorporated into the unstable version of the CVS for SER to support alternate suffixes:

From: Juha Heinanen <>
Subject: [Serusers] added domain_suffix parameter to enum_query

some folks have asked domain_suffix as a parameter to enum_query. i
just committed some changes for that purpose.

the syntax now is (from README):

1.4.1. enum_query(), enum_query("suffix"), enum_query("suffix", "service")

Replaces the current Request-URI with the result of a successful enum
query on the user part of the current Request-URI, which is assumed
to be of the form +up-to-15-decimal-digits. An NAPTR record whose
flags field has string value "u" and whose services field has string
value "e2u+service:sip" or "e2u+sip" (if "service" parameter is not
given) is looked for. Returns -1 if enum_query fails and 1 otherwise.

If "suffix" parameter is not given, value of domain_suffix module
paremeter is used.

Example 1-2. enum_query usage

Back to SIP Express Router
Created by: oej, Last modification: Sun 17 of Jun, 2012 (06:06 UTC) by admin
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+