S
S
Sergey2017-08-21 18:16:36
go
Sergey, 2017-08-21 18:16:36

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()
}

can you suggest what could be

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2017-08-21
@Kle6800

https://github.com/fiorix/go-eventsocket/issues/4
Friswitch version 1.4 bug

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question