agi icon indicating copy to clipboard operation
agi copied to clipboard

Unable to get the Dialstatus value

Open iliesh opened this issue 3 years ago • 0 comments

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,

iliesh avatar Aug 23 '21 09:08 iliesh