This article will be of little interest to experienced VoIP administrators, it is addressed to admins of small IP telephone servers for small offices.
DUNDI - what it is and why you need it
DUNDi is a dynamic routing protocol for IP telephony. Allows you to automatically find the server serving the specific number.
If you do not use this protocol, then for several offices you have to create separate numbering plans, divided into ranges. And create separate routes to all offices (and trunks to the heap). When the PBX network grows up a bit, this state of affairs can become inconvenient and even create problems (or maybe not create them).
Practice
You can find many customization articles, but they usually do not reveal the features of the DUNDi configuration in conjunction with FreePBX (it supports the DUNDi configuration in the semi-manual mode).
')
So, we need:
- Create a private / public key pair for each server connected to DUNDi routing
- Choose servers that will be the root for DUNDi to work (you can make a simple star or connect everyone with everyone)
- Create a context in which we will look for internal numbers (you can either not create, and cling to the existing one)
- Create DUNDi configuration
- Create a trunk through which the call will occur (in this case, I use IAX2)
- Create a DUNDi trunk on which to hang outbound routing
DUNDi keys
Go to the server via ssh and:
cd /var/lib/asterisk/keys astgenkey -n < >
The * .pub file must be transferred to other servers that will be in direct connection with this server.
Search context for internal numbers
file: /etc/asterisk/extensions_custom.conf
[dundi-extens] include => ext-local include => ext-intercom-users include => ext-meetme
DUNDi configuration
File: /etc/asterisk/dundi.conf
[general] ; , department=VoIP organization=******* locality=Moscow stateprov=Moscow country=RU email=****** ; , port=4520 entityid=FE:7E:15:DC:**:** ; , MAC cachetime=600 ; , , , ttl=32 ; , , autokill=yes [mappings] ; DUNDi, ; dundi_inter, IAX2 , ; dundi-extens - , ; dundi_context - , DUNDi ; ${IPADDR} - Asterisk , 127.0.0.1 . , IP dundi_context => dundi-extens,0,IAX2,dundi_inter:${SECRET}@${IPADDR}/${NUMBER},nopartial ; DUNDi , , DUNDi [FE:A0:79:26:52:65] ; ID , MAC model = symmetric host = *.*.*.* ; IP , fqdn inkey = < , pub> outkey = < , key> include = dundi_context ; DUNDi , permit = dundi_context ; qualify = yes dynamic=yes
Trunk to make a call
The name of the trunk in this contribution is simply the display name.

And in this, already that Asterisk uses, we do not use the Incoming section at all.

Outgoing Sectiontype=user
dbsecret=dundi/secret
context=dundi-extens
You can reload the DUNDi configuration like this:
module reload pbx_dundi.so
You can reload the keys as follows:
module reload res_crypto.so
DUNDi trunk and routing
The name of the trunk in this contribution is simply the display name.

DUNDi Mapping corresponds to the mappings section of the /etc/asterisk/dundi.conf file.

Create a route:

Since the numbering plan I have is four-digit, then the number pattern I have is

Check
After applying the changes, from the asterisk -rv command line, you can:
View the status of DUNDi peers:
voip*CLI> dundi show peers EID Host Port Model AvgTime Status fe:a0:79:26:**:** 172.16.**.* (S) 4520 Symmetric Unavail OK (9 ms) 1 dundi peers [1 online, 0 offline, 0 unmonitored]
Try to allow internal number:
voip*CLI> dundi lookup 1000@dundi_context