I am going to convert my FastAGI
to AsyncAGI
. In case of FastAGI
if anything went wrong asterisk continues dialplan execution and auto falls through. In case of AsyncAGI AGI(agi:async)
dialplan executed is paused until an ASYNCAGI BREAK
command sent from AMI client.
But when I don’t have any AMI client connected async AGI call gets stuck forever (until I restart asterisk or manually hangup those channels).
I need help regarding this situation. I want to auto hangup (or continue dialplan execution in case of no AMI client is connected). How can I achieve this ?
My Dialplan:
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
[globals]
[dialer]
exten => _X.,1,Goto(f1context,${EXTEN},1)
[f1context]
exten => _X.,1,NoOp(${CALLER_USERNAME} from ${CHANNEL(pjsip,remote_addr)})
same => n,AGI(agi:async,incoming,${CALLER_USERNAME},${CHANNEL(pjsip,remote_addr)},${PJSIP_HEADER(read,user-agent)}) ; Gets stuck here if AMI goes wrong, e.g. none connected.
same => n,Set(IAXVAR(route)=${ROUTE})
same => n,NoOp(${IAXVAR(route)})
same => n,GotoIf($["${DIALSTR}" = ""]?noRoute,${EXTEN},1)
same => n,Dial(${DIALSTR},60,U(onAnswer^${CALLID}))
exten => h,1,AGI(agi:async,hangup,${DIALSTATUS},${CDR(billsec)})
[noRoute]
exten => _X.,1,NoOP("No Dial String")
[onAnswer]
exten => s,1,AGI(agi:async,answer,${ARG1}) ; Also need a solution here in case all AMI clients disconnected.
same => n,Return()