All Projects → CyCoreSystems → agi

CyCoreSystems / agi

Licence: Apache-2.0 License
Asterisk AGI library for Go (golang)

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Asterisk AGI library for Go (golang)

Build Status

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.

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:

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()
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].