https://github.com/cycoresystems/agi
Asterisk AGI library for Go (golang)
https://github.com/cycoresystems/agi
Last synced: 8 months ago
JSON representation
Asterisk AGI library for Go (golang)
- Host: GitHub
- URL: https://github.com/cycoresystems/agi
- Owner: CyCoreSystems
- License: apache-2.0
- Created: 2016-11-20T04:14:50.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-04-02T14:24:51.000Z (about 1 year ago)
- Last Synced: 2025-04-05T17:12:50.099Z (about 1 year ago)
- Language: Go
- Size: 26.4 KB
- Stars: 50
- Watchers: 4
- Forks: 33
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Asterisk AGI library for Go (golang)
[](https://travis-ci.org/CyCoreSystems/agi) [](http://godoc.org/github.com/CyCoreSystems/agi)
This is an Asterisk AGI interface library which may be used for both classical
AGI, with a standalone executable, or FastAGI, with a TCP server.
```go
package main
import "github.com/CyCoreSystems/agi"
func main() {
a := agi.NewStdio()
a.Answer()
err := a.Set("MYVAR", "foo")
if err != nil {
panic("failed to set variable MYVAR")
}
a.Hangup()
}
```
## Standalone AGI executable
Use `agi.NewStdio()` to get an AGI reference when running a standalone
executable.
For a TCP server, register a HandlerFunc to a TCP port:
```go
package main
import "github.com/CyCoreSystems/agi"
func main() {
agi.Listen(":8080", handler)
}
func handler(a *agi.AGI) {
defer a.Close()
a.Answer()
err := a.Set("MYVAR", "foo")
if err != nil {
panic("failed to set variable MYVAR")
}
a.Hangup()
}
```