IVR Setup - Enable Direct Dial (limit to Directory context)

Sorry if there are other topics on this, I did some searching and couldn’t find anything.

I wanted to limit the extensions that a caller could dial to only those that matched the IVR’s directory context. For example if IVR Directory Context = group1, then only extensions with VM context = group1 can be dialed from that IVR. This is already setup for directory search, but I couldn’t find anything for the Direct Dial.

I wanted to share the dial plan in case it would be useful to incorporate into FreePBX, or just incase anyone else had the same need as I did.

insert into extensions_custom.conf

[ivr-10-custom]
include => ivr-direct-context-only
; end [ivr-10-custom]

[ivr-direct-context-only]
; Match only 3+ digit dialing
; ${EXTEN} = number dialed
; ${DIR-CONTEXT} = context set in IVR
; ${VMCONTEXT} = context of extension dialed - this is also used so that invalid extensions are not dialed
; ${IVR_CONTEXT} = IVR that called this function so it can return on invalid dial
exten => _XXX.,1,Macro(get-vmcontext,${EXTEN})
exten => _XXX.,n,GotoIf($["${VMCONTEXT}" = “${DIR-CONTEXT}”]?from-did-direct,${EXTEN},1:${IVR_CONTEXT},i,1)
; end of [ivr-direct-context-only]

I set up the dial plan this way so that it could be used for any IVR and would return to the original IVR in case of an invalid extension. I’m a novice at dial plan construction so I’m sure there is a better way to do this.

It would be nice if the IVR setup would show you a list of all VoiceMail contexts so that you could select all context that could be accessed from the IVR. This would also apply to the Directory context.

Thanks,
Colin.

Thanks for this – it really helped!

I made some changes so that truly invalid extensions (not just in the wrong
context but actually non-existent) would be handled correctly. My updated
version follows:

[ivr-10-custom]
include => ivr-direct-context-only
; end [ivr-10-custom]
custom]

[ivr-direct-context-only]
; Match only 3+ digit dialing
; ${EXTEN} = number dialed
; ${DIR-CONTEXT} = context set in IVR
; ${VMCONTEXT} = context of extension dialed - this is also used so that invalid extensions are not dialed
; ${IVR_CONTEXT} = IVR that called this function so it can return on invalid dial
exten => _XXX.,1,Set(VMCONTEXT=${DB(AMPUSER/${EXTEN}/voicemail)})
exten => _XXX.,n,GotoIf($["${VMCONTEXT}" = “”]?${IVR_CONTEXT},i,1)
exten => _XXX.,n,GotoIf($["${VMCONTEXT}" = “${DIR-CONTEXT}”]?from-did-direct,${EXTEN},1:${IVR_CONTEXT},i,1)
; end of [ivr-direct-context-only]

Hi

I am missing something

I am trying the above code, and nothing seems to happen.

Exactly where do I find the IVR Directory Context and/or how do I setup the the approved extension per IVR

I am trying to limit dialed extensions per IVR - so that cross over is eliminated
and only approved extensions can be dialed by the calling party.

Thanks

Guys

In the IVR you can pick to limit which extensions can be direct dialed to a specific company directory. That was all added in 2.8 I believe but for sure 2.9

The “IVR Directory Context” is found in the “Directory Context” field on the IVR screen.

As stated in the original post, the IVR’s Directory Context is matched against the “VM Context” on the extension setup screen.

I’m using Trixbox 2.6.1.