0x19 / goesl Goto Github PK
View Code? Open in Web Editor NEWFreeswitch Event Socket Library wrapper for Go
Home Page: https://godoc.org/github.com/0x19/goesl
License: MIT License
Freeswitch Event Socket Library wrapper for Go
Home Page: https://godoc.org/github.com/0x19/goesl
License: MIT License
>go get github.com/0x19/goesl
# github.com/0x19/goesl
..\..\0x19\goesl\logger.go:26: too many arguments in call to log.Debug
..\..\0x19\goesl\logger.go:30: too many arguments in call to log.Error
..\..\0x19\goesl\logger.go:34: too many arguments in call to log.Notice
..\..\0x19\goesl\logger.go:38: too many arguments in call to log.Info
..\..\0x19\goesl\logger.go:42: too many arguments in call to log.Warning
goesl.NewClient(host, port, passwd, timeout)
has ERROR Expected auth/request content type. Got text/rude-rejection
goesl/client.go: 64,mistake here
if cmr.Get("Content-Type") != "auth/request" {
Error(EUnexpectedAuthHeader, cmr.Get("Content-Type"))
return fmt.Errorf(EUnexpectedAuthHeader, cmr.Get("Content-Type"))
}
system: centos 7.5
Sample code:
// Setup, connection handling, etc.
b := bytes.NewBufferString("event json DTMF\n")
b.WriteTo(conn)
// Some other code and then this runs in a goroutine for us
for {
msg, err := conn.ReadMessage()
// For JSON events this ends up being ""
msgType := msg.GetHeader("Content-Type")
switch msgType {
case "text/disconnect-notice":
done <- true
case "text/event-plain":
// assuming "event plain DTMF" is sent instead of JSON this will trigger
case "text/event-json":
// This will never trigger
}
//This is my current hack
if eventName, ok := msg.Headers["Event-Name"]; ok {
switch eventName {
case "DTMF":
logger.Errorf("DTMF: %s", msg.Headers["DTMF-Digit"])
}
}
}
Our current version of gesl:
revision = "1cd1251c682b6645e93bdc58ba48de5ed75fbd48"
version = "1.0"
Hello, how can i change the log level for messages?
example
16:49:30.498 Debug ▶ DEBUG Waiting for connection message to be received ...
I want to avoid debug messages, i want info and upper to critical, not debug messages.
thanks
Any one else seeing this when building a project that uses goesl?
vendor/github.com/0x19/goesl/logger.go:26:11: too many arguments in call to log.Debug
have (string, []interface {}...)
want (...interface {})
vendor/github.com/0x19/goesl/logger.go:30:11: too many arguments in call to log.Error
have (string, []interface {}...)
want (...interface {})
vendor/github.com/0x19/goesl/logger.go:34:12: too many arguments in call to log.Notice
have (string, []interface {}...)
want (...interface {})
vendor/github.com/0x19/goesl/logger.go:38:10: too many arguments in call to log.Info
have (string, []interface {}...)
want (...interface {})
vendor/github.com/0x19/goesl/logger.go:42:13: too many arguments in call to log.Warning
have (string, []interface {}...)
want (...interface {})
Alright, to do some background on this. This project was an idea of mine, while working in telecom sector in cpaas software as there were no golang based clients to interact with FS. At time, that sounded like a great idea to start the OS project. However, after some time, I've ditched pretty much whole telecom and moved to networking and lately into the blockchain.
Even tho explanation above is as-is, it's no excuse from me to have official Freeswitch docs linking to this repository which is old as hell and working to an extent in some basic prototype mode.
INSTEAD, I am now locking few hours a week to get this project working as it should be working.
Sorry for poor job of maintaining this repo. Lets sort this out and release sane version in upcoming months.
Best regards,
Nevio
Hello, i use the same code as your example server_playback but enable receiving events by calling conn.Send("events plain all").
but very often i get errors that are mostly Parse EOF. end if i select json format for event "event json all" i get unexpected end of json.
also sometimes I get malformed MIME info. overall this made it impossible to use for listening to events.
I tried to fork your work and change it but with no success, and because on any case of error you close connection, first error means server stops.
note that the server and client and configuration works perfectly fine with nodejs esl client.
what the hell this parse EOF means?
thanks in advance for yourhelp
it may seem naive, but i really do not know if the events are streamed per call (socketConnection) or all the events of all calls are received in every connection. I mean, if i want to listen to DTMF in calls, and have two simultaneous calls, if call A send 1 and call b send 2, is this the case that both calls receive both events? or every call receives it's related event (call A, 1 and call B, 2).
if the first is the case,isn't it a good idea to filter events for calls based on call_uuid and let pertinent calls have pertinent events?
Hi
I'm using this library to control calls using a client connection to freeswitch. Each call is parked in xml dialplan and on receiving park event my client application starts controlling the call by executing apps on channel using SendMsg. But if any app execution results in an error, for example calling execute on an already destroyed channel, whole esl socket is closed. Is there anyway to prevent such behaviour and continue receiving events?
thanks
Is there a way to just get a response back, like most clients implement sendRecv? For example executing and getting the response back from "api fifo count".
Thanks,
hello,i have a question.
does this contains readevent()?
if exists,how to use?
Hi,
https://github.com/0x19/goesl/blob/master/examples/server_playback.go
When I try this example on a Debian 8 box, the running process uses %100 cpu.
My go version is go1.5.1.
Thanks,
Hi,
I used the example code specified for the client connection, the origination of call went good, but after that the program gets crashed while listening to events(events json ALL), i am sure many have faced this issue, can somebody help me with this.
Regards
Abbasi
Hello,
I've encountered a peculiar issue with the GoESL package during automation of dialing through FreeSWITCH. After successfully originating 96 calls, no further calls are processed. The FreeSWITCH CLI does not log any additional attempts, yet when I terminate the Go application, all the queued calls are suddenly processed.
My Environment Details:
Issue Description:
My FreeSWITCH setup is configured to allow for 1,000 concurrent channels and 50 calls per second (CPS). Despite this, the system halts call processing after 96 calls. There are no errors or relevant logs in FreeSWITCH indicating why further calls are not being processed.
To rule out any conflicts with other packages, I created a minimal Go application with minimal dependencies. This application's sole function was to dial numbers to test the limits. The same issue occurred, which suggests that the problem is not related to other package dependencies.
A tcpdump on the server, filtered by my IP address, confirmed that the originate commands are reaching the server, but no further action is observed.
Steps to Reproduce:
Expected Behavior:
The GoESL client should continue to originate calls until it reaches the configured limits of FreeSWITCH or has no more dials left.
Actual Behavior:
The GoESL client stops originating calls after 96 attempts, with no further processing observed until the application is terminated.
Additional Information:
A Stack Overflow post with more context can be found here: https://stackoverflow.com/questions/77428926/goesl-with-temporal-calls-not-originating-past-certain-point-in-freeswitch/77450560#77450560
I would appreciate any guidance on further debugging steps or insights into what might be causing this behaviour.
golang 1.14.2 server_playback.go
playback is failed
package main
import (
"flag"
"fmt"
. "github.com/0x19/goesl"
"runtime"
//"strings"
)
var (
fshost = flag.String("fshost", "localhost", "Freeswitch hostname. Default: localhost")
fsport = flag.Uint("fsport", 8021, "Freeswitch port. Default: 8021")
password = flag.String("pass", "ClueCon", "Freeswitch password. Default: ClueCon")
timeout = flag.Int("timeout", 10, "Freeswitch conneciton timeout in seconds. Default: 10")
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
client, err := NewClient(*fshost, *fsport, *password, *timeout)
if err != nil {
Error("Error while creating new client: %s", err)
return
}
go client.Handle()
client.Send("events json ALL")
for {
msg, _ := client.ReadMessage()
fmt.Printf("Gt new message: %+v\n", msg)
}
}
break the flow and not received more messages
08:19:18.278 Debug ▶ DEBUG Waiting for connection message to be received ...
Gt new message:
08:19:18.278 Debug ▶ DEBUG Waiting for connection message to be received ...
Is this project still being maintained? Does it need personnel to join in? Maybe there is a bug found
type OutboundServer struct {
net.Listener
Addr string `json:"address"`
Proto string
Conns chan SocketConnection
}
Conns have lock ,but it from the chennel
Hi. client example falls after few events were received without any message. I tried plain/json. And i've done a lot manipulations but still cant succeed.
Actually I'm trying to rewrite my my app from https://github.com/fiorix/go-eventsocket. All is this app do is just listen events all time and resends some via websocket.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.