I'm having a really hard time figuring out if there is a trigger or a way to continue from the Dial action that allows you to detect if the call is answered. It seems like Dial doesn't respond until hangup, busy, or congested. What action or event am I missing that would tell me when the other end of the line actually answers the call? Hoping there is something like this available that I'm just missing:
exten => s,7,Dial(${ARG1},20,rt) ; Ring the interface, 20 seconds maximum
exten => s,8,Goto(s-${DIALSTATUS},1)
; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-ANSWER(do something)
Finally figured it out. It involves calling the M flag in the Dial action call. By calling the M flag, you can call a custom macro that will execute immediately after the call is connected/answered.
Ex: Dial(SIP/200,60,M(myCustomMacro))
Hope this helps for any that were also curious.