# README
goesl
FreeSWITCH™ Event Socket Library written in Go.
goesl was written base on:
Before writing this library, I was still working quite smoothly with 0x19/goesl and also used percipia/eslgo but there were a few small problems that both of them could not solve, so I had to adjust tweak it a bit.
Install
go get github.com/luandnh/goesl
Examples
Inbound ESL Client
package main
import (
"context"
"fmt"
"github.com/luandnh/goesl"
"time"
log "github.com/sirupsen/logrus"
)
func main() {
client, err := goesl.NewClient("127.0.0.1", 8021, "ClueCon", 10)
if err != nil {
fmt.Println("Error connecting", err)
return
}
defer client.ExitAndClose()
raw, err := client.Send("api sofia status")
if err != nil {
panic(err)
}
log.Info(string(raw.Body))
time.Sleep(60 * time.Second)
err = client.SendAsync("event json CHANNEL_CREATE CHANNEL_ANSWER CHANNEL_HANGUP_COMPLETE CHANNEL_PROGRESS_MEDIA")
if err != nil {
panic(err)
}
for {
msg, err := client.ReadMessage()
if err != nil {
if !strings.Contains(err.Error(), "EOF") && err.Error() != "unexpected end of JSON input" {
log.Error("Error while reading Freeswitch message : ", err)
}
continue
}
msgBytes, err := json.Marshal(msg)
if err != nil {
log.Error("marshal json error : ",err)
}
log.Info(string(msgBytes))
}
}
# Packages
No description provided by the author
# Functions
No description provided by the author
NewClient - Init new client connection, this will establish connection and attempt to authenticate against connected freeswitch server.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
for event.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
DefaultOptions - The default options used for creating the connection.
No description provided by the author
# Structs
Client - Used to create an inbound connection to Freeswitch server In order to originate call, transfer, or something amazing ...
ESLConnection.
No description provided by the author
No description provided by the author
No description provided by the author
Options - Generic options for an ESL connection, either inbound or outbound.
# Interfaces
No description provided by the author