S
S
Sergey2017-08-22 22:07:25
FreeSWITCH
Sergey, 2017-08-22 22:07:25

Session reset when using ESL?

Can you suggest that the session drops when using ESL
. The call to the user 303 comes but is immediately reset

package main

import (
  "fmt"
  "log"
  "github.com/fiorix/go-eventsocket/eventsocket"
  "github.com/satori/go.uuid"
)


var welcomeFile = "/usr/local/freeswitch/sounds/24Broadcaster.wav"
const dest = "sofia/internal/303%test.fs"
const dialplan = "&socket(localhost:9090 async)"

func answer (ac *eventsocket.Connection,uuid string) {
  ac.Execute("answer", "", false)
  fmt.Println(uuid)
  //ac.Execute("playback", welcomeFile, true)
  ac.Execute("playback", welcomeFile, false);
  fmt.Println(uuid,"клиент сессия ")
}
func main() {
  c, err := eventsocket.Dial("localhost:8021", "ClueCon")
  if err != nil {
    log.Fatal(err)
  }
  c.Send("connect")
  c.Send("myevents")
  c.Send("events plain ALL")
  u := uuid.NewV1()
  uuid := u.String()
  c.Send(fmt.Sprintf("bgapi originate %s %s", dest, dialplan))
  for {
    ev, err := c.ReadEvent()
    if err != nil {
      //log.Fatal(err)
      return
    }
    ev.PrettyPrint()
    var hangup_cause string
    if ev.Get("Event-Name") == "CHANNEL_ANSWER" {
      fmt.Println("Клиент ответил")
       go answer(c,uuid);
      return
    } else if ev.Get("Answer-State") == "hangup" {
      hangup_cause = ev.Get("Hangup-Cause")
      fmt.Println(hangup_cause,"done")
      return
    }
  }
  c.Close()
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2017-08-23
@rostel

func answer - this is done on the server or dialplan, not the client
see client and server examples from here
https://github.com/fiorix/go-eventsocket/tree/mast...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question