Hi everyone,
I’m running FreePBX 17 which runs Asterisk 22.4.1. I’m banging my head against this and would deeply appreciate help from anyone who may know how to crack this.
What I’m Trying to Do
I’m using a PHP script to trigger a call via AMI Originate. Here’s the flow:
- I originate a call to
Local/301@from-internal/n - Extension 301 rings and the user answers
- The system says: “Please enter your password followed by the pound key.”
→ This is from a FreePBX PIN Set on the outbound route - I want to automatically send the PIN (e.g., 1234#) so the user doesn’t have to type it
What I’ve Tried So Far
Dial(...,B(context^s^1(${pin}))+SendDTMF()in a subroutineDial(...,D(wwww1234#))to send tones to the callee leg (doesn’t help since PIN prompt is on caller leg)- Running an AGI script that sends
SEND DTMFafter a delay - Using
Answer(),Wait(), even doubleSendDTMF()withsleepandWait()added - Confirmed the AGI script runs and can say digits / play audio
- Tried sending DTMF from AGI after waiting 6–8 seconds — still fails
Here is the custom dialplan code I tried:
[clicktocall-pin]
exten => s,1,NoOp(Click-to-Call with PIN: ${number} PIN: ${pin})
exten => s,n,Dial(Local/${number}@from-internal,B(clicktocall-auth^s^1(${pin})))
exten => s,n,Hangup()[clicktocall-auth]
exten => s,1,NoOp(Running click-to-call PIN injection with PIN: ${ARG1})
exten => s,n,SendDTMF(${ARG1}#)
exten => s,n,Return()
What Does Work (but I can’t use)
- If I configure a Yealink phone to dial
02081231234,1234#, it works perfectly — the phone delays and sends tones after the prompt - But I need this automated, from the server side, with no softphone / SIP device intervention
Constraints (Musts)
- I must use the FreePBX PIN Set on the outbound route - can’t remove or bypass it
- I must automate PIN entry (no manual keypad input)
- I can’t use softphones, external SIP clients - this has to be done within Asterisk/FreePBX server side
- I’m using Asterisk 22.4.1
Has Anyone Made This Work?
All I need is for Asterisk to send the PIN after the prompt starts, on the caller channel. But:
SendDTMF()does not workD()sends to wrong channel- FreePBX’s PIN macro runs late in the dialplan
- There doesn’t seem to be a way to “pause then send” DTMF at the right moment
If anyone has solved this:
- Did you use
Local/,SIP/, or something else? - Did you inject DTMF another way?
- Can you buffer DTMF until media is active?
I’ve spent days trying every method I can find. Any suggestions would be much appreciated.
Thanks in advance!