Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( // StatusOK indicates operation was completed successfully. StatusOK = 200 // StatusInvalid indicates invalid or unknown command. StatusInvalid = 510 // StatusDeadChannel indicates the command cant be executed on a dead (closed, terminated, hung up) channel. StatusDeadChannel = 511 // StatusEndUsage indicates end of proper usage, when the command returns its syntax. StatusEndUsage = 520 )
Variables ¶
This section is empty.
Functions ¶
func Listen ¶
func Listen(addr string, handler HandlerFunc) error
Listen binds an AGI HandlerFunc to the given TCP `host:port` address, creating a FastAGI service.
func Run ¶
func Run(handler HandlerFunc)
Example ¶
package main
import (
"github.com/ezdev128/astgo/agi"
)
func main() {
agi.Run(func(session *agi.Session) {
client := session.Client()
client.Answer()
client.StreamFile("activated", "#")
client.SetVariable("AGISTATUS", "SUCCESS")
client.Hangup()
})
}
Types ¶
type ConfEnv ¶
type ConfEnv struct {
ConfigDir string
ConfigFile string
ModuleDir string
SpoolDir string
MonitorDir string
VarDir string
DataDir string
LogDir string
AGIDir string
KeyDir string
RunDir string
}
func LoadConfEnv ¶
func LoadConfEnv() ConfEnv
type HandlerFunc ¶
type HandlerFunc func(session *Session)
type RequestVariable ¶
type RequestVariable struct {
Request string
Channel string
Language string
Type string
UniqueID string
Version string
CallerID string
CallerIDName string
CallingPres int // presentation of callerid
CallingAni2 int
CallingTon int // ast_channel_caller(chan)->id.number.plan
CallingTns int // ast_channel_dialed(chan)->transit_network_select)
DNID string // ast_channel_dialed(chan)->number.str
RDNIS string // ast_channel_redirecting(chan)->from.number.valid, ast_channel_redirecting(chan)->from.number.str
Context string
Extension string
Priority int
Enhanced bool
AccountCode string
ThreadID int
Args []string
}
func (*RequestVariable) Load ¶
func (rc *RequestVariable) Load(m map[string]string)
type Response ¶
type Response struct {
Error error // Error received, if any
Status int // HTTP-style status code received
Result int // Result is the numerical return (if parseable)
ResultString string // Result value as a string
Value string // Value is the (optional) string value returned
}
func ParseResponse ¶
type Session ¶
func NewSession ¶
func (*Session) RequestVariable ¶
func (a *Session) RequestVariable() *RequestVariable
Click to show internal directories.
Click to hide internal directories.