System information

[subFreenum]
exten => start,1,Verbose(2,Performing ISN lookup)
same => n,Set(ISN=${FILTER(0-9*,${ARG1})})
same => n,Set(Result=${ENUMLOOKUP(${ISN},sip,s,,freenum.org)})
same => n,GotoIf($[${EXISTS(${Result})}]?call,1:no_result,1)
exten => call,1,Verbose(2,Placing call to ISN --${ISN}-- via ${Result})
same => n,Dial(SIP/${Result})
same => n,Return()
exten => no_result,1,Verbose(2,Lookup for ISN: --${ISN}-- returned no result)
same => n,Playback(silence/1&invalid)
same => n,Return()
We have added two new contexts to our dialplan: OutgoingISN and subFreenum. The
OutgoingISN context controls who can dial ISN numbers from within your dialplan. If
you have been following our examples throughout this book, you should have a context
called LocalSets, which is the context where all your telephones enter the dialplan.
Including OutgoingISN within LocalSets enables dialing of ISN numbers:
[LocalSets]
include => OutgoingISN ; include the context that enables ISN dialing
include => CallPlace ; use subroutine to determine what you can dial
We have placed the OutgoingISN include above the CallPlace include
because Asterisk will perform extension matching in the order of the
includes, and since CallPlace has a more general pattern match than
our OutgoingISN pattern matches, we need to make sure OutgoingISN
appears first.
The magic for dialing ISN numbers is handled in the subFreenum context. Our Outgoin
gISN context will pass the requested extension (e.g., 1234*256) to the subFreenum sub-
routine. After the NoOp() on the first line, the subroutine will filter the request for num-
bers and the asterisk (*) character to make the extension safe. The result will then be
assigned to the ISN channel variable:
exten => start,n,Set(ISN=${FILTER(0-9*,${ARG1})})
The subroutine will then perform a lookup for the ISN via the DNS system using the
ENUMLOOKUP() dialplan function. Options passed to the ENUMLOOKUP() function include:
The ISN number to look up
The method type to look up and return (SIP)
The s option, which tells Asterisk to perform an ISN-style lookup instead of a
standard ENUM lookup
The zone suffix for performing the lookups (we’ll use freenum.org, but the default
is e164.arpa)
ISN, ITAD, and freenum.org | 255