How To Hang-up A FXO Call Without Answering It?

Home » Asterisk Users » How To Hang-up A FXO Call Without Answering It?
Asterisk Users No Comments

I’m using Asterisk 13.4.0 and DAHDI 2.10.2. I’ve got a FXO line that I
use for in and outgoing PSTN calls. Unfortunately I’m getting a lot of spam calls on the number.

I had the extension configured to forward incoming calls to 2 SIP
extensions or go to voicemail. But now I’m getting loads of junk voicemail messages, so I removed the voicemail command:

[from-pstn]
exten => s,1,Wait(1)
exten => s,2,Set(WHO=${CALLERID(num)})
exten => s,3,Verbose(CALLERID is ${CALLERID(num)})
exten => s,4,Verbose(Time is ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => s,5,Dial(SIP/1000&SIP/1100,30)
;exten => s,6,Voicemail(1000,u)
exten => s,6,Hangup()

Now incoming calls will cause the SIP extensions to ring for 30 seconds, but then the FXO line isn’t disconnected. The [from-pstn] context seems to keep looping on the Dial() command:

[Sep 19 11:16:59] — Starting simple switch on ‘DAHDI/4-1’
[Sep 19 11:17:00] — Executing [s@from-pstn:1] Wait(“DAHDI/4-1”,
“1”) in new stack
[Sep 19 11:17:01] — Executing [s@from-pstn:2] Set(“DAHDI/4-1”,
“WHO