heltonmarx / goami Goto Github PK
View Code? Open in Web Editor NEWAsterisk Manager Interface (AMI) client in Go
License: MIT License
Asterisk Manager Interface (AMI) client in Go
License: MIT License
I'm trying to use the lib I'm having this error asking to download the library but I've already downloaded it from github.com/heltonmarx/goami
While trying to use goami to collect metrics I noticed that the FAXStats and FAXSession(s) commands are not implemented, so I did that in PR: #19
Default github.com/heltonmarx/goami/ami use 1.0.0 version. Can you update release? How i can use latest version goami? Context in example not support in 1.0.0
In this function (
Line 81 in 1f049c2
You should add that if the id of the event received is not equals to the one you sent in the action then discard the event as a response to that specific action.
hi.
please add confbridge actions/events to this package.
I'm trying to connect with Asterisk AMI interface using goAMI. I am sequentially calling, connect, originate and logoff functions. All looks fine but i face strange behavior with logoff function.
If I call the script and call ami.logoff() function for first time it will return the nil value which seems fine. When I call the same script for the second time, this functions return expected.
res := ami.Logoff(socket, uuid)
if res == nil {
println("Logoff successful", res)
} else {
println("Logoff failed", res)
}
Output when calling the same script for two times.
$ go run main.go
Logoff successful (0x0,0x0)
$ go run main.go
Logoff failed (0x114ca00,0xc000012070)
Asterisk version: 11.25.3
OS: CentOS 7.4
the ami command UserEvent is not implemented.
I can add this feature if the maintainer accept
socket.Recv() does not ends after shutdown socket closed leading to infinite loop in read()
patch to solve:
diff -uwrd old/socket.go new/socket.go
--- old/socket.go 2017-10-11 15:06:17.553303464 +0300
+++ new/socket.go 2017-10-11 15:08:10.601014898 +0300
@@ -7,8 +7,11 @@
"net"
"strings"
"sync"
+ "errors"
)
+var ErrClosed = errors.New("socket closed")
+
// Socket holds the socket client connection data.
type Socket struct {
conn net.Conn
@@ -70,7 +73,7 @@
return buffer.String(), nil
}
case <-s.shutdown:
- return buffer.String(), nil
+ return buffer.String(), ErrClosed
}
}
}
Hello, whether support of pjsip is planned?
i got custom error with repo examples.
go run ....
login.go
2016/12/05 17:25:41 logoff error: (logout failed: Authentication accepted)
sippeers.go
login ok!
2016/12/05 17:39:21 sip peers error: failed on event PeerEntry:Authentication accepted
exit status 1
but events.go work fine
go1.7.3
Asterisk 13.6.0
Hello Helton. Sorry to open an issue, I really know its not a problem in the goami library, but I need your help, if you could, of course.
Im doing this code :
for {
queuesummary, err := ami.QueueSummary(socket, uuid, "default")
if err != nil {
log.Fatal("QueueSummary() ",err)
return
}
log.Println(queuesummary)
}
So In a very short time of this loop, I got my connection reseted by asterisk ami, but I didn't see nothing at asterisk logs.
The "err" is : 2017/04/19 02:35:57 QueueSummary() write tcp 000.000.000.000:48034->111.111.111.111:8426: write: connection reset by peer
exit status 1
Do you know something I could do to otimize my code avoiding this kind of situation?
Thank you.
When you receive an EOF
in the reader.ReadString('\n')
in run go routing in a Socket the s.Close()
is executed but after executing close(s.shutdown)
the is waiting for itself to end, that is never. This generates the go routing to get stack, generating, between other things, the TCP connection to get stack in CLOSE_WAIT
status.
The issue is simple to reproduce when you are allow to connect to the AMI but you have a wrong password for the given user.
I don't know why you add the waiting group here but I made tests without it and everything went alright.
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.