Answer the question
In order to leave comments, you need to log in
json error: cannot unmarshal array into Go value of type string?
Error when executing code
package main
import (
"fmt"
"log"
"github.com/fiorix/go-eventsocket/eventsocket"
)
const dest = "sofia/internal/300%test.fs"
const dialplan = "&socket(localhost:9090 async)"
func main() {
c, err := eventsocket.Dial("localhost:8021", "ClueCon")
if err != nil {
log.Fatal(err)
}
c.Send("events json ALL")
c.Send(fmt.Sprintf("bgapi originate %s %s", dest, dialplan))
for {
ev, err := c.ReadEvent()
if err != nil {
log.Fatal(err)
}
fmt.Println("\nNew event")
ev.PrettyPrint()
if ev.Get("Answer-State") == "hangup" {
break
}
}
c.Close()
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question