Skip to content

xulei8/agi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AGI library

Golang Asterisk AGI library

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()
}

About

Asterisk AGI library for Go (golang)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%