Comments (6)
Thank you very much for your help, translating the old project into golang, at the same time I'm studying the language
from amigo.
I think, need to add ConnectionID field to Settings and append it into every event. What do you think?
Also you can to do it in your code.
from amigo.
It would be great, but can enough append it into every event - Settings.Host, usually this is unique value.
from amigo.
You can do such this:
func DialBeginHandler(id int) func (map[string]string) {
return func(e map[string]string) {
// handling event and connection id
}
}
func main() {
for i, s := range conf.Asterisk {
settings := &amigo.Settings{Username: s.Login, Password: s.Password, Host: s.IP, Port: s.Port}
a := amigo.New(settings)
a.Connect()
a.RegisterHandler("DialBegin", DialBeginHandler(i))
}
}
Now in handler you can handle additional info — connection id. You can pass host, port or any other necessary info.
from amigo.
I think, it's enough to solve you task and no need to update amigo.
from amigo.
YES, this is a great solution, add to the examples
from amigo.
Related Issues (16)
- Not conected HOT 2
- Unexpected character encoding HOT 5
- Setting an event's "Time" received overwrites the "Time" field in some events HOT 1
- Disconnect function HOT 2
- Not connecting to the AMI Server HOT 3
- Response data missing for 'Action: Command' HOT 2
- Possibility to turn off infinite Connect() retry (enhancement suggestion) HOT 1
- Action: Command doesn't contain all response
- Got error "events chan is full" in high traffic
- cannot use DeviceStateChangeHandler (type func(amigo.M)) as type amigo.handlerFunc in argument to a.RegisterHandler HOT 3
- Possible error in ami.go HOT 1
- very small Action timeout in constant HOT 2
- Channel events may come out of order HOT 2
- Unexpected Properties In Events HOT 1
- Timeout in command's long response HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amigo.