VoIP Cookbook: ENUM Routing Table in OpenSIPS configuration

From OnnoWiki
Jump to navigation Jump to search

The short version

if (uri=~"^sip:00[1-9][0-9]*@*") {
    strip(2);
    prefix("+");
};

if (uri=~"sip:\+[0-9]+@*")
        enum_query("e164.id.");

The above example will allow all client from all server to access our ENUM query routing. A more complete version of ENUM query may be as follows,

# Somewhere in the route[x] section:

# if you want to make ENUM work with numbers starting with "00",
# use the following to convert "00" it into a "+"

if (uri=~"^sip:00[1-9][0-9]*@example\.net") {
    # strip leading "00"
    # (change example.net to your domainname or skip the stuff after the "@")
    strip(2);
    # (adjust, if your international prefix is something else than "00")
    prefix("+");
};

# check if request uri starts with an international phone
# number (+X.), if yes, try to ENUM resolve in e164.arpa.
# if no result, try in nrenum.net
if (uri=~"sip:\+[0-9]+@example\.net") {
    # (change example.net to your domainname or skip the stuff after the "@")
    if ( !enum_query("e164.arpa.") ) {
        enum_query("nrenum.net.");
    };
}; 


Another alternative that may be extended is as follows,

# 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
   }

Yet another alternative that can be tried / expanded is as follows,

if (is_from_user_enum()) {
   enum_query("");
   }


See Also