Hello all, I have one doubt in configuration in dialplan.

When I receive a call I would like to verify if the extension already on a call. If you are on a call I want to send a busy signal. What is wrong in this configuration ?

my extensions.conf
exten => s-BUSY,1,Busy()
exten => s,1,Answer()
exten => s,2,Dial(${ARG1},30,r)
exten => s,3,Goto(s-${DIALSTATUS},1)
exten => s-CHANUNAVAIL,1,Dial(Local/4444)
exten => _s-.,1,Hangup()

best Regards.

You have answered the call, so the call has succeeded, and it is too late to indicate a failure.

Also, your Goto and explicit busy does no more than simply not doing anything at all and letting the Dial drop through into the default hangup processing.

Answer is overused. If you really need to use it, you will need to use Playtones to fake the busy indications, and not hangup the call immediately.