DUNDi, In easy steps


DUNDi™ is a peer-to-peer system for locating Internet gateways to telephony services.

Unlike traditional centralized services (such as the remarkably simple and oncise
ENUM standard), DUNDi is fully-distributed with no centralized authority whatsoever.

Simply put, DUNDi is an Asterisk specific protocol setup between two or more PBX’s
whereby a PBX may request extension call route location information from one or more
peering PBX’s.

Here is a verbal example:
PBX A: Hello PBX peer B. Do you have extension 201?
PBX B: Hi PBX peer A. Yes I do have extension 201, and here is how you will
contact this extension, IAX2/username:password@10.10.14.122/201

Steps to make servers accessible from dundi.

1. Generate the Private and the Public keys for both the servers
.
We use the same inkey/outkey for PBX A & B .Sharing the same key across the
servers is much easier than keeping track of a set for each server. To generate the keys:
On both servers go to following path|

cd /var/lib/asterisk/keys
and run the command

#astgenkey -n PBX A’s hostname < if you are in PBX A > else

#astgenkey -n PBX B’s hostname < if you are in PBX B >

Do not put a password on the keys. This will generate 2 files (hostanme.key and hostname.pub). Copy the new pub keys of PBX A to PBX B on the /var/lib/asterisk/keys directory and also copy the new pub keys of PBX B to PBX A on the /var/lib/asterisk/keys directory.

You
must have openssl package installed on the system to generate the keys.

2.open iax_custom.conf <located on /etc/asterisk/>

Enter following lines exaclty as they apper in both PBX A and PBX B

[priv]
type=friend
dbsecret=dundi/secret
context=dundi-priv-local

3. Open dundi.conf on PBX A and enter the follwing lines <located on /etc/asterisk>

[general]
department=Research and Development
organization=xyz Enterprises
locality=Kathmandu
stateprov=NP
country=Nepal
email=shishirp@wlink.com.np
phone=977-1-XXXXXX

[mappings]
priv => dundi-priv-canonical,0,IAX,priv:${SECRET}@${IPADDR}/${NUMBER},nopartial
priv => dundi-priv-customers,100,IAX,priv:${SECRET}@${IPADDR}/${NUMBER},nopartial
priv => dundi-priv-via-pstn,400,IAX,priv:${SECRET}@${IPADDR}/${NUMBER},nopartial

Note : Itsbetter to remove ${IPADDR} variable in above feilds and enter the ip address of PBX A, manually.

Finally Enter the followin lines on the dundi.conf itself

[00:XX:XX:XX:XX:XX] ; PBX B’s mac address
model = symmetric
host = PBX B’s hostname
inkey = PBX B’s public key
outkey = PBX A’s private key
include = priv
permit = priv
qualify = yes
order = primary

Example :
[00:09:6S:46:93:22] ;asterisk-trunk.wlink.com.np
model = symmetric
host = asterisk-trunk.shishir.com.np
inkey = asterisk-trunk.shishir.com.np ;asterisk-trunk’s public key
outkey = asterisk-trixbox.shishir.com.np ;asterisk private key
include = priv
permit = priv
qualify = yes
order = primary

4. Open dundi.conf on PBX B and repet the above process as

[general]
department=Research and Development trunk
organization=xyz Enterprises trunk
locality=Kathmandu
stateprov=NP
country=Nepal
email=shishirp@wlink.com.np
phone=977-1-XXXXXX

[mappings]
priv => dundi-priv-canonical,0,IAX,priv:${SECRET}@${IPADDR}/${NUMBER},nopartial
priv => dundi-priv-customers,100,IAX,priv:${SECRET}@${IPADDR}/${NUMBER},nopartial
priv => dundi-priv-via-pstn,400,IAX,priv:${SECRET}@${IPADDR}/${NUMBER},nopartial

Note : Itsbetter to remove ${IPADDR} variable in above feilds and enter the ip address of PBX B, manually.

Finally Enter the followin lines on the dundi.conf itself

[00:XX:XX:XX:XX:XX] ; PBX A’s mac address
model = symmetric
host = PBX A’s hostname
inkey = PBX A’s public key
outkey = PBX B’s private key
include = priv
permit = priv
qualify = yes
order = primary

4. Now comes the tough part, open extensions_custom.conf on PBX A <located on /etc/asterisk>

[ext-local-custom]
;for Direct IVR dialing if IVR is installed on the PBX B
exten => _5XX,1,Macro(dundi-priv,${EXTEN})
exten => _6XX,1,Macro(dundi-priv,${EXTEN})
exten => _8XX,1,Macro(dundi-priv,${EXTEN})
exten => _2000,1,Macro(dundi-priv,${EXTEN})
exten => _2002,1,Macro(dundi-priv,${EXTEN})

;local direct dail from IVR to queues if u have installed the [ext-local-custom].
exten => _200,1,Goto(ext-queues,${EXTEN},1)
exten => _199,1,Goto(ext-queues,${EXTEN},1)

[dundi-priv-canonical]
; local number of the PBX A for dundi advertise
exten => _199,1,Goto(ext-queues,${EXTEN},1)
exten => _200,1,Goto(ext-queues,${EXTEN},1)
exten => _3XX,1,Goto(ext-local,${EXTEN},1)
exten => _9XX,1,Goto(ext-local,${EXTEN},1)

[dundi-priv-customers]
; If you are an ITSP or Reseller, list your customers here.

[dundi-priv-via-pstn]
; If you are freely delivering calls to the PSTN, list them here

;Allow other server to call via Zaptel
exten => _XXXXXXXXXX,1,Dial(Zap/g0/${EXTEN}
exten => _XXXXXXX,1,Dial(Zap/g0/${EXTEN}

where g0 is the group defined on the /etc/asterisk/zapata.conf

[dundi-priv-local]
include => dundi-priv-canonical
include => dundi-priv-customers
include => dundi-priv-via-pstn

[dundi-priv-switch]
; Just a wrapper for the switch
switch => DUNDi/priv

[dundi-priv-lookup]
include => dundi-priv-local
include => dundi-priv-switch

[macro-dundi-priv]
exten => s,1,Goto(${ARG1},1)
include => dundi-priv-lookup

[trydundi]
exten => _.,1,Macro(dundi-priv,${EXTEN})
exten => _.,2,Congestion

5.Now again , open extensions_custom.conf on PBX B <located on /etc/asterisk>

[dundi-priv-canonical]
; local number of the PBX B for dundi advertise
exten => _5XX,1,Goto(ext-local,${EXTEN},1)
exten => _6XX,1,Goto(ext-local,${EXTEN},1)
exten => _8XX,1,Goto(ext-local,${EXTEN},1)
exten => _2000,1,Goto(ext-queues,${EXTEN},1)
exten => _2002,1,Goto(ext-queues,${EXTEN},1)

[dundi-priv-customers]
; If you are an ITSP or Reseller, list your customers here.

[dundi-priv-via-pstn]
; If you are freely delivering calls to the PSTN, list them here

[dundi-priv-local]
include => dundi-priv-canonical
include => dundi-priv-customers
include => dundi-priv-via-pstn

[dundi-priv-switch]
; Just a wrapper for the switch
switch => DUNDi/priv

[dundi-priv-lookup]
include => dundi-priv-local
include => dundi-priv-switch

[macro-dundi-priv]
exten => s,1,Goto(${ARG1},1)
include => dundi-priv-lookup

[trydundi]
exten => _.,1,Macro(dundi-priv,${EXTEN})
exten => _.,2,Congestion

Note :
I have installed 300-399 extensions in PBX A and two queues 199 and 200 on the same server, main IVR is in the PBX A and the Zaptel PSTN line is too connected on the PBX A and
500-599,600-699,800-899 extensions in PBX B and two queues 2000 and 2002 on the same PBX server

Finally,
On the PBX B server define a trunk with the custom Dial String as local/$OUTNUM$@trydundi. This is what we all to do.

some useful commonds to run under asterisk CLI.

dundi flush => Flush Dundi cache
reload pbx_dundi.so =>reload pbx dundi
dundi lookup XXX@priv =>lookup extension number in dundi cloud
reload res_crypto.so =>reload keys that were created after asterisk is started
dundi query <mac address> =>query remote dundi server.

, , ,

Comments are closed.