golang esl api

时间:2022-02-04 12:26:07

通过ESL 调取FS的状态,比如show calls : 用golang  eventsocket 实现

conn, err := eventsocket.Dial("192.168.5.32:8021","ClueCon")
if err != nil {
  this.emitError(so, 413)
  return ""
}
ev, _ := conn.Send(fmt.Sprintf("api show calls"))
calls := strings.Split(ev.Body, "\n")
for i := 1; i < len(calls)-3; i++ {
  //处理每一条记录

  }