ENUM

|

View as Markdown

ENUM (E.164 Number Mapping) is a protocol that maps E.164 telephone numbers to network services using DNS. Infobip exposes an ENUM interface for HLR (Home Location Register) lookups, allowing you to query mobile number routing information using standard DNS query packets.

An HLR lookup queries the mobile network subscriber database to determine the state of a number. Use it to check whether a number is valid and active, and which operator serves it, including after number portability. It also returns the routing identifiers (IMSI, MSC) needed to reason about deliverability, all without sending a message to the subscriber. A lookup reflects near real-time network state, so it can reveal a ported or roaming number that a static prefix check misses.

ENUM is one of four Number Lookup access methods. Use it when you already run DNS infrastructure, or when you need low-latency, high-volume lookups. To compare the methods, see Number Lookup access methods.



Connectivity

To enable connectivity between the Infobip ENUM interface and your system, raise a support ticket with the list of source IP addresses to be safelisted. Infobip then safelists them, assigns a dedicated UDP port on the ENUM server for your connection, and provides the server address and port. For the supported IP formats, see IP safelisting in Security best practices.

ENUM queries are standard DNS NAPTR queries sent over UDP to the Infobip ENUM server. Use the server address and port provided during setup (the @x.x.x.x in the examples on this page stands in for the ENUM server IP).

Because UDP has no handshake or acknowledgement, a lost query or response yields no answer. Set a query timeout on your client and treat a missing response as a failed lookup to retry.



ENUM query packet

Each ENUM query must fulfill specific requirements. QTYPE must be NAPTR. Additional restrictions apply to the other ENUM query parameters, and the ENUM server rejects any query that does not comply with them.


HEADER section of ENUM query [#header-section-of-enum-query-enum-query-packet]

  • QR bit must be set to 0 representing DNS query
  • Opcode must be 0 representing a standard DNS query
  • Only one ENUM query per DNS packet is possible, so QDCOUNT must be 1
  • ANCOUNT, NSCOUNT, and ARCOUNT must be 0

QUESTION section [#question-section-enum-query-packet]

The QUESTION section must meet the following requirements:

  • QNAME must be built from the E.164 number using the ENUM "well-known rule" (RFC 3761), then appended with the Infobip ENUM root. See the construction steps that follow.
  • QTYPE must be NAPTR as specified in RFC 2915.
  • QCLASS can be any class defined in RFC 1035. The standard for this service is the internet class (IN).

To construct the QNAME:

  1. Remove the leading + and any non-digit characters, leaving only digits (+385915017345 becomes 385915017345).
  2. Reverse the order of the digits (385915017345 becomes 543710519583).
  3. Separate every digit with a dot (5.4.3.7.1.0.5.1.9.5.8.3).
  4. Append the Infobip ENUM root, giving 5.4.3.7.1.0.5.1.9.5.8.3.infobip.net.
NOTEInfobip uses its own private ENUM root (infobip.net), not the public e164.arpa tree defined in RFC 6116. A query with any other root returns SERVFAIL.

Example query with dig [#example-query-with-dig-enum-query-packet]

bash
dig naptr 5.4.3.7.1.0.5.1.9.5.8.3.infobip.net @x.x.x.x

In this example, x.x.x.x represents the IP address of the ENUM server. The queried number is the same one used in the successful response example later on this page. The example numbers are illustrative only and are not guaranteed to resolve.



ENUM server responses

ENUM server response format is compliant with RFC 1035 and RFC 3761. RRs returned contain only NAPTR RDATA. In every response:

  • The QR bit is set to 1, representing a DNS response.
  • RCODE is NOERROR when the ENUM request is processed successfully and a NAPTR answer is returned. Otherwise, RCODE is one of the values in ENUM error responses.
  • The QUESTION section is the same as in the ENUM query the response answers.


ENUM error responses

When the ENUM server cannot complete a query, it returns an error response: the QR bit is set to 1, and RCODE is never zero.

If the ENUM server cannot parse the DNS header, or an unexpected error occurs while it processes the request, it discards the packet. It sends no response at all. This is not an RCODE value: the client receives nothing and must rely on its query timeout to detect the failure.

For all other failures, the server returns one of the following RCODE values.

RCODE valueError cause
FORMERRThe DNS packet cannot be parsed correctly after the header is read.
SERVFAILThe server cannot process the request or complete the HLR lookup. Causes include an invalid query structure, an unsupported QTYPE, an invalid ENUM root, an unsupported record type, an HLR lookup timeout or failure, and other unmapped lookup statuses.
NXDOMAINThe destination number in the ENUM query is invalid.
NOTIMPLThe lookup cannot be completed because the destination network is not allowed or no route is available.
REFUSEDThe lookup was refused because there are not enough credits on the account.


ENUM responses: successful HLR query

When the ENUM query is successfully processed and the HLR query succeeds, the ENUM server sends a response containing the Answer section. The Answer section contains the HLR query result in the RR for which RDATA type is NAPTR.


RR format [#rr-format-enum-responses-successful-hlr-query]

The following table describes the fields of the resource record.

FieldValue
NAMESame as the ENUM query QNAME
TYPENAPTR (same as ENUM query QTYPE)
CLASSInternet class (IN)
TTL86400 seconds (24 hours). Fixed for all clients and not configurable.
RDLENGTHLength in bytes of NAPTR

NAPTR RDATA values [#naptr-rdata-values-enum-responses-successful-hlr-query]

The following table describes the NAPTR RDATA values.

FieldValue
Order10
Preference100
Flags"u"
Services"E2U+pstn:tel"
Regular expression!^.*!tel:\1;hlr=xxxxxx;imsi=xxxxxx;msc=xxxxxx;msisdn=xxxxxx;status=xxxx
Replacement.

The regular expression carries the lookup result as key=value pairs. The response can contain the basic fields in the following table. It can also contain MCC/MNC, portability, and roaming fields, depending on your configuration and on the lookup response.

FieldMeaning
hlr=HLR Global Title: the address (a phone-number-like routing identifier) of the Home Location Register that holds the record of this subscriber.
imsi=IMSI (International Mobile Subscriber Identity): the identity stored on the SIM of the subscriber. Its leading digits (MCC+MNC) identify the current serving operator, which reveals portability.
msc=MSC Global Title: the address of the Mobile Switching Center serving the subscriber. The value can be truncated, depending on your connection configuration, to prevent SMS fraud and spoofing that uses the routing information.
msisdn=The queried number in E.164 form (the phone number of the subscriber).
status=HLR status code for the lookup. 0000 means the lookup succeeded; a non-zero value (for example, 0006) indicates an HLR-level error even though the ENUM query itself was answered successfully.

Example: successful HLR query [#example-successful-hlr-query-enum-responses-successful-hlr-query]

json
1;; Got answer:
2;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 195
3;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
4 
5;; QUESTION SECTION:
6;5.4.3.7.1.0.5.1.9.5.8.3.infobip.net. IN NAPTR
7 
8;; ANSWER SECTION:
95.4.3.7.1.0.5.1.9.5.8.3.infobip.net. 86400 IN NAPTR 10 100 "u" "E2U+pstn:tel"
10"!^.*!tel:\\1\;hlr=385915017345\;imsi=219101100165275\;msc=3859\;msisdn=385915017345\;status=0000" .
11 
12;; Query time: 546 msec

Example: ENUM success with an HLR error in the payload [#example-enum-success-with-an-hlr-error-in-the-payload-enum-responses-successful-hlr-query]

The following response differs from the RCODE errors described earlier. The ENUM query itself succeeded (status: NOERROR, Answer section present), but the payload carries a non-zero HLR status= value.

json
1;; Got answer:
2;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1696
3;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
4 
5;; QUESTION SECTION:
6;7.0.0.0.0.6.8.9.5.8.3.infobip.net. IN NAPTR
7 
8;; ANSWER SECTION:
97.0.0.0.0.6.8.9.5.8.3.infobip.net. 86400 IN NAPTR 10 100 "u" "E2U+pstn:tel"
10"!^.*!tel:\\1\;msisdn=38598600007\;status=0006"
11 
12;; Query time: 383 msec


Usage notes

  • Data freshness: An HLR lookup reflects near real-time network state (active, roaming, serving operator). The 24-hour TTL (86400 seconds) on the response RR does not indicate the freshness of the data. Volatile fields such as roaming and active status are point-in-time and can change after the lookup.
  • Cost: HLR lookups carry charges. Pricing is available from your account manager.
  • Data sensitivity: Results contain sensitive subscriber and routing identifiers (IMSI, HLR/MSC addresses); the MSC value can be truncated, depending on your connection configuration. Regional regulation may restrict the availability or permitted use of HLR data. For example, some markets restrict HLR access or use a mobile number portability database instead.


Troubleshooting

The following table maps the most common failure responses to their first checks.

SymptomLikely causeFirst checks
No response at allThe DNS header failed to parse or an unexpected error occurred, so the server discarded the packet. Alternatively, the UDP query or response was lost in transit.Check that the packet contains the complete 12-byte DNS header. Confirm the query timeout is set, then retry.
FORMERRThe DNS packet cannot be parsed after the header is read.Check that the QUESTION section is correctly encoded: QNAME labels, QTYPE, and QCLASS are complete and match the packet length.
NXDOMAINThe destination number is invalid.Check the number is a valid E.164 number, and that the QNAME digits are reversed and dot-separated.
SERVFAILThe query was invalid (for example, header values that break the query rules, an unsupported QTYPE or record type, or a root other than infobip.net), or the HLR lookup failed or timed out.Check that QR is 0, Opcode is 0, QDCOUNT is 1, and ANCOUNT, NSCOUNT, and ARCOUNT are all 0. Check QTYPE is NAPTR and the QNAME ends with infobip.net, then retry the lookup. If SERVFAIL repeats for the same number, raise a support ticket with the QNAME and timestamp.
NOTIMPLThe destination network is not allowed or no route is available.Raise a support ticket with the number and timestamp to confirm network coverage for your account.
REFUSEDThere are not enough credits on the account.Check your account balance and top up, or contact your account manager.
Answer returned with a non-zero status=The ENUM query succeeded but the HLR lookup returned an error.Check the status= value in the NAPTR regular expression. This is an HLR-level error, not an ENUM transport error.


Related pages

SMPP
Connect to the Infobip SMPP server, bind sessions, encode messages, and handle delivery reports and errors.

Number Lookup
The Number Lookup product documentation, covering all access methods for HLR lookups.




Was this page helpful?