agi
agi copied to clipboard
Unable to get the Dialstatus value
Trying to get the dialstatus value for the Dial command by using the following code:
func main() {
agi.Listen(":4753", handler)
}
func handler(a *agi.AGI) {
defer a.Close()
a.Exec("Dial", "PJSIP/I11")
dStatus, err := a.Get("DIALSTATUS")
if err != nil {
fmt.Printf("unable to get the dialstatus variable, error: %s\n", err.Error())
}
fmt.Printf("Dial Status: %v\n", dStatus)
}
Here I'm calling ext 11 and just before answering the call, I'm dropping it and expecting to get the "NOANSWER" status, but I'm getting an error:
'unable to get the dialstatus variable, error: hangup'
I believe that this is because Asterisk is sending hangup first, and then the Dial Status.
Regards,