Page 338 - Asterisk™: The Future of Telephony
P. 338
statements). Mapping contexts are related to dialplan contexts in the sense that they
are a security boundary for your peers.
Phone numbers must be advertised in the following format:
<country_code><area_code><prefix><number>
For example, a complete North American number could be advertised as 14165551212.
All DUNDi mapping contexts take the form of:
dundi_context => local_context,weight,technology,destination[,options]]
The following configuration creates a DUNDi mapping context that we will use to
advertise our local phone numbers to the DUNDi-test group. Note that this should all
appear on one line:
dundi-test => dundi-local,0,IAX2,dundi:${SECRET}@toronto.example.com/
${NUMBER}, nounsolicited,nocomunsolicit,nopartial
In this example, the mapping context is dundi-test, which points to the dundi-local
context within extensions.conf (providing a listing of phone numbers to reply to).
Numbers that resolve to the PBX should be advertised with a weight of zero (directly
connected). Numbers higher than 0 indicate an increased number of hops or paths to
reach the final destination. This is useful when multiple replies for the same lookup are
received at the end that initially requested the number; a weight with a lower number
will be the preferred path.
If we can reply to a lookup, our response will contain the method by which the other
end can connect to the system. This includes the technology to use (such as IAX2, SIP,
H323, and so on), the username and password with which to authenticate, which host
to send the authentication to, and finally the extension number.
Asterisk provides some shortcuts to allow us to create a “template” with which we can
build our responses. The following channel variables can be used to construct the tem-
plate:
${SECRET}
Replaced with the password stored in the local AstDB
${NUMBER}
The number being requested
${IPADDR}
The IP address to connect to
It is generally safest to statically configure the hostname, rather than
making use of the ${IPADDR} variable. The ${IPADDR} variable will some-
times reply with an address in the private IP space, which is unreachable
from the Internet.
310 | Chapter 14: Potpourri