How to make direct dial IVR does not discon if invalid ext?

How do I make that if in a direct dial IVR a non-existing extension is entered, it does not hang-up, rather it plays a message? as of now the following code hangs up if invalid 4 digit extension is entered.

[ivr-25] exten => s,1,Answer exten => s,n,Wait(1) exten => s,n(begin),Set(TIMEOUT(digit)=3) exten => s,n,Set(TIMEOUT(response)=10) exten => s,n,Background(/var/lib/asterisk/sounds/custom/direct) exten => s,n,WaitExten(10) exten => 0,1,Goto(ivr-2,s,1) exten => _XXXX,1,Goto(from-internal-custom,${EXTEN},1) exten => i,1,Playback(invalid)

Try giving i some direction like so…

exten => i,1,Answer()
exten => i,n,Playback(invalid)
exten => i,n,HangUp(or do something else)

I think the Answer() is key here. Good Luck.

The call is already answered by the very first line. Answer on the i handler shouldn’t help.

I’m not sure, but I think you may be able to put a priority 2 line on the _XXXX extension. If that doesn’t work, you have, I think you have a feature request.