Realtime + DUNDi Dialplan

I’m currently attempting to use realtime registration of peers, along with DUNDi across multiple servers, to create a sort of distributed cluster of Asterisk hosts. At this point I have the basics working - Realtime is set up and running (LDAP backend), DUNDi is configured, and I can register SIP phones to either of the two servers and make calls between the two.

I’m struggling right now with the Dialplan. What doesn’t work in my current configuration is voicemail - the call will go between the soft phones, but never rolls over to voicemail. I’m guessing I need to do some Dialplan work to get it going, but not entirely sure what to do. Since I’m using LDAP as my backend, I’m not putting my entire configuration into LDAP - so, pieces of the dialplan that are not dynamic will end up in the extensions.conf file. At this point, my extensions.conf file has the following entries:

switch => Realtime/from-phones@
include => lookupdundi
include => Services

exten => *98,1,VoiceMailMain()
exten => 1234,1,Playback(demo-congrats)
exten => 1234,n,Hangup()

switch => DUNDi/extensions

exten => _X.,1,Goto(from-phones,${EXTEN},2)

So, the from-phone context is the one defined in my sip.conf and iax.conf files, along with my LDAP entries for end points, that the end points actually register on. I have the “switch => Realtime” magic specified there, and extconfig.conf configured to go look at LDAP for the extensions - which are the same objects that define the SIP and IAX users. I also have the DUNDi context specified so that DUNDi will be consulted to determine where peers are actually registered.

What I’m having trouble figuring out and wrapping my mind around is how I combine the entries pulled out of Realtime with a Dialplan that deals with, for example, voicemail. How do I correctly set up a context where Realtime and DUNDi will be consulted for peer information, but, if the peer doesn’t answer, or isn’t online, the call will be transferred to voicemail.

I am using realtime for the voicemail configuration, too, along with IMAP, so the same voicemail boxes are available on both Asterisk servers, so it doesn’t matter to me whether the push to voicemail in the Dialplan happens on one server or another.

Well, I just resolved this issue, maybe not the best way possible, but I did. I know the LDAP config backend is a little less structured than using a DB, and that’s okay. However, I was able to get this to work by writing the code needed to push the calls between the device and voicemail. Then, in LDAP, for the extension, instead of using “Dial” for the Application and just the SIP/ for ApplicationData, I used Macro for the Application and then the standard macro arguments for ApplicationData, pointing it at the macro I created in extensions.conf.

Maybe this is the “right” way to do it, maybe not…if anyone has feedback on this way or a better way, I’m all ears.