*RESOLVED* Unified Voicemail and Company Directory: Almost There!!!
I've been working on making a unified voicemail and company directory for our two offices. There's some manual entries that must be made, but here's what I have so far (I'll tell you what I lack and need help with at the end!):
1. Trixbox 2.2.4 running at each location.
2. IAX2 trunks named Inter-Office
3. 1XX extensions in Houston, 2XX extensions in Dallas
4. Modified extensions_custom.conf to add this (for Houston, 1XX for Dallas):
[ext-local-custom]
exten => _2XX,1,dial(iax2/Inter-Office/${EXTEN})
5. Modified voicemail.conf in each office so the entries are the same (this gets the directory working)
So here's what works:
1. A person can call into either office and access a unified company directory.
2. Selecting a foreign user in the directory routes the call to the other PBX properly.
3. All users can dial *97 to access their direct voicemail box.
Here's what doesn't work (and I need help with)
Dialing *98 and putting in a foreign voicemail box (i.e. *98 212 from Houston) takes me to the mailbox entry for 212 on the Houston server instead of accessing the remote box.
I think I know what I need to do, but am having a hard time implementing it. In extensions_additional.conf under [app-dialvm] there is the entry include => app-dialvm-custom. I know that I can create that context in the extensions_custom.conf and override the settings here. I know that I need to play the "Asterisk Mail" sound and "Mailbox?" sound, and then route the call based on the input to either Houston or Dallas, but I don't know how to use a trunk to access VoiceMailMain() on a remote box.
I know this is a small thing, but it would really put the finishing touches on the unified directory if my *98 worked for getting their voicemail regardless of what office they are currently in.
-Chris
I have done this but can't look it up. Obviously you only have 1 box with voicemail installed correct? As I recall, set up outbound route with *98 to point to the box with voicemail over IAX2 trunk. I don't think you need anything else, it's been a while so I don't quite remember.
Chris
No, I have two boxes with voicemail installed, fully independent from one another. I just need help getting to the *98 over the trunk (my dial command does not seem to like the *). Everything works like a champ except for the unified *98 application. If I can figure it out, I'll post full details, as I know several people in the community are looking for this solution.
-Chris
here's a quick and dirty idea of what you need:
[app-dialvm-custom]
exten => _*98,n,Set(ex=${EXTEN:3})
exten => _*98,n,Gotoif($[${${EXTEN:3}:1}=2]?vm-othersys,1)
exten => vm-othersys,1,Dial(iax/othersys/*98${ex})
(its not tested, you might need to work on in a bit...)
I think you may need to change lazytt's script a little to make it work.
lazytt wrote:
here's a quick and dirty idea of what you need:
[app-dialvm-custom]
exten => _*98,n,Set(ex=${EXTEN:3})
exten => _*98,n,Gotoif($[${${EXTEN:3}:1}=2]?vm-othersys,1)
exten => vm-othersys,1,Dial(iax/othersys/*98${ex})
(its not tested, you might need to work on in a bit...)
I think it needs to be:
[app-dialvm-custom]
exten => _*98X.,1,Set(ex=${EXTEN:3})
exten => _*98X.,n,Gotoif($[${${EXTEN:3}:1}=2]?vm-othersys,1:move-on)
exten => vm-othersys,1,Dial(iax/othersys/*98${ex})
exten => _*98X.,n(move-on),Noop(Returning to app-dialvm)
(its not tested, you might need to work on in a bit...)
Notice the "X." after the *98. this allows you to dial *98212 and have the script work. You will notice I added an alternate destination to the If statement and added a line. The alternate (else) in the If statement lets you skip dialing the other box if it is not a match. Since "app-dialvm-custom" was called as an include from "app-dialvm," the last line serves as a placeholder and a spot to jump back to "app-dialvm." IF line 2 does match, the code in line 3 will be executed and you will never get to line 4.
Putting it in app-dialvm-custom allows both voicemail systems to work. This is a great idea by the way.
I think I almost have it, but for some reason, the system keeps bypassing the app-dialvm-custom in favor of the app-dialvm (even though the include should be working...) I'm still trying to figure out why the include is failing. Any help would be great, I think I a day or two away from having this thing licked. I'm going to normalize the program structure one more level so that multiple offices are easier.
Thanks,
Chris
I've found the problem with the include file, it seems that asterisk always interprets the include file last (even if it is in front of everything else). I have changed the feature code for dial voicemail to *51 (so I can use *98 in my custom file). Here's what it looks like, but it's currently ringing extensions instead of accessing voicemail, I'm sure it's something stupid I've done. Here my custom File:
[app-dialvm-custom]
exten => *98,1,Answer
exten => *98,n,Wait(1)
exten => *98,n,Playback(vm-login)
exten => *98,n,WaitExten(,)
exten => 1xx,n,Marco(get-vmcontext,${EXTEN:3})
exten => 1xx,n,VoiceMailMain(${EXTEN:3}@${VMCONTEXT})
exten => 1XX,n,Macro(hangupcall,)
exten => 2xx,n,Dial,(iax/Inter-Office/*98${EXTEN:3})
I borrowed code from the IVR, I'm thinking my problem is related to WaitExten(,) but I'm not sure what to put in it's place. I'm trying to write a "shell" replacement for *98 that reads the extension and routes the call based on the extension.
-Chris
Okay, here's the final piece, I've managed to get it all working. Thanks for all your help, I couldn't have done it without you all.
1. Change the feature code of "dial voicemail" to something that you don't use, we can't use it here because the -custom include file only gets evaluated AFTER the original app (screws our pattern matching)
2. Make sure you have the dial rules set up properly (i.e. route *982XX to the Dallas IAX2 trunk).
3. Add this to extensions_custom.conf
[app-dialvm-custom]
exten => *98,1,Answer
exten => *98,2,Wait(1)
exten => *98,3,Read(ex|vm-login|||2|2)
exten => *98,4,GotoIf($[$["${ex:0:1}" = "1"]]?vm-houston,1:5)
exten => *98,5,GotoIf($[$["${ex:0:1}" = "2"]]?vm-dallas,1:hang,1)
exten => _*98.,1,Set(ex=${EXTEN:3})
exten => _*98.,2,GotoIf($[$["${ex:0:1}" = "1"]]?vm-houston,1:3)
exten => _*98.,3,GotoIf($[$["${ex:0:1}" = "2"]]?vm-dallas,1:hang,1)
exten => vm-houston,1,Macro(get-vmcontext,${ex})
exten => vm-houston,2,VoiceMailMain(${ex}@${VMCONTEXT})
exten => vm-houston,3,Goto(hang,1)
exten => vm-dallas,1,Dial(IAX2/Inter-Office/*98${ex})
exten => vm-dallas,2,Goto(hang,1)
exten => hang,1,Macro(hangupcall,)
; end of [app-dialvm-custom]
Obviously, make sure you make your contexts meaningful to you. One note is that "Inter-Office" is the name of my IAX2 trunk, make sure you replace it with whatever you have.
I think I've posted everything necessary now for a fully unified VoiceMail and Company Directory application. Let me know if you need any more details.
-Chris
I did something similar for our company by making a few minor changes to the directory script, and replicating the audio files so that # works just like it is on one system but can be on either system.. I've posted the code to freepbx for the directory piece and used a iax trunk between with Dundi. it runs very smooth.
You can also find me on the #trixbox and #freepbx irc channels most of the time.
Everything is working great. The only thing is when I call between locations, the cid is correct but the name says device 249. Locally it is fine, but when you call from trunk to trunk you lose the stations name. I know it is little, but our sales dept has grown used to see who is calling them.
It worked great for a while until the last freepbx update to custom applications. It still works from an extention but no longer can you call an extention from an IVR on another machine.
I would really like this to work again and have tried moving in verious different locations. I have 4 diget extentions on my other pbx that start with 8.
[ext-local-custom]
exten => _8XXX,1,dial(iax2/EX/${EXTEN})
It worked great for a while until the last freepbx update to custom applications. It still works from an extention but no longer can you call an extention from an IVR on another machine.
I would really like this to work again and have tried moving in verious different locations. I have 4 diget extentions on my other pbx that start with 8.
[ext-local-custom]
exten => _8XXX,1,dial(iax2/EX/${EXTEN})
Jahyde,
It's in step 5 of the first post:
Modify the voicemail.conf file to contain entries from your foreign pbx. This needs to be manually updated at both sites. I never got around to asking Phillipe w/ FreePBX about a way to get the databases to sync. (I'm assuming I would need to designate one as the master). FreePBX modifications to voicemail.conf are non-destructive, so if you have data in there that contains information about people in the foreign pbx, it won't overwrite your entries...
Hope that clears things up...
Regards,
Chris
I've been meaning to put together a step-by-step guide on this topic, but things here are a little too hectic to get it pounded out right now... I haven't even tested the syntax with Asterisk 1.4 yet!! I will be deploying new servers (moving from beta to production) in the next month or two. I'll try and put something nice in the wiki other than the cut-and-paste from this post...
-Chris
ya - i posted just posted the forum link in here http://trixbox.org/wiki/Additional_Scripts_and_Tricks
feel free to replace that anytime with a full writeup ;)
Hey guys I know this thread is old but I think it still serves as a reference to a lot of readers, I have it working this far with the directions above which means my Directory application works cross-server.
In my setup, server A is the main server.
Server B is another office which gets some direct calls, but most customers will have the numbers that point to server A.
Both are linked with IAX2 and working fine. I set it up following the directions in this thread so that people calling server A can go into the directory and find people from server B (but not vice-versa in my case, this is on purpose).
What's missing is this: on my main IVR on server A I enabled Direct Dialing. I need to be able to reach extensions from server B. Right now it says "That is not a valid extension", even though if I go in the directory I am able to select it from there and get routed to it.
Any pointers?
There were some modifications made to freepbx (and now pbxconfig) that prevent the direct dialing from the IVR unless you modify your IVR contexts so that they consider the extensions on the other server as local. You'll need to go into your config files for this one, but here you go...
modify your extensions_custom.conf file to include the context for your remote office in the dialing plan. For instance, i use IVR-2 for my main menu, so I put the following in my main office IVR:
[IVR-2-custom]
exten => _2XX,1,dial(iax2/Inter-Office/${EXTEN})
my satellite office also uses IVR-2 on it's system for the main menu, so I have this in the satellite IVR:
[IVR-2-custom]
exten => _1XX,1,dial(iax2/Inter-Office/${EXTEN})
Hope this helps.
-Chris
Everyone, it's been quite a while since this has been updated, and I've refined (and HEAVILY commented) the code used for the custom voicemail integration. I'm also utilizing the extensions_override_freepbx.conf file that is available now, so there is no need to disable or change the feature code of *98 in the system. As always, feedback and improvements on the code are welcomed. I'll be updating the Wiki with a full blown how-to in the not too distant future. Here are a couple of highlights from the new app:
1. It is no longer necessary to specify which trunk you wish to dial out. Consequently, you don't have to update the code it your trunk name changes.
2. As a result of the above item, this script will work with any trunk that allows direct inter-office dialing.
3. The need to adjust the script for each location has been minimized. Now, the only thing that must be updated are the dialing rules to match the local extensions of the system.
4. LOTS and LOTS of comments. I tried to make this app easily modifiable by people with even basic knowledge of asterisk.
Without further ado, here's the code, place it in extensions_override_freepbx.conf
[app-dialvm]
;******************************************************************************
; Module written by Chris Vanderbles, using code from FreePBX, and help from *
; the trixbox community. This module is known to work with Asterisk 1.2 and *
; Asterisk 1.4. Functionality with 1.6 has not been determined 12-05-2008 *
; This module assumes that you have 2 or more asterisk boxes interconnected *
; via trunks with the context of from-internal SIP or IAX2 should work *
; equally well. *
;******************************************************************************
;******************************************************************************
; This sections catches *98 and simulates the standard app-dialvm application *
; but checks the extension input into the system and routes the call *
; accordingly. Outbound routes must be set to allow for dialing *98XXX for *
; calls to complete properly. Make sure that vm-local is correct for each box *
;******************************************************************************
exten => *98,1,Answer ;catch *98 and answer the call
exten => *98,2,Wait(1) ;pause for 1 second
exten => *98,3,Read(ex|vm-login|||2|2) ;Read into var ex the val after vm-login message played, 2 attempts, timeout 2 sec.
exten => *98,4,GotoIf($[$["${ex:0:1}" = "1"]]?vm-local,1:vm-remote,1) ;If first digit of ex = 1, goto vm-local else go to vm-remote.
;*************************************************************************************
; Make sure the above local evaluation fits your local extension profile, if you're *
; using 4 digit dialing and your local office common prefix is 42XX, then you'd *
; use this for your evaulation: GotoIf($[$["${ex:0:2}" = "42"]]?vm-local) *
; If you have multiple non-congruous local extension profiles, set the destination *
; of the first evaluation to the next line like so: *
; exten => *98,4,GotoIf($[$["${ex:0:1}" = "2"]]?vm-local,1:5) *
; exten => *98,5,GotoIf($[$["${ex:0:1}" = "6"]]?vm-local,1:vm-remote,1) *
; and so on until all necessary matching conditions are met *
;*************************************************************************************
;*************************************************************************************
; This section catches direct dial *98 numbers like *98XXX and runs the same *
; evaluation as above, make sure this section matches your evaluations above. *
;*************************************************************************************
exten => _*98.,1,Set(ex=${EXTEN:3}) ;Set the variable ex equal to extension # dialed
exten => _*98.,2,GotoIf($[$["${ex:0:1}" = "1"]]?vm-local,1:vm-remote,1) ;If first digit of ex = 1, goto vm-local, else go to vm-remote
;*************************************************************************************
; This section of code is just copied from the original app-dialvm (and renamed with *
; vm-local, since it handles local extensions and their access to voicemail. *
;*************************************************************************************
exten => vm-local,1,Macro(get-vmcontext,${ex}) ;Get the Voicemail Context of the extension
exten => vm-local,2,VoiceMailMain(${ex}@${VMCONTEXT}) ;call VoiceMailMain with extension and context
exten => vm-local,3,Goto(hang,1) ;release the call
;*************************************************************************************
; This section of code sends extensions that evaluate as "remote" to the outbound- *
; allroutes context and sets the dial pattern to *98XXX or whatever your extension *
; happens to be. The dialing rules of the outbound routes will route the call to *
; the proper server in your trunking scheme. *
;*************************************************************************************
exten => vm-remote,1,goto(outbound-allroutes,*98${ex},1) ;send call to outbound routes for trunking.
exten => vm-remote,2,Goto(hang,1) ;release the call
exten => hang,1,Macro(hangupcall,) ;Hang up the call if anything manages to fall through
; end of [app-dialvm]
Enjoy!!!
-Chris
Chirs,
The part that I do not understand is the one you use IVR-2 for main menu, In my trixbox i have an IVR that we created called Main.
So I've tried both ways on extensions_custom.conf:
[IVR-2-custom]
exten => _3XXX,1,dial(iax2/remotetrunk/${EXTEN})
and
[Main-custom]
exten => _3XXX,1,dial(iax2/remotetrunk/${EXTEN})
what am I doing wrong?
I've been using trixbox for over 2 years but i still find myself confused.
Regards,
Eduardo -



Member Since:
2006-06-26