After struggling to implement least-cost routing (LCR) with VoicePulse under FreePBX, I posted a short guide. This is a copy of my post over on the FreePBX documentation site at Aussievoip.com — the original post is at http://aussievoip.com/wiki/LCR+With+FreePBX+and+VoicePulse
Here are the required steps:
- Download and install the Dialplan Injection and Extended Routing modules.
- Set up trunks for your VoicePulse and other providers
- Create a dialplan injection called “VoicePulseCheck-Domestic”
- Assign an extension if needed (it won’t be used)
- Use the following code for the dialplan injection:
Set(OTHER_PROVIDERS_FLAT_RATE=0.016) ; the lowest non-Voicepulse rate -- Stanaphone = $0.016, Voxee = $0.011, AxVoice = $0.02 Set(DIAL_TRUNK=4) ; trunk number for VoicePulse1 Set(DIAL_NUMBER=${EXTEN})DeadAGI(fixlocalprefix) ; Fix up the requested number in a format that VoicePulse can use -- requires that DIAL_TRUNK and DIAL_NUMBER be set Macro(voicepulseflexrate,${VOICEPULSE_API_KEY},${DIAL_NUMBER}) Verbose(The rate is ${VOICEPULSE_FLEXRATE})GotoIf($[${VOICEPULSE_FLEXRATE} > ${OTHER_PROVIDERS_FLAT_RATE}]?outrt-009-Domestic_After_Voicepulse,${EXTEN},1)
- Set up three outbound routes:
- Domestic
- Set the failover destination to be the VoicePulseCheck-Domestic dialplan injection
- Use the following dial patterns:
- 1NXXNXXXXXX
- NXXNXXXXXX
- NXXXXXX
- Use ENUM for the only trunk
- Domestic_Voicepulse
- Set the failover destination to be the Domestic_After_Voicepulse extended route
- Use the following dial patterns:
- 1NXXNXXXXXX
- NXXNXXXXXX
- NXXXXXX
- Use your Voicepulse trunk(s) here
- Domestic_After_Voicepulse
- Don’t set a failover destination
- Use the following dial patterns:
- 1NXXNXXXXXX
- NXXNXXXXXX
- NXXXXXX
- Use your other trunks here (in order of preference)
- Domestic
- Go back to the dialplan injection and set the destination to be the extended routing item “Domestic_Voicepulse”