Custom Dialplan is not working from IVR

hi guys,

I have written a dialplan in extensions_custom.conf for passing some dtmfs.

for example I have to dial a complete number(12125264560) and then extension. now what I did is that I am passing the dtmf’s of extension.

exten => 221,1,Set(CALLERID(num)=121252555)
exten => 221,n,NoOp(I am in Quick Dialing)
exten => 221,n,Dial(SIP/SIPROUTES/12125264560,20,M(221))

exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,SendDTMF(221)
exten => s,n,Wait(1)

now when someone dials into my IVR Number which is different like e.g 2126090000 and they want to dial this 221 which is not on our server but we want this extension to be dialed by the customer. It’s not working.

Is there any solution that we can use this custom dialplan to work with our internal dialplan.

For security, an external incoming call would not normally have access to from-internal resources.

Try replacing

You can also do this without custom dial plan. Define an outgoing trunk identical to your SIPROUTES trunk but with Asterisk Trunk Dial Options set to D(wwww221#) and Override checked. Set up an Outbound Route with some prefix to access the special trunk. Set up virtual extension 221 with Follow Me set to call via the special route.

Going to very strongly recommend against @Stewart1’s advice. Nobody should ever use from-pstn-custom unless they know what they’re doing (and if you know what you’re doing, you already know the proper way).

You can only direct dial local extensions from an IVR, so create an extension of type custom for your custom dial string.

1 Like

I can understand the Asterisk Dial option but can you please explain the logic of setting up virtual trunk with follow me.

I don’t understand this.

can you explain this further I am really thankful to you.

On second thought, I agree with @lgaetz that using from-pstn-custom is generally a bad idea, because it’s all too easy to inadvertently allow an external caller to make outgoing calls on your nickel.

Our application is different but it also involves connecting an external caller via IVR to an external extension selected with DTMF tones.

When a user does not answer quickly at his desk, we use Follow Me to ring his mobile. Normally, we just put the mobile number with # appended in the follow me list. But if he is traveling and staying at a hotel with , we use the Handy phone, avoiding the hassle and expense of purchasing a local SIM card. However, a Handy phone does not have a dedicated DID – to reach it you must call the Handy access number in that country and enter an ‘extension’ number (assigned when the guest checks in).

So, the follow me number is set to 6568171454# (Handy access in Singapore) but we have an Outbound Route (ahead of the normal one for Singapore) that matches 6568171454 and selects the Handy trunk. The Handy trunk has the Dial Options set as noted earlier, so when the Handy server answers the proper extension is dialed.

Once set up, the user can be reached via his direct DID, via IVR or via call transfer to his normal extension.

I would posit that it’s always a bad idea. Every line a user puts in from-pstn-custom will override an existing, FreePBX generated line of dialplan. Unless one is aware of which lines are being overridden, and take steps to replace them somehow (easier said than done) then you will have unpredictable results, tho they may not be immediately apparent.

1 Like

Hey really thanks for the explanation but here comes little complicated part.

What if I have 10 to 20 extensions and I have to dial those.

Following this scenario I think I have to make trunk for each extension.

Am I correct.

And I tried changing the context to [from-pstn-custom] but what happens is that I am getting Failed IVR " All circuites are busy now" even if I dial it directly without entering the IVR. And It’s also not dialable via IVR.

I don’t understand why your latest test didn’t work, but here’s easy simple to try:

Assuming that with your previous setup using [from-internal-custom] you can successfully dial 221 from a local extension, create a new virtual extension that doesn’t conflict with your dial plan, e.g. 299. Turn on its Follow Me and put 221# in the Follow-Me List. Test whether you can call 299 via the IVR.

Or creating custom extensions as suggested by @lgaetz should also work.

Minor changes to your dialplan:

exten => _X.,1,Set(CALLERID(num)=121252555)
exten => _X.,n,NoOp(I am in Quick Dialing)
exten => _X.,n,Dial(SIP/SIPROUTES/${EXTEN},20,M(221))
exten => _X.,n,Hangup

exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,SendDTMF(221)
exten => s,n,Wait(1)

Then an extension of type ‘custom’ with a dial string of local/[email protected]

I have created a virtual extension with 5001 and set the follow me to 719# and in the IVR I dialed 5001 but it will not redirecting to that extension.

should I use the same extension as 221 for custom extension ?

guys any update on this.

I am still stuck in this.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.