Asterisk 16 Dial plan

Hello, i need a help, and i’m new about asterisk.
I’m running Asterisk 16 and would like to implement the feature of “Call Forward on busy”
What I want is just this: One extension (let’s us say 1111) if it doesn’t anwser or rejected, the call is forwarded to 3333.

i have tried this script but didin’t worked

exten => 1111,1,Dial(SIP/${EXTEN})
same => n,GotoIf($[“${DIALSTATUS}” = “BUSY”]?busy:unavail)
same => n(unavail),Dial(SIP/3333)
same => n,Hangup()
same => n(busy),Dial(SIP/3333)
same => n,Hangup()

How do I implement this on the extensions.conf file?

Many thanks

I suspect you are getting CONGESTION, rather than BUSY. Use a no-operation line to display the actual value.

I’d probably want to do a detailed check of the actual code.

You should be seriously considering moving to chan_pjsip.

can you explain about no operation line, i don’t know how to implement it

Could you please give me example how to do this with my script? it would help thanks

verbose() is a better choice than noop().

same = n,verbose(1,[${EXTEN}@${CONTEXT}!${PRIORITY} Dialstatus = ${DIALSTATUS}])

thanks i will try it

exten => 1111,1,Dial(SIP/${EXTEN})
same => n,Verbose($[“${DIALSTATUS}” = “BUSY”]?busy:unavail)
same => n(unavail),Dial(SIP/3333)
same => n,Hangup()
same => n(busy),Dial(SIP/3333)
same => n,Hangup()

i have tried it, but it didn’t worked

same => n,GotoIf($[ ${DIALSTATUS} = “BUSY” ]?busy:unavail)

In cases where DIALSTATUS are not set, that line will give a syntax error. It’s better to use "${DIALSTATUS}" instead, that would avoid errors getting logged all over the place.

You were told to use Noop (or Verbose) to see what the actual DIALSTATUS value was. No one told you to replace the GoTo, itself, with Verbose.

Please read through the sample file I referenced and try to understand how the examples work. There are many examples there of using Noop to display the values of variables, and if you cannot understand the process from that you really need to back off and study the examples until you do understand what they are doing, before you you try coding your own dialplan.

@Vinayak : If you look back up the thread, you will see that your OP already had your line, except with better use of quotes.

thank you for helping

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