pax_global_header 0000666 0000000 0000000 00000000064 14650613361 0014517 g ustar 00root root 0000000 0000000 52 comment=3cfdeb5ff6d024aa7fbcf68c1711eaea03d03d3c
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ 0000775 0000000 0000000 00000000000 14650613361 0021460 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/.editorconfig 0000664 0000000 0000000 00000000335 14650613361 0024136 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab
indent_size = 4
[*.go]
indent_style = tab
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/.github/ 0000775 0000000 0000000 00000000000 14650613361 0023020 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/.github/workflows/ 0000775 0000000 0000000 00000000000 14650613361 0025055 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/.github/workflows/ci.yml 0000664 0000000 0000000 00000000576 14650613361 0026203 0 ustar 00root root 0000000 0000000 name: Test and coverage
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/setup-go@v2
with:
go-version: '1.16'
- name: Run CI
run: make ci
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v1
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/.gitignore 0000664 0000000 0000000 00000002674 14650613361 0023461 0 ustar 00root root 0000000 0000000 # Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Go template
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
*.log
ignored
.idea
.cache
dist
.DS_Store
ignored*
*ignored_test.go
bin/
/sparkle.yaml
*.local
*.sqlite3
*.sqlite
*.db
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/.golangci.yml 0000664 0000000 0000000 00000002174 14650613361 0024050 0 ustar 00root root 0000000 0000000 run:
skip-dirs-use-default: true
skip-dirs:
- vendor
- ent
- graph
skip-files:
- ".*\\.peg\\.go$"
- ".*ignored_.*.go$"
- "generated.go$"
- model_gen.go
linters:
disable-all: true
enable:
- bodyclose
- depguard
- dogsled
- dupl
- funlen
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- gomnd
- gosec
# - interfacer
- misspell
- unconvert
# default
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
linters-settings:
dupl:
threshold: 100
funlen:
lines: 100
statements: 60
depguard:
list-type: blacklist
packages:
- golang.org/x/net/context
- github.com/sirupsen/logrus
- github.com/prometheus/common/log
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/LICENSE 0000664 0000000 0000000 00000026135 14650613361 0022474 0 ustar 00root root 0000000 0000000
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/Makefile 0000664 0000000 0000000 00000000606 14650613361 0023122 0 ustar 00root root 0000000 0000000
love:
fmt:
gofmt -w `find . -type f -name '*.go' -not -path "./vendor/*"`
goimports -w `find . -type f -name '*.go' -not -path "./vendor/*"`
lint:
golangci-lint run
ci: cover
[ -z "$(CODECOV_TOKEN)" ] || bash -c 'bash <(curl -s https://codecov.io/bash)'
.PHONY: cover
cover:
go test -race -coverprofile=cover.out -coverpkg=./... ./...
go tool cover -html=cover.out -o cover.html
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/README.md 0000664 0000000 0000000 00000004050 14650613361 0022736 0 ustar 00root root 0000000 0000000 # Asterisk to Go [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][report-card-img]][report-card]
Libs for Golang to work with Asterisk
* AMI
* AGI
[doc-img]: http://img.shields.io/badge/GoDoc-Reference-blue.svg
[doc]: https://pkg.go.dev/github.com/wenerme/astgo
[ci-img]: https://github.com/wenerme/astgo/actions/workflows/ci.yml/badge.svg
[ci]: https://github.com/wenerme/astgo/actions/workflows/ci.yml
[cov-img]: https://codecov.io/gh/wenerme/astgo/branch/master/graph/badge.svg
[cov]: https://codecov.io/gh/wenerme/astgo/branch/master
[report-card-img]: https://goreportcard.com/badge/github.com/wenerme/astgo
[report-card]: https://goreportcard.com/report/github.com/wenerme/astgo
## AMI
* Async Action
* Sync Action
* Event Subscribe
* Auto Reconnect
* Generated Action with document
* Generated Event with document
* Generated Client - Action -> Response
```go
package main
import (
"context"
"fmt"
"github.com/wenerme/astgo/ami"
)
func main() {
boot := make(chan *ami.Message, 1)
conn, err := ami.Connect(
"192.168.1.1:5038",
ami.WithAuth("admin", "admin"), // AMI auth
// add predefined subscriber
ami.WithSubscribe(ami.SubscribeFullyBootedChanOnce(boot)),
ami.WithSubscribe(func(ctx context.Context, msg *ami.Message) bool {
fmt.Println(msg.Format()) // log everything
return true // keep subscribe
}, ami.SubscribeSend(), // subscribe send message - default recv only
))
if err != nil {
panic(err)
}
<-boot
// AMI now FullyBooted
_ = conn
}
```
## AGI
* FastAGI
* AGI Bin
* Generated Command
* Generated Client
```go
package main
import (
"github.com/wenerme/astgo/agi"
)
func main() {
// agi.Listen for FastAGI
agi.Run(func(session *agi.Session) {
client := session.Client()
client.Answer()
client.StreamFile("activated", "#")
client.SetVariable("AGISTATUS", "SUCCESS")
client.Hangup()
})
}
```
## Asterisk Database Model
* GORM Based Model
## Roadmap
* [-] Asterisk Database Model
* [ ] Stasis
* [ ] ARI
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/ 0000775 0000000 0000000 00000000000 14650613361 0022220 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/README.md 0000664 0000000 0000000 00000000307 14650613361 0023477 0 ustar 00root root 0000000 0000000 # AGI
- [handle_connection](https://github.com/asterisk/asterisk/blob/master/res/res_agi.c#L2012)
- FastAGI defaults port 4573
# See also
- [CyCoreSystems/agi](https://github.com/CyCoreSystems/agi)
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agi.go 0000664 0000000 0000000 00000014612 14650613361 0023313 0 ustar 00root root 0000000 0000000 package agi
import (
"bufio"
"context"
"io"
"net"
"sort"
"strconv"
"strings"
"github.com/pkg/errors"
"github.com/wenerme/astgo/agi/agimodels"
"go.uber.org/zap"
)
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
)
type Request struct {
}
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
}
// Res returns the ResultString of a Response, as well as any error encountered. Depending on the command, this is sometimes more useful than Val()
func (r *Response) Res() (string, error) {
return r.ResultString, r.Error
}
// Err returns the error value from the response
func (r *Response) Err() error {
return r.Error
}
// Val returns the response value and error
func (r *Response) Val() (string, error) {
return r.Value, r.Error
}
type Session struct {
Variables map[string]string
r io.Reader
w io.Writer
ctx context.Context
conn net.Conn
}
type HandlerFunc func(session *Session)
func NewSession(c context.Context, r io.Reader, w io.Writer, conn net.Conn) (*Session, error) {
session := &Session{
ctx: c,
r: r,
w: w,
conn: conn,
Variables: make(map[string]string),
}
return session, session.scanVariables()
}
func (a *Session) scanVariables() error {
s := bufio.NewScanner(a.r)
for s.Scan() {
if s.Text() == "" {
break
}
terms := strings.SplitN(s.Text(), ":", 2)
if len(terms) == 2 {
a.Variables[strings.TrimSpace(terms[0])] = strings.TrimSpace(terms[1])
}
}
return s.Err()
}
// Close closes any network connection associated with the AGI instance
func (a *Session) Close() (err error) {
if a.conn != nil {
err = a.conn.Close()
a.conn = nil
}
return
}
func ParseResponse(s string) *Response {
sp := strings.SplitN(s, " ", 3)
if len(sp) < 2 {
return &Response{
Error: errors.Errorf("invalid response: %q", s),
}
}
r := &Response{}
r.Status, r.Error = strconv.Atoi(sp[0])
r.ResultString = sp[1][len("result="):]
r.Result, _ = strconv.Atoi(r.ResultString)
if len(sp) == 3 {
r.Value = sp[2]
}
if r.Status != 200 {
r.Error = errors.Errorf("status %v result %v extra %v", r.Status, r.ResultString, r.Value)
}
return r
}
func (a *Session) Command(cmd string) *Response {
_, err := a.w.Write([]byte(cmd + "\n"))
r := &Response{Error: err}
if err != nil {
return r
}
s := bufio.NewScanner(a.r)
if s.Scan() {
return ParseResponse(s.Text())
}
return r
}
func (a *Session) Client() *agimodels.Client {
return &agimodels.Client{
Handler: agimodels.HandlerFunc(func(cmd agimodels.Command) agimodels.Response {
command, err := cmd.Command()
if err != nil {
return &Response{
Error: err,
}
}
return a.Command(command)
}),
}
}
func (a *Session) RequestVariable() *RequestVariable {
rc := &RequestVariable{}
rc.Load(a.Variables)
return rc
}
// Listen binds an AGI HandlerFunc to the given TCP `host:port` address, creating a FastAGI service.
func Listen(addr string, handler HandlerFunc) error {
if addr == "" {
addr = "0.0.0.0:4573"
}
l, err := net.Listen("tcp", addr)
if err != nil {
return errors.Wrap(err, "failed to bind server")
}
defer l.Close() // nolint: errcheck
for {
conn, err := l.Accept()
if err != nil {
return errors.Wrap(err, "failed to accept TCP connection")
}
session, err := NewSession(nil, conn, conn, conn)
if err != nil {
return errors.Wrap(err, "failed init session")
}
go func() {
defer session.Close()
handler(session)
}()
}
}
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 (rc *RequestVariable) Load(m map[string]string) {
var args []struct {
i int
v string
}
for k, v := range m {
if !strings.HasPrefix(k, "agi_") {
continue
}
name := k[4:]
if strings.HasPrefix(name, "arg_") {
i, err := strconv.Atoi(name[4:])
if err != nil {
//return errors.Wrapf(err, "invalid arg %v", name)
zap.S().With("arg", name).Warn("skip invalid request arg")
}
args = append(args, struct {
i int
v string
}{i: i, v: v})
continue
}
if v == "unknown" {
continue
}
var err error
switch name {
case "request":
rc.Request = v
case "channel":
rc.Channel = v
case "language":
rc.Language = v
case "type":
rc.Type = v
case "uniqueid":
rc.UniqueID = v
case "version":
rc.Version = v
case "callerid":
rc.CallerID = v
case "calleridname":
rc.CallerIDName = v
case "callingpres":
rc.CallingPres, err = strconv.Atoi(v)
case "callingani2":
rc.CallingAni2, err = strconv.Atoi(v)
case "callington":
rc.CallingTon, err = strconv.Atoi(v)
case "callingtns":
rc.CallingTns, err = strconv.Atoi(v)
case "dnid":
rc.DNID = v
case "rdnis":
rc.RDNIS = v
case "context":
rc.Context = v
case "extension":
rc.Extension = v
case "priority":
rc.Priority, err = strconv.Atoi(v)
case "enhanced":
rc.Enhanced = v == "1.0"
case "accountcode":
rc.AccountCode = v
case "threadid":
rc.ThreadID, err = strconv.Atoi(v)
}
if err != nil {
zap.S().With("err", err, "name", k, "value", v).Warn("failed to handle request variable")
}
}
sort.Slice(args, func(i, j int) bool {
return args[i].i < args[j].i
})
for _, v := range args {
rc.Args = append(rc.Args, v.v)
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agi_bin.go 0000664 0000000 0000000 00000002020 14650613361 0024131 0 ustar 00root root 0000000 0000000 package agi
import (
"context"
"os"
"go.uber.org/zap"
)
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() ConfEnv {
env := func(s string) string {
v, _ := os.LookupEnv(s)
return v
}
return ConfEnv{
ConfigDir: env("AST_CONFIG_DIR"),
ConfigFile: env("AST_CONFIG_FILE"),
ModuleDir: env("AST_MODULE_DIR"),
SpoolDir: env("AST_SPOOL_DIR"),
MonitorDir: env("AST_MONITOR_DIR"),
VarDir: env("AST_VAR_DIR"),
DataDir: env("AST_DATA_DIR"),
LogDir: env("AST_LOG_DIR"),
AGIDir: env("AST_AGI_DIR"),
KeyDir: env("AST_KEY_DIR"),
RunDir: env("AST_RUN_DIR"),
}
}
func Run(handler HandlerFunc) {
ctx := context.Background()
session, err := NewSession(ctx, os.Stdin, os.Stdout, nil)
if err != nil {
zap.S().With("err", err).Error("init session failed")
os.Exit(1)
}
handler(session)
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agi_demo_test.go 0000664 0000000 0000000 00000000415 14650613361 0025352 0 ustar 00root root 0000000 0000000 package agi_test
import "github.com/wenerme/astgo/agi"
func ExampleRun() {
agi.Run(func(session *agi.Session) {
client := session.Client()
client.Answer()
client.StreamFile("activated", "#")
client.SetVariable("AGISTATUS", "SUCCESS")
client.Hangup()
})
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agi_test.go 0000664 0000000 0000000 00000000653 14650613361 0024352 0 ustar 00root root 0000000 0000000 package agi
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseResponse(t *testing.T) {
for _, test := range []struct {
L string
R Response
}{
{L: "200 result=1", R: Response{Status: 200, Result: 1, ResultString: "1"}},
{L: "200 result=0 endpos=8640", R: Response{Status: 200, Result: 0, ResultString: "0", Value: "endpos=8640"}},
} {
assert.Equal(t, &test.R, ParseResponse(test.L))
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agimodels/ 0000775 0000000 0000000 00000000000 14650613361 0024164 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agimodels/command_test.go 0000664 0000000 0000000 00000001037 14650613361 0027171 0 ustar 00root root 0000000 0000000 package agimodels
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuild(t *testing.T) {
for _, test := range []struct {
S string
C Command
}{
{S: "HANGUP 16", C: HangupCommand{}.SetChannelName("16")},
{S: "CONTROL STREAM FILE fn #", C: ControlStreamFileCommand{FileName: "fn", EscapeDigits: "#"}},
{S: "CONTROL STREAM FILE fn #", C: ControlStreamFileCommand{FileName: "fn", EscapeDigits: "#"}.SetPausechr("Abc")},
} {
s, err := test.C.Command()
assert.NoError(t, err)
assert.Equal(t, test.S, s)
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agimodels/commands.go 0000664 0000000 0000000 00000107554 14650613361 0026330 0 ustar 00root root 0000000 0000000 // Code generated by xmlgen. DO NOT EDIT.
package agimodels
// GosubCommand Cause the channel to execute the specified dialplan subroutine.
//
// Cause the channel to execute the specified dialplan subroutine, returning to the dialplan with execution of a Return().
type GosubCommand struct {
Context string
Extension string
Priority int
OptionalArgument *string
}
func (cmd GosubCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Context, cmd.Extension, cmd.Priority, cmd.OptionalArgument}
return joinCommand(s), nil
}
func (cmd GosubCommand) CommandString() string {
return "GOSUB"
}
func (cmd GosubCommand) SetOptionalArgument(v string) GosubCommand {
cmd.OptionalArgument = &v
return cmd
}
func (c *Client) Gosub(context string, extension string, priority int) Response {
return c.Handler.Command(GosubCommand{
Context: context,
Extension: extension,
Priority: priority,
})
}
// AnswerCommand Answer channel
//
// Answers channel if not already in answer state. Returns `-1` on channel failure, or `0` if successful.
type AnswerCommand struct {
}
func (cmd AnswerCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString()}
return joinCommand(s), nil
}
func (cmd AnswerCommand) CommandString() string {
return "ANSWER"
}
func (c *Client) Answer() Response {
return c.Handler.Command(AnswerCommand{})
}
// AsyncAGIBreakCommand Interrupts Async AGI
//
// Interrupts expected flow of Async AGI commands and returns control to previous source (typically, the PBX dialplan).
type AsyncAGIBreakCommand struct {
}
func (cmd AsyncAGIBreakCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString()}
return joinCommand(s), nil
}
func (cmd AsyncAGIBreakCommand) CommandString() string {
return "ASYNCAGI BREAK"
}
func (c *Client) AsyncAGIBreak() Response {
return c.Handler.Command(AsyncAGIBreakCommand{})
}
// ChannelStatusCommand Returns status of the connected channel.
//
// Returns the status of the specified channelname . If no channel name is given then returns the status of the current channel.
//
// Return values:
type ChannelStatusCommand struct {
ChannelName *string
}
func (cmd ChannelStatusCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.ChannelName}
return joinCommand(s), nil
}
func (cmd ChannelStatusCommand) CommandString() string {
return "CHANNEL STATUS"
}
func (cmd ChannelStatusCommand) SetChannelName(v string) ChannelStatusCommand {
cmd.ChannelName = &v
return cmd
}
func (c *Client) ChannelStatus() Response {
return c.Handler.Command(ChannelStatusCommand{})
}
// ControlStreamFileCommand Sends audio file on channel and allows the listener to control the stream.
//
// Send the given file, allowing playback to be controlled by the given digits, if any. Use double quotes for the digits if you wish none to be permitted. If offsetms is provided then the audio will seek to offsetms before play starts. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or `-1` on error or if the channel was disconnected. Returns the position where playback was terminated as endpos.
//
// It sets the following channel variables upon completion:
type ControlStreamFileCommand struct {
// FileName The file extension must not be included in the filename.
FileName string
EscapeDigits string
SkipMS *int
Ffchar *string // default to #
Rewchr *string // default to *
Pausechr *string
// OffsetMS Offset, in milliseconds, to start the audio playback
OffsetMS *int
}
func (cmd ControlStreamFileCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.EscapeDigits, cmd.SkipMS, cmd.Ffchar, cmd.Rewchr, cmd.Pausechr, cmd.OffsetMS}
return joinCommand(s), nil
}
func (cmd ControlStreamFileCommand) CommandString() string {
return "CONTROL STREAM FILE"
}
func (cmd ControlStreamFileCommand) SetSkipMS(v int) ControlStreamFileCommand {
cmd.SkipMS = &v
return cmd
}
func (cmd ControlStreamFileCommand) SetFfchar(v string) ControlStreamFileCommand {
cmd.Ffchar = &v
return cmd
}
func (cmd ControlStreamFileCommand) SetRewchr(v string) ControlStreamFileCommand {
cmd.Rewchr = &v
return cmd
}
func (cmd ControlStreamFileCommand) SetPausechr(v string) ControlStreamFileCommand {
cmd.Pausechr = &v
return cmd
}
func (cmd ControlStreamFileCommand) SetOffsetMS(v int) ControlStreamFileCommand {
cmd.OffsetMS = &v
return cmd
}
func (c *Client) ControlStreamFile(fileName string, escapeDigits string) Response {
return c.Handler.Command(ControlStreamFileCommand{
FileName: fileName,
EscapeDigits: escapeDigits,
})
}
// DatabaseDelCommand Removes database key/value
//
// Deletes an entry in the Asterisk database for a given family and key .
//
// Returns `1` if successful, `0` otherwise.
type DatabaseDelCommand struct {
Family string
Key string
}
func (cmd DatabaseDelCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Family, cmd.Key}
return joinCommand(s), nil
}
func (cmd DatabaseDelCommand) CommandString() string {
return "DATABASE DEL"
}
func (c *Client) DatabaseDel(family string, key string) Response {
return c.Handler.Command(DatabaseDelCommand{
Family: family,
Key: key,
})
}
// DatabaseDelTreeCommand Removes database keytree/value
//
// Deletes a family or specific keytree within a family in the Asterisk database.
//
// Returns `1` if successful, `0` otherwise.
type DatabaseDelTreeCommand struct {
Family string
KeyTree *string
}
func (cmd DatabaseDelTreeCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Family, cmd.KeyTree}
return joinCommand(s), nil
}
func (cmd DatabaseDelTreeCommand) CommandString() string {
return "DATABASE DELTREE"
}
func (cmd DatabaseDelTreeCommand) SetKeyTree(v string) DatabaseDelTreeCommand {
cmd.KeyTree = &v
return cmd
}
func (c *Client) DatabaseDelTree(family string) Response {
return c.Handler.Command(DatabaseDelTreeCommand{
Family: family,
})
}
// DatabaseGetCommand Gets database value
//
// Retrieves an entry in the Asterisk database for a given family and key .
//
// Returns `0` if key is not set. Returns `1` if key is set and returns the variable in parenthesis.
//
// Example return code: 200 result=1 (testvariable)
type DatabaseGetCommand struct {
Family string
Key string
}
func (cmd DatabaseGetCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Family, cmd.Key}
return joinCommand(s), nil
}
func (cmd DatabaseGetCommand) CommandString() string {
return "DATABASE GET"
}
func (c *Client) DatabaseGet(family string, key string) Response {
return c.Handler.Command(DatabaseGetCommand{
Family: family,
Key: key,
})
}
// DatabasePutCommand Adds/updates database value
//
// Adds or updates an entry in the Asterisk database for a given family , key , and value .
//
// Returns `1` if successful, `0` otherwise.
type DatabasePutCommand struct {
Family string
Key string
Value string
}
func (cmd DatabasePutCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Family, cmd.Key, cmd.Value}
return joinCommand(s), nil
}
func (cmd DatabasePutCommand) CommandString() string {
return "DATABASE PUT"
}
func (c *Client) DatabasePut(family string, key string, value string) Response {
return c.Handler.Command(DatabasePutCommand{
Family: family,
Key: key,
Value: value,
})
}
// ExecCommand Executes a given Application
//
// Executes application with given options .
//
// Returns whatever the application returns, or `-2` on failure to find application .
type ExecCommand struct {
Application string
Options string
}
func (cmd ExecCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Application, cmd.Options}
return joinCommand(s), nil
}
func (cmd ExecCommand) CommandString() string {
return "EXEC"
}
func (c *Client) Exec(application string, options string) Response {
return c.Handler.Command(ExecCommand{
Application: application,
Options: options,
})
}
// GetDataCommand Prompts for DTMF on a channel
//
// Stream the given file , and receive DTMF data.
//
// Returns the digits received from the channel at the other end.
type GetDataCommand struct {
File string
Timeout *int
Maxdigits *string
}
func (cmd GetDataCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.File, cmd.Timeout, cmd.Maxdigits}
return joinCommand(s), nil
}
func (cmd GetDataCommand) CommandString() string {
return "GET DATA"
}
func (cmd GetDataCommand) SetTimeout(v int) GetDataCommand {
cmd.Timeout = &v
return cmd
}
func (cmd GetDataCommand) SetMaxdigits(v string) GetDataCommand {
cmd.Maxdigits = &v
return cmd
}
func (c *Client) GetData(file string) Response {
return c.Handler.Command(GetDataCommand{
File: file,
})
}
// GetFullVariableCommand Evaluates a channel expression
//
// Evaluates the given expression against the channel specified by channelname , or the current channel if channelname is not provided.
//
// Unlike GET VARIABLE, the expression is processed in a manner similar to dialplan evaluation, allowing complex and built-in variables to be accessed, e.g. `The time is ${EPOCH} `
//
// Returns `0` if no channel matching channelname exists, `1` otherwise.
//
// Example return code: 200 result=1 (The time is 1578493800)
type GetFullVariableCommand struct {
Expression string
ChannelName *string
}
func (cmd GetFullVariableCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Expression, cmd.ChannelName}
return joinCommand(s), nil
}
func (cmd GetFullVariableCommand) CommandString() string {
return "GET FULL VARIABLE"
}
func (cmd GetFullVariableCommand) SetChannelName(v string) GetFullVariableCommand {
cmd.ChannelName = &v
return cmd
}
func (c *Client) GetFullVariable(expression string) Response {
return c.Handler.Command(GetFullVariableCommand{
Expression: expression,
})
}
// GetOptionCommand Stream file, prompt for DTMF, with timeout.
//
// Behaves similar to STREAM FILE but used with a timeout option.
type GetOptionCommand struct {
FileName string
EscapeDigits string
Timeout *int
}
func (cmd GetOptionCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.EscapeDigits, cmd.Timeout}
return joinCommand(s), nil
}
func (cmd GetOptionCommand) CommandString() string {
return "GET OPTION"
}
func (cmd GetOptionCommand) SetTimeout(v int) GetOptionCommand {
cmd.Timeout = &v
return cmd
}
func (c *Client) GetOption(fileName string, escapeDigits string) Response {
return c.Handler.Command(GetOptionCommand{
FileName: fileName,
EscapeDigits: escapeDigits,
})
}
// GetVariableCommand Gets a channel variable.
//
// Returns `0` if variablename is not set. Returns `1` if variablename is set and returns the variable in parentheses.
//
// Example return code: 200 result=1 (testvariable)
type GetVariableCommand struct {
VariableName string
}
func (cmd GetVariableCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.VariableName}
return joinCommand(s), nil
}
func (cmd GetVariableCommand) CommandString() string {
return "GET VARIABLE"
}
func (c *Client) GetVariable(variableName string) Response {
return c.Handler.Command(GetVariableCommand{
VariableName: variableName,
})
}
// HangupCommand Hangup a channel.
//
// Hangs up the specified channel. If no channel name is given, hangs up the current channel
type HangupCommand struct {
ChannelName *string
}
func (cmd HangupCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.ChannelName}
return joinCommand(s), nil
}
func (cmd HangupCommand) CommandString() string {
return "HANGUP"
}
func (cmd HangupCommand) SetChannelName(v string) HangupCommand {
cmd.ChannelName = &v
return cmd
}
func (c *Client) Hangup() Response {
return c.Handler.Command(HangupCommand{})
}
// NoopCommand Does nothing.
//
// Does nothing.
type NoopCommand struct {
}
func (cmd NoopCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString()}
return joinCommand(s), nil
}
func (cmd NoopCommand) CommandString() string {
return "NOOP"
}
func (c *Client) Noop() Response {
return c.Handler.Command(NoopCommand{})
}
// ReceiveCharCommand Receives one character from channels supporting it.
//
// Receives a character of text on a channel. Most channels do not support the reception of text. Returns the decimal value of the character if one is received, or `0` if the channel does not support text reception. Returns `-1` only on error/hangup.
type ReceiveCharCommand struct {
// Timeout The maximum time to wait for input in milliseconds, or `0` for infinite. Most channels
Timeout int
}
func (cmd ReceiveCharCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Timeout}
return joinCommand(s), nil
}
func (cmd ReceiveCharCommand) CommandString() string {
return "RECEIVE CHAR"
}
func (c *Client) ReceiveChar(timeout int) Response {
return c.Handler.Command(ReceiveCharCommand{
Timeout: timeout,
})
}
// ReceiveTextCommand Receives text from channels supporting it.
//
// Receives a string of text on a channel. Most channels do not support the reception of text. Returns `-1` for failure or `1` for success, and the string in parenthesis.
type ReceiveTextCommand struct {
// Timeout The timeout to be the maximum time to wait for input in milliseconds, or `0` for infinite.
Timeout int
}
func (cmd ReceiveTextCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Timeout}
return joinCommand(s), nil
}
func (cmd ReceiveTextCommand) CommandString() string {
return "RECEIVE TEXT"
}
func (c *Client) ReceiveText(timeout int) Response {
return c.Handler.Command(ReceiveTextCommand{
Timeout: timeout,
})
}
// RecordFileCommand Records to a given file.
//
// Record to a file until a given dtmf digit in the sequence is received. Returns `-1` on hangup or error. The format will specify what kind of file will be recorded. The timeout is the maximum record time in milliseconds, or `-1` for no timeout . offset samples is optional, and, if provided, will seek to the offset without exceeding the end of the file. beep can take any value, and causes Asterisk to play a beep to the channel that is about to be recorded. silence is the number of seconds of silence allowed before the function returns despite the lack of dtmf digits or reaching timeout . silence value must be preceded by `s=` and is also optional.
type RecordFileCommand struct {
// FileName The destination filename of the recorded audio.
FileName string
// Format The audio format in which to save the resulting file.
Format string
// EscapeDigits The DTMF digits that will terminate the recording process.
EscapeDigits string
// Timeout The maximum recording time in milliseconds. Set to -1 for no limit.
Timeout int
// OffsetSamples Causes the recording to first seek to the specified offset before recording begins.
OffsetSamples *string
// Beep Causes Asterisk to play a beep as recording begins. This argument can take any value.
Beep *string
// SSilence The number of seconds of silence that are permitted before the recording is terminated, regardless of the escape_digits or timeout arguments. If specified, this parameter must be preceded by `s=`.
SSilence *string
}
func (cmd RecordFileCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.Format, cmd.EscapeDigits, cmd.Timeout, cmd.OffsetSamples, cmd.Beep, cmd.SSilence}
return joinCommand(s), nil
}
func (cmd RecordFileCommand) CommandString() string {
return "RECORD FILE"
}
func (cmd RecordFileCommand) SetOffsetSamples(v string) RecordFileCommand {
cmd.OffsetSamples = &v
return cmd
}
func (cmd RecordFileCommand) SetBeep(v string) RecordFileCommand {
cmd.Beep = &v
return cmd
}
func (cmd RecordFileCommand) SetSSilence(v string) RecordFileCommand {
cmd.SSilence = &v
return cmd
}
func (c *Client) RecordFile(fileName string, format string, escapeDigits string, timeout int) Response {
return c.Handler.Command(RecordFileCommand{
FileName: fileName,
Format: format,
EscapeDigits: escapeDigits,
Timeout: timeout,
})
}
// SayAlphaCommand Says a given character string.
//
// Say a given character string, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
type SayAlphaCommand struct {
Number string
EscapeDigits string
}
func (cmd SayAlphaCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Number, cmd.EscapeDigits}
return joinCommand(s), nil
}
func (cmd SayAlphaCommand) CommandString() string {
return "SAY ALPHA"
}
func (c *Client) SayAlpha(number string, escapeDigits string) Response {
return c.Handler.Command(SayAlphaCommand{
Number: number,
EscapeDigits: escapeDigits,
})
}
// SayDigitsCommand Says a given digit string.
//
// Say a given digit string, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
type SayDigitsCommand struct {
Number string
EscapeDigits string
}
func (cmd SayDigitsCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Number, cmd.EscapeDigits}
return joinCommand(s), nil
}
func (cmd SayDigitsCommand) CommandString() string {
return "SAY DIGITS"
}
func (c *Client) SayDigits(number string, escapeDigits string) Response {
return c.Handler.Command(SayDigitsCommand{
Number: number,
EscapeDigits: escapeDigits,
})
}
// SayNumberCommand Says a given number.
//
// Say a given number, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
type SayNumberCommand struct {
Number string
EscapeDigits string
Gender *string
}
func (cmd SayNumberCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Number, cmd.EscapeDigits, cmd.Gender}
return joinCommand(s), nil
}
func (cmd SayNumberCommand) CommandString() string {
return "SAY NUMBER"
}
func (cmd SayNumberCommand) SetGender(v string) SayNumberCommand {
cmd.Gender = &v
return cmd
}
func (c *Client) SayNumber(number string, escapeDigits string) Response {
return c.Handler.Command(SayNumberCommand{
Number: number,
EscapeDigits: escapeDigits,
})
}
// SayPhoneticCommand Says a given character string with phonetics.
//
// Say a given character string with phonetics, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit pressed, the ASCII numerical value of the digit if one was pressed, or `-1` on error/hangup.
type SayPhoneticCommand struct {
String string
EscapeDigits string
}
func (cmd SayPhoneticCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.String, cmd.EscapeDigits}
return joinCommand(s), nil
}
func (cmd SayPhoneticCommand) CommandString() string {
return "SAY PHONETIC"
}
func (c *Client) SayPhonetic(string string, escapeDigits string) Response {
return c.Handler.Command(SayPhoneticCommand{
String: string,
EscapeDigits: escapeDigits,
})
}
// SayDateCommand Says a given date.
//
// Say a given date, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
type SayDateCommand struct {
// Date Is number of seconds elapsed since 00:00:00 on January 1, 1970. Coordinated Universal Time (UTC).
Date string
EscapeDigits string
}
func (cmd SayDateCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Date, cmd.EscapeDigits}
return joinCommand(s), nil
}
func (cmd SayDateCommand) CommandString() string {
return "SAY DATE"
}
func (c *Client) SayDate(date string, escapeDigits string) Response {
return c.Handler.Command(SayDateCommand{
Date: date,
EscapeDigits: escapeDigits,
})
}
// SayTimeCommand Says a given time.
//
// Say a given time, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
type SayTimeCommand struct {
// Time Is number of seconds elapsed since 00:00:00 on January 1, 1970. Coordinated Universal Time (UTC).
Time float64
EscapeDigits string
}
func (cmd SayTimeCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Time, cmd.EscapeDigits}
return joinCommand(s), nil
}
func (cmd SayTimeCommand) CommandString() string {
return "SAY TIME"
}
func (c *Client) SayTime(time float64, escapeDigits string) Response {
return c.Handler.Command(SayTimeCommand{
Time: time,
EscapeDigits: escapeDigits,
})
}
// SayDatetimeCommand Says a given time as specified by the format given.
//
// Say a given time, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
type SayDatetimeCommand struct {
// Time Is number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)
Time float64
EscapeDigits string
// Format Is the format the time should be said in. See voicemail.conf (defaults to `ABdY 'digits/at' IMp`).
Format *string
// Timezone Acceptable values can be found in /usr/share/zoneinfo Defaults to machine default.
Timezone *string
}
func (cmd SayDatetimeCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Time, cmd.EscapeDigits, cmd.Format, cmd.Timezone}
return joinCommand(s), nil
}
func (cmd SayDatetimeCommand) CommandString() string {
return "SAY DATETIME"
}
func (cmd SayDatetimeCommand) SetFormat(v string) SayDatetimeCommand {
cmd.Format = &v
return cmd
}
func (cmd SayDatetimeCommand) SetTimezone(v string) SayDatetimeCommand {
cmd.Timezone = &v
return cmd
}
func (c *Client) SayDatetime(time float64, escapeDigits string) Response {
return c.Handler.Command(SayDatetimeCommand{
Time: time,
EscapeDigits: escapeDigits,
})
}
// SendImageCommand Sends images to channels supporting it.
//
// Sends the given image on a channel. Most channels do not support the transmission of images. Returns `0` if image is sent, or if the channel does not support image transmission. Returns `-1` only on error/hangup. Image names should not include extensions.
type SendImageCommand struct {
Image string
}
func (cmd SendImageCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Image}
return joinCommand(s), nil
}
func (cmd SendImageCommand) CommandString() string {
return "SEND IMAGE"
}
func (c *Client) SendImage(image string) Response {
return c.Handler.Command(SendImageCommand{
Image: image,
})
}
// SendTextCommand Sends text to channels supporting it.
//
// Sends the given text on a channel. Most channels do not support the transmission of text. Returns `0` if text is sent, or if the channel does not support text transmission. Returns `-1` only on error/hangup.
type SendTextCommand struct {
// TextToSend Text consisting of greater than one word should be placed in quotes since the command only accepts a single argument.
TextToSend string
}
func (cmd SendTextCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.TextToSend}
return joinCommand(s), nil
}
func (cmd SendTextCommand) CommandString() string {
return "SEND TEXT"
}
func (c *Client) SendText(textToSend string) Response {
return c.Handler.Command(SendTextCommand{
TextToSend: textToSend,
})
}
// SetAutoHangupCommand Autohangup channel in some time.
//
// Cause the channel to automatically hangup at time seconds in the future. Of course it can be hungup before then as well. Setting to `0` will cause the autohangup feature to be disabled on this channel.
type SetAutoHangupCommand struct {
Time float64
}
func (cmd SetAutoHangupCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Time}
return joinCommand(s), nil
}
func (cmd SetAutoHangupCommand) CommandString() string {
return "SET AUTOHANGUP"
}
func (c *Client) SetAutoHangup(time float64) Response {
return c.Handler.Command(SetAutoHangupCommand{
Time: time,
})
}
// SetCallerIDCommand Sets callerid for the current channel.
//
// Changes the callerid of the current channel.
type SetCallerIDCommand struct {
Number string
}
func (cmd SetCallerIDCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Number}
return joinCommand(s), nil
}
func (cmd SetCallerIDCommand) CommandString() string {
return "SET CALLERID"
}
func (c *Client) SetCallerID(number string) Response {
return c.Handler.Command(SetCallerIDCommand{
Number: number,
})
}
// SetContextCommand Sets channel context.
//
// Sets the context for continuation upon exiting the application.
type SetContextCommand struct {
DesiredContext string
}
func (cmd SetContextCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.DesiredContext}
return joinCommand(s), nil
}
func (cmd SetContextCommand) CommandString() string {
return "SET CONTEXT"
}
func (c *Client) SetContext(desiredContext string) Response {
return c.Handler.Command(SetContextCommand{
DesiredContext: desiredContext,
})
}
// SetExtensionCommand Changes channel extension.
//
// Changes the extension for continuation upon exiting the application.
type SetExtensionCommand struct {
NewExtension string
}
func (cmd SetExtensionCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.NewExtension}
return joinCommand(s), nil
}
func (cmd SetExtensionCommand) CommandString() string {
return "SET EXTENSION"
}
func (c *Client) SetExtension(newExtension string) Response {
return c.Handler.Command(SetExtensionCommand{
NewExtension: newExtension,
})
}
// SetMusicCommand Enable/Disable Music on hold generator
//
// Enables/Disables the music on hold generator. If class is not specified, then the `default` music on hold class will be used. This generator will be stopped automatically when playing a file.
//
// Always returns `0`.
type SetMusicCommand struct {
Class string
// has missing params
}
func (cmd SetMusicCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Class}
return joinCommand(s), nil
}
func (cmd SetMusicCommand) CommandString() string {
return "SET MUSIC"
}
func (c *Client) SetMusic(class string) Response {
return c.Handler.Command(SetMusicCommand{
Class: class,
})
}
// SetPriorityCommand Set channel dialplan priority.
//
// Changes the priority for continuation upon exiting the application. The priority must be a valid priority or label.
type SetPriorityCommand struct {
Priority int
}
func (cmd SetPriorityCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Priority}
return joinCommand(s), nil
}
func (cmd SetPriorityCommand) CommandString() string {
return "SET PRIORITY"
}
func (c *Client) SetPriority(priority int) Response {
return c.Handler.Command(SetPriorityCommand{
Priority: priority,
})
}
// SetVariableCommand Sets a channel variable.
//
// Sets a variable to the current channel.
type SetVariableCommand struct {
VariableName string
Value string
}
func (cmd SetVariableCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.VariableName, cmd.Value}
return joinCommand(s), nil
}
func (cmd SetVariableCommand) CommandString() string {
return "SET VARIABLE"
}
func (c *Client) SetVariable(variableName string, value string) Response {
return c.Handler.Command(SetVariableCommand{
VariableName: variableName,
Value: value,
})
}
// StreamFileCommand Sends audio file on channel.
//
// Send the given file, allowing playback to be interrupted by the given digits, if any. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or `-1` on error or if the channel was disconnected. If musiconhold is playing before calling stream file it will be automatically stopped and will not be restarted after completion.
//
// It sets the following channel variables upon completion:
type StreamFileCommand struct {
// FileName File name to play. The file extension must not be included in the filename .
FileName string
// EscapeDigits Use double quotes for the digits if you wish none to be permitted.
EscapeDigits string
// SampleOffset If sample offset is provided then the audio will seek to sample offset before play starts.
SampleOffset *int
}
func (cmd StreamFileCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.EscapeDigits, cmd.SampleOffset}
return joinCommand(s), nil
}
func (cmd StreamFileCommand) CommandString() string {
return "STREAM FILE"
}
func (cmd StreamFileCommand) SetSampleOffset(v int) StreamFileCommand {
cmd.SampleOffset = &v
return cmd
}
func (c *Client) StreamFile(fileName string, escapeDigits string) Response {
return c.Handler.Command(StreamFileCommand{
FileName: fileName,
EscapeDigits: escapeDigits,
})
}
// TddModeCommand Toggles TDD mode (for the deaf).
//
// Enable/Disable TDD transmission/reception on a channel. Returns `1` if successful, or `0` if channel is not TDD-capable.
type TddModeCommand struct {
Boolean string
}
func (cmd TddModeCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Boolean}
return joinCommand(s), nil
}
func (cmd TddModeCommand) CommandString() string {
return "TDD MODE"
}
func (c *Client) TddMode(boolean string) Response {
return c.Handler.Command(TddModeCommand{
Boolean: boolean,
})
}
// VerboseCommand Logs a message to the asterisk verbose log.
//
// Sends message to the console via verbose message system. level is the verbose level (1-4). Always returns `1`
type VerboseCommand struct {
Message string
Level string
}
func (cmd VerboseCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Message, cmd.Level}
return joinCommand(s), nil
}
func (cmd VerboseCommand) CommandString() string {
return "VERBOSE"
}
func (c *Client) Verbose(message string, level string) Response {
return c.Handler.Command(VerboseCommand{
Message: message,
Level: level,
})
}
// WaitForDigitCommand Waits for a digit to be pressed.
//
// Waits up to timeout milliseconds for channel to receive a DTMF digit. Returns `-1` on channel failure, `0` if no digit is received in the timeout, or the numerical value of the ascii of the digit if one is received. Use `-1` for the timeout value if you desire the call to block indefinitely.
type WaitForDigitCommand struct {
Timeout int
}
func (cmd WaitForDigitCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Timeout}
return joinCommand(s), nil
}
func (cmd WaitForDigitCommand) CommandString() string {
return "WAIT FOR DIGIT"
}
func (c *Client) WaitForDigit(timeout int) Response {
return c.Handler.Command(WaitForDigitCommand{
Timeout: timeout,
})
}
// SpeechCreateCommand Creates a speech object.
//
// Create a speech object to be used by the other Speech AGI commands.
type SpeechCreateCommand struct {
Engine string
}
func (cmd SpeechCreateCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Engine}
return joinCommand(s), nil
}
func (cmd SpeechCreateCommand) CommandString() string {
return "SPEECH CREATE"
}
func (c *Client) SpeechCreate(engine string) Response {
return c.Handler.Command(SpeechCreateCommand{
Engine: engine,
})
}
// SpeechSetCommand Sets a speech engine setting.
//
// Set an engine-specific setting.
type SpeechSetCommand struct {
Name string
Value string
}
func (cmd SpeechSetCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Name, cmd.Value}
return joinCommand(s), nil
}
func (cmd SpeechSetCommand) CommandString() string {
return "SPEECH SET"
}
func (c *Client) SpeechSet(name string, value string) Response {
return c.Handler.Command(SpeechSetCommand{
Name: name,
Value: value,
})
}
// SpeechDestroyCommand Destroys a speech object.
//
// Destroy the speech object created by `SPEECH CREATE`.
type SpeechDestroyCommand struct {
}
func (cmd SpeechDestroyCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString()}
return joinCommand(s), nil
}
func (cmd SpeechDestroyCommand) CommandString() string {
return "SPEECH DESTROY"
}
func (c *Client) SpeechDestroy() Response {
return c.Handler.Command(SpeechDestroyCommand{})
}
// SpeechLoadGrammarCommand Loads a grammar.
//
// Loads the specified grammar as the specified name.
type SpeechLoadGrammarCommand struct {
GrammarName string
PathToGrammar string
}
func (cmd SpeechLoadGrammarCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.GrammarName, cmd.PathToGrammar}
return joinCommand(s), nil
}
func (cmd SpeechLoadGrammarCommand) CommandString() string {
return "SPEECH LOAD GRAMMAR"
}
func (c *Client) SpeechLoadGrammar(grammarName string, pathToGrammar string) Response {
return c.Handler.Command(SpeechLoadGrammarCommand{
GrammarName: grammarName,
PathToGrammar: pathToGrammar,
})
}
// SpeechUnloadGrammarCommand Unloads a grammar.
//
// Unloads the specified grammar.
type SpeechUnloadGrammarCommand struct {
GrammarName string
}
func (cmd SpeechUnloadGrammarCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.GrammarName}
return joinCommand(s), nil
}
func (cmd SpeechUnloadGrammarCommand) CommandString() string {
return "SPEECH UNLOAD GRAMMAR"
}
func (c *Client) SpeechUnloadGrammar(grammarName string) Response {
return c.Handler.Command(SpeechUnloadGrammarCommand{
GrammarName: grammarName,
})
}
// SpeechActivateGrammarCommand Activates a grammar.
//
// Activates the specified grammar on the speech object.
type SpeechActivateGrammarCommand struct {
GrammarName string
}
func (cmd SpeechActivateGrammarCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.GrammarName}
return joinCommand(s), nil
}
func (cmd SpeechActivateGrammarCommand) CommandString() string {
return "SPEECH ACTIVATE GRAMMAR"
}
func (c *Client) SpeechActivateGrammar(grammarName string) Response {
return c.Handler.Command(SpeechActivateGrammarCommand{
GrammarName: grammarName,
})
}
// SpeechDeactivateGrammarCommand Deactivates a grammar.
//
// Deactivates the specified grammar on the speech object.
type SpeechDeactivateGrammarCommand struct {
GrammarName string
}
func (cmd SpeechDeactivateGrammarCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.GrammarName}
return joinCommand(s), nil
}
func (cmd SpeechDeactivateGrammarCommand) CommandString() string {
return "SPEECH DEACTIVATE GRAMMAR"
}
func (c *Client) SpeechDeactivateGrammar(grammarName string) Response {
return c.Handler.Command(SpeechDeactivateGrammarCommand{
GrammarName: grammarName,
})
}
// SpeechRecognizeCommand Recognizes speech.
//
// Plays back given prompt while listening for speech and dtmf.
type SpeechRecognizeCommand struct {
Prompt string
Timeout int
Offset *string
}
func (cmd SpeechRecognizeCommand) Command() (string, error) {
s := []interface{}{cmd.CommandString(), cmd.Prompt, cmd.Timeout, cmd.Offset}
return joinCommand(s), nil
}
func (cmd SpeechRecognizeCommand) CommandString() string {
return "SPEECH RECOGNIZE"
}
func (cmd SpeechRecognizeCommand) SetOffset(v string) SpeechRecognizeCommand {
cmd.Offset = &v
return cmd
}
func (c *Client) SpeechRecognize(prompt string, timeout int) Response {
return c.Handler.Command(SpeechRecognizeCommand{
Prompt: prompt,
Timeout: timeout,
})
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/agi/agimodels/iface.go 0000664 0000000 0000000 00000001702 14650613361 0025562 0 ustar 00root root 0000000 0000000 package agimodels
import (
"fmt"
"strconv"
"strings"
)
type Command interface {
Command() (string, error)
}
type Response interface {
Err() error
Val() (string, error)
}
type Handler interface {
Command(cmd Command) Response
}
type HandlerFunc func(cmd Command) Response
func (f HandlerFunc) Command(cmd Command) Response {
return f(cmd)
}
type Client struct {
Handler
}
func joinCommand(s []interface{}) string {
sb := strings.Builder{}
for _, param := range s {
switch v := param.(type) {
case string:
sb.WriteString(v)
case int:
sb.WriteString(strconv.Itoa(v))
case float64:
sb.WriteString(fmt.Sprint(v))
case *string:
if v == nil {
goto DONE
}
sb.WriteString(*v)
case *int:
if v == nil {
goto DONE
}
sb.WriteString(strconv.Itoa(*v))
case *float64:
if v == nil {
goto DONE
}
sb.WriteString(fmt.Sprint(*v))
}
sb.WriteRune(' ')
}
DONE:
return strings.TrimSpace(sb.String())
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/ 0000775 0000000 0000000 00000000000 14650613361 0022226 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/amimodels/ 0000775 0000000 0000000 00000000000 14650613361 0024200 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/amimodels/actions.go 0000664 0000000 0000000 00000354313 14650613361 0026200 0 ustar 00root root 0000000 0000000 // Code generated by xmlgen. DO NOT EDIT.
package amimodels
// SKINNYdevicesAction List SKINNY devices (text format).
type SKINNYdevicesAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (SKINNYdevicesAction) ActionTypeName() string {
return "SKINNYdevices"
}
func (a SKINNYdevicesAction) GetActionID() string {
return a.ActionID
}
func (a *SKINNYdevicesAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SKINNYdevices(opts ...RequestOption) (res *Response, err error) {
req := &SKINNYdevicesAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SKINNYshowdeviceAction Show SKINNY device (text format).
type SKINNYshowdeviceAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Device The device name you want to check.
Device string
}
func (SKINNYshowdeviceAction) ActionTypeName() string {
return "SKINNYshowdevice"
}
func (a SKINNYshowdeviceAction) GetActionID() string {
return a.ActionID
}
func (a *SKINNYshowdeviceAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SKINNYshowdevice(device string, opts ...RequestOption) (res *Response, err error) {
req := &SKINNYshowdeviceAction{
Device: device,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SKINNYlinesAction List SKINNY lines (text format).
type SKINNYlinesAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (SKINNYlinesAction) ActionTypeName() string {
return "SKINNYlines"
}
func (a SKINNYlinesAction) GetActionID() string {
return a.ActionID
}
func (a *SKINNYlinesAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SKINNYlines(opts ...RequestOption) (res *Response, err error) {
req := &SKINNYlinesAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SKINNYshowlineAction Show SKINNY line (text format).
type SKINNYshowlineAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Line The line name you want to check.
Line string
}
func (SKINNYshowlineAction) ActionTypeName() string {
return "SKINNYshowline"
}
func (a SKINNYshowlineAction) GetActionID() string {
return a.ActionID
}
func (a *SKINNYshowlineAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SKINNYshowline(line string, opts ...RequestOption) (res *Response, err error) {
req := &SKINNYshowlineAction{
Line: line,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// IAXpeersAction List IAX peers.
type IAXpeersAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (IAXpeersAction) ActionTypeName() string {
return "IAXpeers"
}
func (a IAXpeersAction) GetActionID() string {
return a.ActionID
}
func (a *IAXpeersAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) IAXpeers(opts ...RequestOption) (res *Response, err error) {
req := &IAXpeersAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// IAXpeerlistAction List IAX Peers.
type IAXpeerlistAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (IAXpeerlistAction) ActionTypeName() string {
return "IAXpeerlist"
}
func (a IAXpeerlistAction) GetActionID() string {
return a.ActionID
}
func (a *IAXpeerlistAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) IAXpeerlist(opts ...RequestOption) (res *Response, err error) {
req := &IAXpeerlistAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// IAXnetstatsAction Show IAX Netstats.
type IAXnetstatsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (IAXnetstatsAction) ActionTypeName() string {
return "IAXnetstats"
}
func (a IAXnetstatsAction) GetActionID() string {
return a.ActionID
}
func (a *IAXnetstatsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) IAXnetstats(opts ...RequestOption) (res *Response, err error) {
req := &IAXnetstatsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// IAXregistryAction Show IAX registrations.
type IAXregistryAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (IAXregistryAction) ActionTypeName() string {
return "IAXregistry"
}
func (a IAXregistryAction) GetActionID() string {
return a.ActionID
}
func (a *IAXregistryAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) IAXregistry(opts ...RequestOption) (res *Response, err error) {
req := &IAXregistryAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DAHDITransferAction Transfer DAHDI Channel.
type DAHDITransferAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// DAHDIChannel DAHDI channel number to transfer.
DAHDIChannel string
}
func (DAHDITransferAction) ActionTypeName() string {
return "DAHDITransfer"
}
func (a DAHDITransferAction) GetActionID() string {
return a.ActionID
}
func (a *DAHDITransferAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DAHDITransfer(dAHDIChannel string, opts ...RequestOption) (res *Response, err error) {
req := &DAHDITransferAction{
DAHDIChannel: dAHDIChannel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DAHDIHangupAction Hangup DAHDI Channel.
type DAHDIHangupAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// DAHDIChannel DAHDI channel number to hangup.
DAHDIChannel string
}
func (DAHDIHangupAction) ActionTypeName() string {
return "DAHDIHangup"
}
func (a DAHDIHangupAction) GetActionID() string {
return a.ActionID
}
func (a *DAHDIHangupAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DAHDIHangup(dAHDIChannel string, opts ...RequestOption) (res *Response, err error) {
req := &DAHDIHangupAction{
DAHDIChannel: dAHDIChannel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DAHDIDialOffhookAction Dial over DAHDI channel while offhook.
type DAHDIDialOffhookAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// DAHDIChannel DAHDI channel number to dial digits.
DAHDIChannel string
// Number Digits to dial.
Number string
}
func (DAHDIDialOffhookAction) ActionTypeName() string {
return "DAHDIDialOffhook"
}
func (a DAHDIDialOffhookAction) GetActionID() string {
return a.ActionID
}
func (a *DAHDIDialOffhookAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DAHDIDialOffhook(dAHDIChannel string, number string, opts ...RequestOption) (res *Response, err error) {
req := &DAHDIDialOffhookAction{
DAHDIChannel: dAHDIChannel,
Number: number,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DAHDIDNDonAction Toggle DAHDI channel Do Not Disturb status ON.
type DAHDIDNDonAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// DAHDIChannel DAHDI channel number to set DND on.
DAHDIChannel string
}
func (DAHDIDNDonAction) ActionTypeName() string {
return "DAHDIDNDon"
}
func (a DAHDIDNDonAction) GetActionID() string {
return a.ActionID
}
func (a *DAHDIDNDonAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DAHDIDNDon(dAHDIChannel string, opts ...RequestOption) (res *Response, err error) {
req := &DAHDIDNDonAction{
DAHDIChannel: dAHDIChannel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DAHDIDNDoffAction Toggle DAHDI channel Do Not Disturb status OFF.
type DAHDIDNDoffAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// DAHDIChannel DAHDI channel number to set DND off.
DAHDIChannel string
}
func (DAHDIDNDoffAction) ActionTypeName() string {
return "DAHDIDNDoff"
}
func (a DAHDIDNDoffAction) GetActionID() string {
return a.ActionID
}
func (a *DAHDIDNDoffAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DAHDIDNDoff(dAHDIChannel string, opts ...RequestOption) (res *Response, err error) {
req := &DAHDIDNDoffAction{
DAHDIChannel: dAHDIChannel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DAHDIShowChannelsAction Show status of DAHDI channels.
type DAHDIShowChannelsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// DAHDIChannel Specify the specific channel number to show. Show all channels if zero or not present.
DAHDIChannel string
}
func (DAHDIShowChannelsAction) ActionTypeName() string {
return "DAHDIShowChannels"
}
func (a DAHDIShowChannelsAction) GetActionID() string {
return a.ActionID
}
func (a *DAHDIShowChannelsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DAHDIShowChannels(opts ...RequestOption) (res *Response, err error) {
req := &DAHDIShowChannelsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DAHDIRestartAction Fully Restart DAHDI channels (terminates calls).
type DAHDIRestartAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (DAHDIRestartAction) ActionTypeName() string {
return "DAHDIRestart"
}
func (a DAHDIRestartAction) GetActionID() string {
return a.ActionID
}
func (a *DAHDIRestartAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DAHDIRestart(opts ...RequestOption) (res *Response, err error) {
req := &DAHDIRestartAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PRIShowSpansAction Show status of PRI spans.
type PRIShowSpansAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Span Specify the specific span to show. Show all spans if zero or not present.
Span string
}
func (PRIShowSpansAction) ActionTypeName() string {
return "PRIShowSpans"
}
func (a PRIShowSpansAction) GetActionID() string {
return a.ActionID
}
func (a *PRIShowSpansAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PRIShowSpans(opts ...RequestOption) (res *Response, err error) {
req := &PRIShowSpansAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PRIDebugSetAction Set PRI debug levels for a span
type PRIDebugSetAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Span Which span to affect.
Span string
// Level What debug level to set. May be a numerical value or a text value from the list below
Level string
}
func (PRIDebugSetAction) ActionTypeName() string {
return "PRIDebugSet"
}
func (a PRIDebugSetAction) GetActionID() string {
return a.ActionID
}
func (a *PRIDebugSetAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PRIDebugSet(span string, level string, opts ...RequestOption) (res *Response, err error) {
req := &PRIDebugSetAction{
Span: span,
Level: level,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PRIDebugFileSetAction Set the file used for PRI debug message output
type PRIDebugFileSetAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// File Path of file to write debug output.
File string
}
func (PRIDebugFileSetAction) ActionTypeName() string {
return "PRIDebugFileSet"
}
func (a PRIDebugFileSetAction) GetActionID() string {
return a.ActionID
}
func (a *PRIDebugFileSetAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PRIDebugFileSet(file string, opts ...RequestOption) (res *Response, err error) {
req := &PRIDebugFileSetAction{
File: file,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PRIDebugFileUnsetAction Disables file output for PRI debug messages
type PRIDebugFileUnsetAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PRIDebugFileUnsetAction) ActionTypeName() string {
return "PRIDebugFileUnset"
}
func (a PRIDebugFileUnsetAction) GetActionID() string {
return a.ActionID
}
func (a *PRIDebugFileUnsetAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PRIDebugFileUnset(opts ...RequestOption) (res *Response, err error) {
req := &PRIDebugFileUnsetAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SIPpeersAction List SIP peers (text format).
type SIPpeersAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (SIPpeersAction) ActionTypeName() string {
return "SIPpeers"
}
func (a SIPpeersAction) GetActionID() string {
return a.ActionID
}
func (a *SIPpeersAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SIPpeers(opts ...RequestOption) (res *Response, err error) {
req := &SIPpeersAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SIPshowpeerAction show SIP peer (text format).
type SIPshowpeerAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Peer The peer name you want to check.
Peer string
}
func (SIPshowpeerAction) ActionTypeName() string {
return "SIPshowpeer"
}
func (a SIPshowpeerAction) GetActionID() string {
return a.ActionID
}
func (a *SIPshowpeerAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SIPshowpeer(peer string, opts ...RequestOption) (res *Response, err error) {
req := &SIPshowpeerAction{
Peer: peer,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SIPqualifypeerAction Qualify SIP peers.
type SIPqualifypeerAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Peer The peer name you want to qualify.
Peer string
}
func (SIPqualifypeerAction) ActionTypeName() string {
return "SIPqualifypeer"
}
func (a SIPqualifypeerAction) GetActionID() string {
return a.ActionID
}
func (a *SIPqualifypeerAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SIPqualifypeer(peer string, opts ...RequestOption) (res *Response, err error) {
req := &SIPqualifypeerAction{
Peer: peer,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SIPshowregistryAction Show SIP registrations (text format).
type SIPshowregistryAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (SIPshowregistryAction) ActionTypeName() string {
return "SIPshowregistry"
}
func (a SIPshowregistryAction) GetActionID() string {
return a.ActionID
}
func (a *SIPshowregistryAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SIPshowregistry(opts ...RequestOption) (res *Response, err error) {
req := &SIPshowregistryAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SIPnotifyAction Send a SIP notify.
type SIPnotifyAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Peer to receive the notify.
Channel string
// Variable At least one variable pair must be specified. name = value
Variable string
// CallID When specified, SIP notity will be sent as a part of an existing dialog.
CallID string
}
func (SIPnotifyAction) ActionTypeName() string {
return "SIPnotify"
}
func (a SIPnotifyAction) GetActionID() string {
return a.ActionID
}
func (a *SIPnotifyAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SIPnotify(channel string, variable string, opts ...RequestOption) (res *Response, err error) {
req := &SIPnotifyAction{
Channel: channel,
Variable: variable,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SIPpeerstatusAction Show the status of one or all of the sip peers.
type SIPpeerstatusAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Peer The peer name you want to check.
Peer string
}
func (SIPpeerstatusAction) ActionTypeName() string {
return "SIPpeerstatus"
}
func (a SIPpeerstatusAction) GetActionID() string {
return a.ActionID
}
func (a *SIPpeerstatusAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SIPpeerstatus(opts ...RequestOption) (res *Response, err error) {
req := &SIPpeerstatusAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DialplanExtensionAddAction Add an extension to the dialplan
type DialplanExtensionAddAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Context Context where the extension will be created. The context will be created if it does not already exist.
Context string
// Extension Name of the extension that will be created (may include callerid match by separating with '/')
Extension string
// Priority Priority being added to this extension. Must be either `hint` or a numerical value.
Priority int
// Application The application to use for this extension at the requested priority
Application string
// ApplicationData Arguments to the application.
ApplicationData string
// Replace If set to 'yes', '1', 'true' or any of the other values we evaluate as true, then if an extension already exists at the requested context, extension, and priority it will be overwritten. Otherwise, the existing extension will remain and the action will fail.
Replace string
}
func (DialplanExtensionAddAction) ActionTypeName() string {
return "DialplanExtensionAdd"
}
func (a DialplanExtensionAddAction) GetActionID() string {
return a.ActionID
}
func (a *DialplanExtensionAddAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DialplanExtensionAdd(context string, extension string, priority int, application string, opts ...RequestOption) (res *Response, err error) {
req := &DialplanExtensionAddAction{
Context: context,
Extension: extension,
Priority: priority,
Application: application,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DialplanExtensionRemoveAction Remove an extension from the dialplan
type DialplanExtensionRemoveAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Context Context of the extension being removed
Context string
// Extension Name of the extension being removed (may include callerid match by separating with '/')
Extension string
// Priority If provided, only remove this priority from the extension instead of all priorities in the extension.
Priority int
}
func (DialplanExtensionRemoveAction) ActionTypeName() string {
return "DialplanExtensionRemove"
}
func (a DialplanExtensionRemoveAction) GetActionID() string {
return a.ActionID
}
func (a *DialplanExtensionRemoveAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DialplanExtensionRemove(context string, extension string, opts ...RequestOption) (res *Response, err error) {
req := &DialplanExtensionRemoveAction{
Context: context,
Extension: extension,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// VoicemailUsersListAction List All Voicemail User Information.
type VoicemailUsersListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (VoicemailUsersListAction) ActionTypeName() string {
return "VoicemailUsersList"
}
func (a VoicemailUsersListAction) GetActionID() string {
return a.ActionID
}
func (a *VoicemailUsersListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) VoicemailUsersList(opts ...RequestOption) (res *Response, err error) {
req := &VoicemailUsersListAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// VoicemailUserStatusAction Show the status of given voicemail user's info.
type VoicemailUserStatusAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Context The context you want to check.
Context string
// Mailbox The mailbox you want to check.
Mailbox string
}
func (VoicemailUserStatusAction) ActionTypeName() string {
return "VoicemailUserStatus"
}
func (a VoicemailUserStatusAction) GetActionID() string {
return a.ActionID
}
func (a *VoicemailUserStatusAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) VoicemailUserStatus(context string, mailbox string, opts ...RequestOption) (res *Response, err error) {
req := &VoicemailUserStatusAction{
Context: context,
Mailbox: mailbox,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// VoicemailRefreshAction Tell Asterisk to poll mailboxes for a change
type VoicemailRefreshAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Context string
Mailbox string
}
func (VoicemailRefreshAction) ActionTypeName() string {
return "VoicemailRefresh"
}
func (a VoicemailRefreshAction) GetActionID() string {
return a.ActionID
}
func (a *VoicemailRefreshAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) VoicemailRefresh(opts ...RequestOption) (res *Response, err error) {
req := &VoicemailRefreshAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// AgentsAction Lists agents and their status.
type AgentsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (AgentsAction) ActionTypeName() string {
return "Agents"
}
func (a AgentsAction) GetActionID() string {
return a.ActionID
}
func (a *AgentsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Agents(opts ...RequestOption) (res *Response, err error) {
req := &AgentsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// AgentLogoffAction Sets an agent as no longer logged in.
type AgentLogoffAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Agent Agent ID of the agent to log off.
Agent string
// Soft Set to `true` to not hangup existing calls.
Soft string
}
func (AgentLogoffAction) ActionTypeName() string {
return "AgentLogoff"
}
func (a AgentLogoffAction) GetActionID() string {
return a.ActionID
}
func (a *AgentLogoffAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) AgentLogoff(agent string, opts ...RequestOption) (res *Response, err error) {
req := &AgentLogoffAction{
Agent: agent,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ControlPlaybackAction Control the playback of a file being played to a channel.
type ControlPlaybackAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel The name of the channel that currently has a file being played back to it.
Channel string
Control string
}
func (ControlPlaybackAction) ActionTypeName() string {
return "ControlPlayback"
}
func (a ControlPlaybackAction) GetActionID() string {
return a.ActionID
}
func (a *ControlPlaybackAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ControlPlayback(channel string, control string, opts ...RequestOption) (res *Response, err error) {
req := &ControlPlaybackAction{
Channel: channel,
Control: control,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MixMonitorMuteAction Mute / unMute a Mixmonitor recording.
type MixMonitorMuteAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Used to specify the channel to mute.
Channel string
// Direction Which part of the recording to mute: read, write or both (from channel, to channel or both channels).
Direction string
// State Turn mute on or off : 1 to turn on, 0 to turn off.
State string
}
func (MixMonitorMuteAction) ActionTypeName() string {
return "MixMonitorMute"
}
func (a MixMonitorMuteAction) GetActionID() string {
return a.ActionID
}
func (a *MixMonitorMuteAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MixMonitorMute(channel string, opts ...RequestOption) (res *Response, err error) {
req := &MixMonitorMuteAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MixMonitorAction Record a call and mix the audio during the recording. Use of StopMixMonitor is required
// to guarantee the audio file is available for processing during dialplan execution.
type MixMonitorAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Used to specify the channel to record.
Channel string
// File Is the name of the file created in the monitor spool directory. Defaults to the same name as the channel (with slashes replaced with dashes). This argument is optional if you specify to record unidirectional audio with either the r(filename) or t(filename) options in the options field. If neither MIXMONITOR_FILENAME or this parameter is set, the mixed stream won't be recorded.
File string
// Options Options that apply to the MixMonitor in the same way as they would apply if invoked from the MixMonitor application. For a list of available options, see the documentation for the mixmonitor application.
Options string
// Command Will be executed when the recording is over. Any strings matching `^{X}` will be unescaped to `X`. All variables will be evaluated at the time MixMonitor is called.
Command string
}
func (MixMonitorAction) ActionTypeName() string {
return "MixMonitor"
}
func (a MixMonitorAction) GetActionID() string {
return a.ActionID
}
func (a *MixMonitorAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MixMonitor(channel string, opts ...RequestOption) (res *Response, err error) {
req := &MixMonitorAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// StopMixMonitorAction Stop recording a call through MixMonitor, and free the recording's file handle.
type StopMixMonitorAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel The name of the channel monitored.
Channel string
// MixMonitorID If a valid ID is provided, then this command will stop only that specific MixMonitor.
MixMonitorID string
}
func (StopMixMonitorAction) ActionTypeName() string {
return "StopMixMonitor"
}
func (a StopMixMonitorAction) GetActionID() string {
return a.ActionID
}
func (a *StopMixMonitorAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) StopMixMonitor(channel string, opts ...RequestOption) (res *Response, err error) {
req := &StopMixMonitorAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PlayDTMFAction Play DTMF signal on a specific channel.
type PlayDTMFAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel name to send digit to.
Channel string
// Digit The DTMF digit to play.
Digit string
// Duration The duration, in milliseconds, of the digit to be played.
Duration string
// Receive Emulate receiving DTMF on this channel instead of sending it out.
Receive string
}
func (PlayDTMFAction) ActionTypeName() string {
return "PlayDTMF"
}
func (a PlayDTMFAction) GetActionID() string {
return a.ActionID
}
func (a *PlayDTMFAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PlayDTMF(channel string, digit string, opts ...RequestOption) (res *Response, err error) {
req := &PlayDTMFAction{
Channel: channel,
Digit: digit,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeListAction List participants in a conference.
type ConfbridgeListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Conference Conference number.
Conference string
}
func (ConfbridgeListAction) ActionTypeName() string {
return "ConfbridgeList"
}
func (a ConfbridgeListAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeList(conference string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeListAction{
Conference: conference,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeListRoomsAction List active conferences.
type ConfbridgeListRoomsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (ConfbridgeListRoomsAction) ActionTypeName() string {
return "ConfbridgeListRooms"
}
func (a ConfbridgeListRoomsAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeListRoomsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeListRooms(opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeListRoomsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeMuteAction Mute a Confbridge user.
type ConfbridgeMuteAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
// Channel If this parameter is "participants", all non-admin channels will be muted.
Channel string
}
func (ConfbridgeMuteAction) ActionTypeName() string {
return "ConfbridgeMute"
}
func (a ConfbridgeMuteAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeMuteAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeMute(conference string, channel string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeMuteAction{
Conference: conference,
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeUnmuteAction Unmute a Confbridge user.
type ConfbridgeUnmuteAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
// Channel If this parameter is "participants", all non-admin channels will be unmuted.
Channel string
}
func (ConfbridgeUnmuteAction) ActionTypeName() string {
return "ConfbridgeUnmute"
}
func (a ConfbridgeUnmuteAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeUnmuteAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeUnmute(conference string, channel string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeUnmuteAction{
Conference: conference,
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeKickAction Kick a Confbridge user.
type ConfbridgeKickAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
// Channel If this parameter is "participants", all non-admin channels will be kicked from the conference.
Channel string
}
func (ConfbridgeKickAction) ActionTypeName() string {
return "ConfbridgeKick"
}
func (a ConfbridgeKickAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeKickAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeKick(conference string, channel string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeKickAction{
Conference: conference,
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeLockAction Lock a Confbridge conference.
type ConfbridgeLockAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
}
func (ConfbridgeLockAction) ActionTypeName() string {
return "ConfbridgeLock"
}
func (a ConfbridgeLockAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeLockAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeLock(conference string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeLockAction{
Conference: conference,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeUnlockAction Unlock a Confbridge conference.
type ConfbridgeUnlockAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
}
func (ConfbridgeUnlockAction) ActionTypeName() string {
return "ConfbridgeUnlock"
}
func (a ConfbridgeUnlockAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeUnlockAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeUnlock(conference string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeUnlockAction{
Conference: conference,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeStartRecordAction Start recording a Confbridge conference.
type ConfbridgeStartRecordAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
RecordFile string
}
func (ConfbridgeStartRecordAction) ActionTypeName() string {
return "ConfbridgeStartRecord"
}
func (a ConfbridgeStartRecordAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeStartRecordAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeStartRecord(conference string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeStartRecordAction{
Conference: conference,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeStopRecordAction Stop recording a Confbridge conference.
type ConfbridgeStopRecordAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
}
func (ConfbridgeStopRecordAction) ActionTypeName() string {
return "ConfbridgeStopRecord"
}
func (a ConfbridgeStopRecordAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeStopRecordAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeStopRecord(conference string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeStopRecordAction{
Conference: conference,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ConfbridgeSetSingleVideoSrcAction Set a conference user as the single video source distributed to all other participants.
type ConfbridgeSetSingleVideoSrcAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Conference string
// Channel If this parameter is not a complete channel name, the first channel with this prefix will be used.
Channel string
}
func (ConfbridgeSetSingleVideoSrcAction) ActionTypeName() string {
return "ConfbridgeSetSingleVideoSrc"
}
func (a ConfbridgeSetSingleVideoSrcAction) GetActionID() string {
return a.ActionID
}
func (a *ConfbridgeSetSingleVideoSrcAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ConfbridgeSetSingleVideoSrc(conference string, channel string, opts ...RequestOption) (res *Response, err error) {
req := &ConfbridgeSetSingleVideoSrcAction{
Conference: conference,
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MeetmeMuteAction Mute a Meetme user.
type MeetmeMuteAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Meetme string
Usernum string
}
func (MeetmeMuteAction) ActionTypeName() string {
return "MeetmeMute"
}
func (a MeetmeMuteAction) GetActionID() string {
return a.ActionID
}
func (a *MeetmeMuteAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MeetmeMute(meetme string, usernum string, opts ...RequestOption) (res *Response, err error) {
req := &MeetmeMuteAction{
Meetme: meetme,
Usernum: usernum,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MeetmeUnmuteAction Unmute a Meetme user.
type MeetmeUnmuteAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Meetme string
Usernum string
}
func (MeetmeUnmuteAction) ActionTypeName() string {
return "MeetmeUnmute"
}
func (a MeetmeUnmuteAction) GetActionID() string {
return a.ActionID
}
func (a *MeetmeUnmuteAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MeetmeUnmute(meetme string, usernum string, opts ...RequestOption) (res *Response, err error) {
req := &MeetmeUnmuteAction{
Meetme: meetme,
Usernum: usernum,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MeetmeListAction List participants in a conference.
type MeetmeListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Conference Conference number.
Conference string
}
func (MeetmeListAction) ActionTypeName() string {
return "MeetmeList"
}
func (a MeetmeListAction) GetActionID() string {
return a.ActionID
}
func (a *MeetmeListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MeetmeList(opts ...RequestOption) (res *Response, err error) {
req := &MeetmeListAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MeetmeListRoomsAction List active conferences.
type MeetmeListRoomsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (MeetmeListRoomsAction) ActionTypeName() string {
return "MeetmeListRooms"
}
func (a MeetmeListRoomsAction) GetActionID() string {
return a.ActionID
}
func (a *MeetmeListRoomsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MeetmeListRooms(opts ...RequestOption) (res *Response, err error) {
req := &MeetmeListRoomsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueStatusAction Show queue status.
type QueueStatusAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Queue Limit the response to the status of the specified queue.
Queue string
// Member Limit the response to the status of the specified member.
Member string
}
func (QueueStatusAction) ActionTypeName() string {
return "QueueStatus"
}
func (a QueueStatusAction) GetActionID() string {
return a.ActionID
}
func (a *QueueStatusAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueStatus(opts ...RequestOption) (res *Response, err error) {
req := &QueueStatusAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueSummaryAction Show queue summary.
type QueueSummaryAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Queue Queue for which the summary is requested.
Queue string
}
func (QueueSummaryAction) ActionTypeName() string {
return "QueueSummary"
}
func (a QueueSummaryAction) GetActionID() string {
return a.ActionID
}
func (a *QueueSummaryAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueSummary(opts ...RequestOption) (res *Response, err error) {
req := &QueueSummaryAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueAddAction Add interface to queue.
type QueueAddAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Queue Queue's name.
Queue string
// Interface The name of the interface (tech/name) to add to the queue.
Interface string
// Penalty A penalty (number) to apply to this member. Asterisk will distribute calls to members with higher penalties only after attempting to distribute calls to those with lower penalty.
Penalty string
// Paused To pause or not the member initially (true/false or 1/0).
Paused string
// MemberName Text alias for the interface.
MemberName string
StateInterface string
}
func (QueueAddAction) ActionTypeName() string {
return "QueueAdd"
}
func (a QueueAddAction) GetActionID() string {
return a.ActionID
}
func (a *QueueAddAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueAdd(queue string, iface string, opts ...RequestOption) (res *Response, err error) {
req := &QueueAddAction{
Queue: queue,
Interface: iface,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueRemoveAction Remove interface from queue.
type QueueRemoveAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Queue The name of the queue to take action on.
Queue string
// Interface The interface (tech/name) to remove from queue.
Interface string
}
func (QueueRemoveAction) ActionTypeName() string {
return "QueueRemove"
}
func (a QueueRemoveAction) GetActionID() string {
return a.ActionID
}
func (a *QueueRemoveAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueRemove(queue string, iface string, opts ...RequestOption) (res *Response, err error) {
req := &QueueRemoveAction{
Queue: queue,
Interface: iface,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueuePauseAction Makes a queue member temporarily unavailable.
type QueuePauseAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Interface The name of the interface (tech/name) to pause or unpause.
Interface string
// Paused Pause or unpause the interface. Set to 'true' to pause the member or 'false' to unpause.
Paused string
// Queue The name of the queue in which to pause or unpause this member. If not specified, the member will be paused or unpaused in all the queues it is a member of.
Queue string
// Reason Text description, returned in the event QueueMemberPaused.
Reason string
}
func (QueuePauseAction) ActionTypeName() string {
return "QueuePause"
}
func (a QueuePauseAction) GetActionID() string {
return a.ActionID
}
func (a *QueuePauseAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueuePause(iface string, paused string, opts ...RequestOption) (res *Response, err error) {
req := &QueuePauseAction{
Interface: iface,
Paused: paused,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueLogAction Adds custom entry in queue_log.
type QueueLogAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Queue string
Event string
Uniqueid string
Interface string
Message string
}
func (QueueLogAction) ActionTypeName() string {
return "QueueLog"
}
func (a QueueLogAction) GetActionID() string {
return a.ActionID
}
func (a *QueueLogAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueLog(queue string, event string, opts ...RequestOption) (res *Response, err error) {
req := &QueueLogAction{
Queue: queue,
Event: event,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueuePenaltyAction Set the penalty for a queue member.
type QueuePenaltyAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Interface The interface (tech/name) of the member whose penalty to change.
Interface string
// Penalty The new penalty (number) for the member. Must be nonnegative.
Penalty string
// Queue If specified, only set the penalty for the member of this queue. Otherwise, set the penalty for the member in all queues to which the member belongs.
Queue string
}
func (QueuePenaltyAction) ActionTypeName() string {
return "QueuePenalty"
}
func (a QueuePenaltyAction) GetActionID() string {
return a.ActionID
}
func (a *QueuePenaltyAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueuePenalty(iface string, penalty string, opts ...RequestOption) (res *Response, err error) {
req := &QueuePenaltyAction{
Interface: iface,
Penalty: penalty,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueMemberRingInUseAction Set the ringinuse value for a queue member.
type QueueMemberRingInUseAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Interface string
RingInUse string
Queue string
}
func (QueueMemberRingInUseAction) ActionTypeName() string {
return "QueueMemberRingInUse"
}
func (a QueueMemberRingInUseAction) GetActionID() string {
return a.ActionID
}
func (a *QueueMemberRingInUseAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueMemberRingInUse(iface string, ringInUse string, opts ...RequestOption) (res *Response, err error) {
req := &QueueMemberRingInUseAction{
Interface: iface,
RingInUse: ringInUse,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueRuleAction Queue Rules.
type QueueRuleAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Rule The name of the rule in queuerules.conf whose contents to list.
Rule string
}
func (QueueRuleAction) ActionTypeName() string {
return "QueueRule"
}
func (a QueueRuleAction) GetActionID() string {
return a.ActionID
}
func (a *QueueRuleAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueRule(opts ...RequestOption) (res *Response, err error) {
req := &QueueRuleAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueReloadAction Reload a queue, queues, or any sub-section of a queue or queues.
type QueueReloadAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Queue The name of the queue to take action on. If no queue name is specified, then all queues are affected.
Queue string
// Members Whether to reload the queue's members.
Members string
// Rules Whether to reload queuerules.conf
Rules string
// Parameters Whether to reload the other queue options.
Parameters string
}
func (QueueReloadAction) ActionTypeName() string {
return "QueueReload"
}
func (a QueueReloadAction) GetActionID() string {
return a.ActionID
}
func (a *QueueReloadAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueReload(opts ...RequestOption) (res *Response, err error) {
req := &QueueReloadAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueResetAction Reset queue statistics.
type QueueResetAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Queue The name of the queue on which to reset statistics.
Queue string
}
func (QueueResetAction) ActionTypeName() string {
return "QueueReset"
}
func (a QueueResetAction) GetActionID() string {
return a.ActionID
}
func (a *QueueResetAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueReset(opts ...RequestOption) (res *Response, err error) {
req := &QueueResetAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// QueueChangePriorityCallerAction Change priority of a caller on queue.
type QueueChangePriorityCallerAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Queue The name of the queue to take action on.
Queue string
// Caller The caller (channel) to change priority on queue.
Caller string
// Priority Priority value for change for caller on queue.
Priority int
}
func (QueueChangePriorityCallerAction) ActionTypeName() string {
return "QueueChangePriorityCaller"
}
func (a QueueChangePriorityCallerAction) GetActionID() string {
return a.ActionID
}
func (a *QueueChangePriorityCallerAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) QueueChangePriorityCaller(queue string, caller string, priority int, opts ...RequestOption) (res *Response, err error) {
req := &QueueChangePriorityCallerAction{
Queue: queue,
Caller: caller,
Priority: priority,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PingAction Keepalive command.
type PingAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PingAction) ActionTypeName() string {
return "Ping"
}
func (a PingAction) GetActionID() string {
return a.ActionID
}
func (a *PingAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Ping(opts ...RequestOption) (res *Response, err error) {
req := &PingAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// EventsAction Control Event Flow.
type EventsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
EventMask string
}
func (EventsAction) ActionTypeName() string {
return "Events"
}
func (a EventsAction) GetActionID() string {
return a.ActionID
}
func (a *EventsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Events(eventMask string, opts ...RequestOption) (res *Response, err error) {
req := &EventsAction{
EventMask: eventMask,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// LogoffAction Logoff Manager.
type LogoffAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (LogoffAction) ActionTypeName() string {
return "Logoff"
}
func (a LogoffAction) GetActionID() string {
return a.ActionID
}
func (a *LogoffAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Logoff(opts ...RequestOption) (res *Response, err error) {
req := &LogoffAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// LoginAction Login Manager.
type LoginAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// UserName Username to login with as specified in manager.conf.
UserName string
// Secret Secret to login with as specified in manager.conf.
Secret string
}
func (LoginAction) ActionTypeName() string {
return "Login"
}
func (a LoginAction) GetActionID() string {
return a.ActionID
}
func (a *LoginAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Login(userName string, opts ...RequestOption) (res *Response, err error) {
req := &LoginAction{
UserName: userName,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ChallengeAction Generate Challenge for MD5 Auth.
type ChallengeAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// AuthType Digest algorithm to use in the challenge. Valid values are:
AuthType string
}
func (ChallengeAction) ActionTypeName() string {
return "Challenge"
}
func (a ChallengeAction) GetActionID() string {
return a.ActionID
}
func (a *ChallengeAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Challenge(authType string, opts ...RequestOption) (res *Response, err error) {
req := &ChallengeAction{
AuthType: authType,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// HangupAction Hangup channel.
type HangupAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Example regular expression: /^SIP/provider-.*$/
Channel string
// Cause Numeric hangup cause.
Cause string
}
func (HangupAction) ActionTypeName() string {
return "Hangup"
}
func (a HangupAction) GetActionID() string {
return a.ActionID
}
func (a *HangupAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Hangup(channel string, opts ...RequestOption) (res *Response, err error) {
req := &HangupAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// StatusAction List channel status.
type StatusAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel The name of the channel to query for status.
Channel string
// Variables Comma `,` separated list of variable to include.
Variables string
// AllVariables If set to "true", the Status event will include all channel variables for the requested channel(s).
AllVariables string
}
func (StatusAction) ActionTypeName() string {
return "Status"
}
func (a StatusAction) GetActionID() string {
return a.ActionID
}
func (a *StatusAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// SetvarAction Sets a channel variable or function value.
type SetvarAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel to set variable for.
Channel string
// Variable Variable name, function or expression.
Variable string
// Value Variable or function value.
Value string
}
func (SetvarAction) ActionTypeName() string {
return "Setvar"
}
func (a SetvarAction) GetActionID() string {
return a.ActionID
}
func (a *SetvarAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Setvar(variable string, value string, opts ...RequestOption) (res *Response, err error) {
req := &SetvarAction{
Variable: variable,
Value: value,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// GetvarAction Gets a channel variable or function value.
type GetvarAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel to read variable from.
Channel string
// Variable Variable name, function or expression.
Variable string
}
func (GetvarAction) ActionTypeName() string {
return "Getvar"
}
func (a GetvarAction) GetActionID() string {
return a.ActionID
}
func (a *GetvarAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Getvar(variable string, opts ...RequestOption) (res *Response, err error) {
req := &GetvarAction{
Variable: variable,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// GetConfigAction Retrieve configuration.
type GetConfigAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// FileName Configuration filename (e.g. foo.conf ).
FileName string
// Category Category in configuration file.
Category string
// Filter A comma separated list of name_regex = value_regex expressions which will cause only categories whose variables match all expressions to be considered. The special variable name `TEMPLATES` can be used to control whether templates are included. Passing `include` as the value will include templates along with normal categories. Passing `restrict` as the value will restrict the operation to ONLY templates. Not specifying a `TEMPLATES` expression results in the default behavior which is to not include templates.
Filter string
}
func (GetConfigAction) ActionTypeName() string {
return "GetConfig"
}
func (a GetConfigAction) GetActionID() string {
return a.ActionID
}
func (a *GetConfigAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) GetConfig(fileName string, opts ...RequestOption) (res *Response, err error) {
req := &GetConfigAction{
FileName: fileName,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// GetConfigJSONAction Retrieve configuration (JSON format).
type GetConfigJSONAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// FileName Configuration filename (e.g. foo.conf ).
FileName string
// Category Category in configuration file.
Category string
// Filter A comma separated list of name_regex = value_regex expressions which will cause only categories whose variables match all expressions to be considered. The special variable name `TEMPLATES` can be used to control whether templates are included. Passing `include` as the value will include templates along with normal categories. Passing `restrict` as the value will restrict the operation to ONLY templates. Not specifying a `TEMPLATES` expression results in the default behavior which is to not include templates.
Filter string
}
func (GetConfigJSONAction) ActionTypeName() string {
return "GetConfigJSON"
}
func (a GetConfigJSONAction) GetActionID() string {
return a.ActionID
}
func (a *GetConfigJSONAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) GetConfigJSON(fileName string, opts ...RequestOption) (res *Response, err error) {
req := &GetConfigJSONAction{
FileName: fileName,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// UpdateConfigAction Update basic configuration.
type UpdateConfigAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// SrcFileName Configuration filename to read (e.g. foo.conf ).
SrcFileName string
// DstFileName Configuration filename to write (e.g. foo.conf )
DstFileName string
// Reload Whether or not a reload should take place (or name of specific module).
Reload string
// PreserveEffectiveContext Whether the effective category contents should be preserved on template change. Default is true (pre 13.2 behavior).
PreserveEffectiveContext string
// Action000000 0's represent 6 digit number beginning with 000000.
Action000000 string
// Cat000000 0's represent 6 digit number beginning with 000000.
Cat000000 string
// Var000000 0's represent 6 digit number beginning with 000000.
Var000000 string
// Value000000 0's represent 6 digit number beginning with 000000.
Value000000 string
// Match000000 0's represent 6 digit number beginning with 000000.
Match000000 string
// Line000000 0's represent 6 digit number beginning with 000000.
Line000000 string
// Options000000 0's represent 6 digit number beginning with 000000.
Options000000 string
}
func (UpdateConfigAction) ActionTypeName() string {
return "UpdateConfig"
}
func (a UpdateConfigAction) GetActionID() string {
return a.ActionID
}
func (a *UpdateConfigAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) UpdateConfig(srcFileName string, dstFileName string, opts ...RequestOption) (res *Response, err error) {
req := &UpdateConfigAction{
SrcFileName: srcFileName,
DstFileName: dstFileName,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// CreateConfigAction Creates an empty file in the configuration directory.
type CreateConfigAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// FileName The configuration filename to create (e.g. foo.conf ).
FileName string
}
func (CreateConfigAction) ActionTypeName() string {
return "CreateConfig"
}
func (a CreateConfigAction) GetActionID() string {
return a.ActionID
}
func (a *CreateConfigAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) CreateConfig(fileName string, opts ...RequestOption) (res *Response, err error) {
req := &CreateConfigAction{
FileName: fileName,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ListCategoriesAction List categories in configuration file.
type ListCategoriesAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// FileName Configuration filename (e.g. foo.conf ).
FileName string
}
func (ListCategoriesAction) ActionTypeName() string {
return "ListCategories"
}
func (a ListCategoriesAction) GetActionID() string {
return a.ActionID
}
func (a *ListCategoriesAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ListCategories(fileName string, opts ...RequestOption) (res *Response, err error) {
req := &ListCategoriesAction{
FileName: fileName,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// RedirectAction Redirect (transfer) a call.
type RedirectAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel to redirect.
Channel string
// ExtraChannel Second call leg to transfer (optional).
ExtraChannel string
// Exten Extension to transfer to.
Exten string
// ExtraExten Extension to transfer extrachannel to (optional).
ExtraExten string
// Context Context to transfer to.
Context string
// ExtraContext Context to transfer extrachannel to (optional).
ExtraContext string
// Priority Priority to transfer to.
Priority int
// ExtraPriority Priority to transfer extrachannel to (optional).
ExtraPriority string
}
func (RedirectAction) ActionTypeName() string {
return "Redirect"
}
func (a RedirectAction) GetActionID() string {
return a.ActionID
}
func (a *RedirectAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Redirect(channel string, exten string, context string, priority int, opts ...RequestOption) (res *Response, err error) {
req := &RedirectAction{
Channel: channel,
Exten: exten,
Context: context,
Priority: priority,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// AtxferAction Attended transfer.
type AtxferAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Transferer's channel.
Channel string
// Exten Extension to transfer to.
Exten string
// Context Context to transfer to.
Context string
}
func (AtxferAction) ActionTypeName() string {
return "Atxfer"
}
func (a AtxferAction) GetActionID() string {
return a.ActionID
}
func (a *AtxferAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Atxfer(channel string, exten string, opts ...RequestOption) (res *Response, err error) {
req := &AtxferAction{
Channel: channel,
Exten: exten,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// CancelAtxferAction Cancel an attended transfer.
type CancelAtxferAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel The transferer channel.
Channel string
}
func (CancelAtxferAction) ActionTypeName() string {
return "CancelAtxfer"
}
func (a CancelAtxferAction) GetActionID() string {
return a.ActionID
}
func (a *CancelAtxferAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) CancelAtxfer(channel string, opts ...RequestOption) (res *Response, err error) {
req := &CancelAtxferAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// OriginateAction Originate a call.
type OriginateAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel name to call.
Channel string
// Exten Extension to use (requires `Context` and `Priority`)
Exten string
// Context Context to use (requires `Exten` and `Priority`)
Context string
// Priority Priority to use (requires `Exten` and `Context`)
Priority int
// Application Application to execute.
Application string
// Data Data to use (requires `Application`).
Data string
// Timeout How long to wait for call to be answered (in ms.).
Timeout int
// CallerID Caller ID to be set on the outgoing channel.
CallerID string
// Variable Channel variable to set, multiple Variable: headers are allowed.
Variable string
// Account Account code.
Account string
// EarlyMedia Set to `true` to force call bridge on early media..
EarlyMedia string
// Async Set to `true` for fast origination.
Async string
// Codecs Comma-separated list of codecs to use for this call.
Codecs string
// ChannelId Channel UniqueId to be set on the channel.
ChannelId string
// OtherChannelId Channel UniqueId to be set on the second local channel.
OtherChannelId string
}
func (OriginateAction) ActionTypeName() string {
return "Originate"
}
func (a OriginateAction) GetActionID() string {
return a.ActionID
}
func (a *OriginateAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Originate(channel string, opts ...RequestOption) (res *Response, err error) {
req := &OriginateAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// CommandAction Execute Asterisk CLI Command.
type CommandAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Command Asterisk CLI command to run.
Command string
}
func (CommandAction) ActionTypeName() string {
return "Command"
}
func (a CommandAction) GetActionID() string {
return a.ActionID
}
func (a *CommandAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Command(command string, opts ...RequestOption) (res *Response, err error) {
req := &CommandAction{
Command: command,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ExtensionStateAction Check Extension Status.
type ExtensionStateAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Exten Extension to check state on.
Exten string
// Context Context for extension.
Context string
}
func (ExtensionStateAction) ActionTypeName() string {
return "ExtensionState"
}
func (a ExtensionStateAction) GetActionID() string {
return a.ActionID
}
func (a *ExtensionStateAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ExtensionState(exten string, context string, opts ...RequestOption) (res *Response, err error) {
req := &ExtensionStateAction{
Exten: exten,
Context: context,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PresenceStateAction Check Presence State
type PresenceStateAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Provider Presence Provider to check the state of
Provider string
}
func (PresenceStateAction) ActionTypeName() string {
return "PresenceState"
}
func (a PresenceStateAction) GetActionID() string {
return a.ActionID
}
func (a *PresenceStateAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PresenceState(provider string, opts ...RequestOption) (res *Response, err error) {
req := &PresenceStateAction{
Provider: provider,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// AbsoluteTimeoutAction Set absolute timeout.
type AbsoluteTimeoutAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel name to hangup.
Channel string
// Timeout Maximum duration of the call (sec).
Timeout int
}
func (AbsoluteTimeoutAction) ActionTypeName() string {
return "AbsoluteTimeout"
}
func (a AbsoluteTimeoutAction) GetActionID() string {
return a.ActionID
}
func (a *AbsoluteTimeoutAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) AbsoluteTimeout(channel string, timeout int, opts ...RequestOption) (res *Response, err error) {
req := &AbsoluteTimeoutAction{
Channel: channel,
Timeout: timeout,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MailboxStatusAction Check mailbox.
type MailboxStatusAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Mailbox Full mailbox ID mailbox @ vm-context .
Mailbox string
}
func (MailboxStatusAction) ActionTypeName() string {
return "MailboxStatus"
}
func (a MailboxStatusAction) GetActionID() string {
return a.ActionID
}
func (a *MailboxStatusAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MailboxStatus(mailbox string, opts ...RequestOption) (res *Response, err error) {
req := &MailboxStatusAction{
Mailbox: mailbox,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MailboxCountAction Check Mailbox Message Count.
type MailboxCountAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Mailbox Full mailbox ID mailbox @ vm-context .
Mailbox string
}
func (MailboxCountAction) ActionTypeName() string {
return "MailboxCount"
}
func (a MailboxCountAction) GetActionID() string {
return a.ActionID
}
func (a *MailboxCountAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MailboxCount(mailbox string, opts ...RequestOption) (res *Response, err error) {
req := &MailboxCountAction{
Mailbox: mailbox,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ListCommandsAction List available manager commands.
type ListCommandsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (ListCommandsAction) ActionTypeName() string {
return "ListCommands"
}
func (a ListCommandsAction) GetActionID() string {
return a.ActionID
}
func (a *ListCommandsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ListCommands(opts ...RequestOption) (res *Response, err error) {
req := &ListCommandsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SendTextAction Sends a text message to channel. A content type can be optionally specified. If not set
// it is set to an empty string allowing a custom handler to default it as it sees fit.
type SendTextAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel to send message to.
Channel string
// Message Message to send.
Message string
// ContentType The type of content in the message
ContentType string
}
func (SendTextAction) ActionTypeName() string {
return "SendText"
}
func (a SendTextAction) GetActionID() string {
return a.ActionID
}
func (a *SendTextAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SendText(channel string, message string, opts ...RequestOption) (res *Response, err error) {
req := &SendTextAction{
Channel: channel,
Message: message,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// UserEventAction Send an arbitrary event.
type UserEventAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// UserEvent Event string to send.
UserEvent string
// Header1 Content1.
Header1 string
// HeaderN ContentN.
HeaderN string
}
func (UserEventAction) ActionTypeName() string {
return "UserEvent"
}
func (a UserEventAction) GetActionID() string {
return a.ActionID
}
func (a *UserEventAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) UserEvent(userEvent string, opts ...RequestOption) (res *Response, err error) {
req := &UserEventAction{
UserEvent: userEvent,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// WaitEventAction Wait for an event to occur.
type WaitEventAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Timeout Maximum time (in seconds) to wait for events, `-1` means forever.
Timeout int
}
func (WaitEventAction) ActionTypeName() string {
return "WaitEvent"
}
func (a WaitEventAction) GetActionID() string {
return a.ActionID
}
func (a *WaitEventAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) WaitEvent(timeout int, opts ...RequestOption) (res *Response, err error) {
req := &WaitEventAction{
Timeout: timeout,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// CoreSettingsAction Show PBX core settings (version etc).
type CoreSettingsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (CoreSettingsAction) ActionTypeName() string {
return "CoreSettings"
}
func (a CoreSettingsAction) GetActionID() string {
return a.ActionID
}
func (a *CoreSettingsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) CoreSettings(opts ...RequestOption) (res *Response, err error) {
req := &CoreSettingsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// CoreStatusAction Show PBX core status variables.
type CoreStatusAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (CoreStatusAction) ActionTypeName() string {
return "CoreStatus"
}
func (a CoreStatusAction) GetActionID() string {
return a.ActionID
}
func (a *CoreStatusAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) CoreStatus(opts ...RequestOption) (res *Response, err error) {
req := &CoreStatusAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ReloadAction Send a reload event.
type ReloadAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Module Name of the module to reload.
Module string
}
func (ReloadAction) ActionTypeName() string {
return "Reload"
}
func (a ReloadAction) GetActionID() string {
return a.ActionID
}
func (a *ReloadAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Reload(opts ...RequestOption) (res *Response, err error) {
req := &ReloadAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// CoreShowChannelsAction List currently active channels.
type CoreShowChannelsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (CoreShowChannelsAction) ActionTypeName() string {
return "CoreShowChannels"
}
func (a CoreShowChannelsAction) GetActionID() string {
return a.ActionID
}
func (a *CoreShowChannelsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// LoggerRotateAction Reload and rotate the Asterisk logger.
type LoggerRotateAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (LoggerRotateAction) ActionTypeName() string {
return "LoggerRotate"
}
func (a LoggerRotateAction) GetActionID() string {
return a.ActionID
}
func (a *LoggerRotateAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) LoggerRotate(opts ...RequestOption) (res *Response, err error) {
req := &LoggerRotateAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ModuleLoadAction Module management.
type ModuleLoadAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Module Asterisk module name (including .so extension) or subsystem identifier:
Module string
// LoadType If no module is specified for a `reload` loadtype, all modules are reloaded.
LoadType string
}
func (ModuleLoadAction) ActionTypeName() string {
return "ModuleLoad"
}
func (a ModuleLoadAction) GetActionID() string {
return a.ActionID
}
func (a *ModuleLoadAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ModuleLoad(loadType string, opts ...RequestOption) (res *Response, err error) {
req := &ModuleLoadAction{
LoadType: loadType,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ModuleCheckAction Check if module is loaded.
type ModuleCheckAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Module Asterisk module name (not including extension).
Module string
}
func (ModuleCheckAction) ActionTypeName() string {
return "ModuleCheck"
}
func (a ModuleCheckAction) GetActionID() string {
return a.ActionID
}
func (a *ModuleCheckAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ModuleCheck(module string, opts ...RequestOption) (res *Response, err error) {
req := &ModuleCheckAction{
Module: module,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// AOCMessageAction Generate an Advice of Charge message on a channel.
type AOCMessageAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel name to generate the AOC message on.
Channel string
// ChannelPrefix Partial channel prefix. By using this option one can match the beginning part of a channel name without having to put the entire name in. For example if a channel name is SIP/snom-00000001 and this value is set to SIP/snom, then that channel matches and the message will be sent. Note however that only the first matched channel has the message sent on it.
ChannelPrefix string
// MsgType Defines what type of AOC message to create, AOC-D or AOC-E
MsgType string
// ChargeType Defines what kind of charge this message represents.
ChargeType string
// UnitAmount0 This represents the amount of units charged. The ETSI AOC standard specifies that this value along with the optional UnitType value are entries in a list. To accommodate this these values take an index value starting at 0 which can be used to generate this list of unit entries. For Example, If two unit entires were required this could be achieved by setting the paramter UnitAmount(0)=1234 and UnitAmount(1)=5678. Note that UnitAmount at index 0 is required when ChargeType=Unit, all other entries in the list are optional.
UnitAmount0 string
// UnitType0 Defines the type of unit. ETSI AOC standard specifies this as an integer value between 1 and 16, but this value is left open to accept any positive integer. Like the UnitAmount parameter, this value represents a list entry and has an index parameter that starts at 0.
UnitType0 string
// CurrencyName Specifies the currency's name. Note that this value is truncated after 10 characters.
CurrencyName string
// CurrencyAmount Specifies the charge unit amount as a positive integer. This value is required when ChargeType==Currency.
CurrencyAmount string
// CurrencyMultiplier Specifies the currency multiplier. This value is required when ChargeType==Currency.
CurrencyMultiplier string
// TotalType Defines what kind of AOC-D total is represented.
TotalType string
// AOCBillingId Represents a billing ID associated with an AOC-D or AOC-E message. Note that only the first 3 items of the enum are valid AOC-D billing IDs
AOCBillingId string
// ChargingAssociationId Charging association identifier. This is optional for AOC-E and can be set to any value between -32768 and 32767
ChargingAssociationId string
// ChargingAssociationNumber Represents the charging association party number. This value is optional for AOC-E.
ChargingAssociationNumber string
// ChargingAssociationPlan Integer representing the charging plan associated with the ChargingAssociationNumber. The value is bits 7 through 1 of the Q.931 octet containing the type-of-number and numbering-plan-identification fields.
ChargingAssociationPlan string
}
func (AOCMessageAction) ActionTypeName() string {
return "AOCMessage"
}
func (a AOCMessageAction) GetActionID() string {
return a.ActionID
}
func (a *AOCMessageAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) AOCMessage(channel string, msgType string, chargeType string, opts ...RequestOption) (res *Response, err error) {
req := &AOCMessageAction{
Channel: channel,
MsgType: msgType,
ChargeType: chargeType,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// FilterAction Dynamically add filters for the current manager session.
type FilterAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Operation string
// Filter - If there are both white and black filters: implied black all filter processed first, then white filters, and lastly black filters.
Filter string
}
func (FilterAction) ActionTypeName() string {
return "Filter"
}
func (a FilterAction) GetActionID() string {
return a.ActionID
}
func (a *FilterAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Filter(opts ...RequestOption) (res *Response, err error) {
req := &FilterAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// FilterListAction Show current event filters for this session
type FilterListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (FilterListAction) ActionTypeName() string {
return "FilterList"
}
func (a FilterListAction) GetActionID() string {
return a.ActionID
}
func (a *FilterListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) FilterList(opts ...RequestOption) (res *Response, err error) {
req := &FilterListAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BlindTransferAction Blind transfer channel(s) to the given destination
type BlindTransferAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Channel string
Context string
Exten string
}
func (BlindTransferAction) ActionTypeName() string {
return "BlindTransfer"
}
func (a BlindTransferAction) GetActionID() string {
return a.ActionID
}
func (a *BlindTransferAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) BlindTransfer(channel string, opts ...RequestOption) (res *Response, err error) {
req := &BlindTransferAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BridgeAction Bridge two channels already in the PBX.
type BridgeAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel1 Channel to Bridge to Channel2.
Channel1 string
// Channel2 Channel to Bridge to Channel1.
Channel2 string
// Tone Play courtesy tone to Channel 2.
Tone string
}
func (BridgeAction) ActionTypeName() string {
return "Bridge"
}
func (a BridgeAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Bridge(channel1 string, channel2 string, opts ...RequestOption) (res *Response, err error) {
req := &BridgeAction{
Channel1: channel1,
Channel2: channel2,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DBGetAction Get DB Entry.
type DBGetAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Family string
Key string
}
func (DBGetAction) ActionTypeName() string {
return "DBGet"
}
func (a DBGetAction) GetActionID() string {
return a.ActionID
}
func (a *DBGetAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DBGet(family string, key string, opts ...RequestOption) (res *Response, err error) {
req := &DBGetAction{
Family: family,
Key: key,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DBPutAction Put DB entry.
type DBPutAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Family string
Key string
Val string
}
func (DBPutAction) ActionTypeName() string {
return "DBPut"
}
func (a DBPutAction) GetActionID() string {
return a.ActionID
}
func (a *DBPutAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DBPut(family string, key string, opts ...RequestOption) (res *Response, err error) {
req := &DBPutAction{
Family: family,
Key: key,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DBDelAction Delete DB entry.
type DBDelAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Family string
Key string
}
func (DBDelAction) ActionTypeName() string {
return "DBDel"
}
func (a DBDelAction) GetActionID() string {
return a.ActionID
}
func (a *DBDelAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DBDel(family string, key string, opts ...RequestOption) (res *Response, err error) {
req := &DBDelAction{
Family: family,
Key: key,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DBDelTreeAction Delete DB Tree.
type DBDelTreeAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
Family string
Key string
}
func (DBDelTreeAction) ActionTypeName() string {
return "DBDelTree"
}
func (a DBDelTreeAction) GetActionID() string {
return a.ActionID
}
func (a *DBDelTreeAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) DBDelTree(family string, opts ...RequestOption) (res *Response, err error) {
req := &DBDelTreeAction{
Family: family,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ShowDialPlanAction Show dialplan contexts and extensions
type ShowDialPlanAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Extension Show a specific extension.
Extension string
// Context Show a specific context.
Context string
}
func (ShowDialPlanAction) ActionTypeName() string {
return "ShowDialPlan"
}
func (a ShowDialPlanAction) GetActionID() string {
return a.ActionID
}
func (a *ShowDialPlanAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ShowDialPlan(opts ...RequestOption) (res *Response, err error) {
req := &ShowDialPlanAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ExtensionStateListAction List the current known extension states.
type ExtensionStateListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (ExtensionStateListAction) ActionTypeName() string {
return "ExtensionStateList"
}
func (a ExtensionStateListAction) GetActionID() string {
return a.ActionID
}
func (a *ExtensionStateListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// MessageSendAction Send an out of call message to an endpoint.
type MessageSendAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// To The URI the message is to be sent to.
To string
// From A From URI for the message if needed for the message technology being used to send this message.
From string
// Body The message body text. This must not contain any newlines as that conflicts with the AMI protocol.
Body string
// Base64Body Text bodies requiring the use of newlines have to be base64 encoded in this field. Base64Body will be decoded before being sent out. Base64Body takes precedence over Body.
Base64Body string
// Variable Message variable to set, multiple Variable: headers are allowed. The header value is a comma separated list of name=value pairs.
Variable string
}
func (MessageSendAction) ActionTypeName() string {
return "MessageSend"
}
func (a MessageSendAction) GetActionID() string {
return a.ActionID
}
func (a *MessageSendAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MessageSend(to string, opts ...RequestOption) (res *Response, err error) {
req := &MessageSendAction{
To: to,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// LocalOptimizeAwayAction Optimize away a local channel when possible.
type LocalOptimizeAwayAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel The channel name to optimize away.
Channel string
}
func (LocalOptimizeAwayAction) ActionTypeName() string {
return "LocalOptimizeAway"
}
func (a LocalOptimizeAwayAction) GetActionID() string {
return a.ActionID
}
func (a *LocalOptimizeAwayAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) LocalOptimizeAway(channel string, opts ...RequestOption) (res *Response, err error) {
req := &LocalOptimizeAwayAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BridgeTechnologyListAction List available bridging technologies and their statuses.
type BridgeTechnologyListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (BridgeTechnologyListAction) ActionTypeName() string {
return "BridgeTechnologyList"
}
func (a BridgeTechnologyListAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeTechnologyListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) BridgeTechnologyList(opts ...RequestOption) (res *Response, err error) {
req := &BridgeTechnologyListAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BridgeTechnologySuspendAction Suspend a bridging technology.
type BridgeTechnologySuspendAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// BridgeTechnology The name of the bridging technology to suspend.
BridgeTechnology string
}
func (BridgeTechnologySuspendAction) ActionTypeName() string {
return "BridgeTechnologySuspend"
}
func (a BridgeTechnologySuspendAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeTechnologySuspendAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) BridgeTechnologySuspend(bridgeTechnology string, opts ...RequestOption) (res *Response, err error) {
req := &BridgeTechnologySuspendAction{
BridgeTechnology: bridgeTechnology,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BridgeTechnologyUnsuspendAction Unsuspend a bridging technology.
type BridgeTechnologyUnsuspendAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// BridgeTechnology The name of the bridging technology to unsuspend.
BridgeTechnology string
}
func (BridgeTechnologyUnsuspendAction) ActionTypeName() string {
return "BridgeTechnologyUnsuspend"
}
func (a BridgeTechnologyUnsuspendAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeTechnologyUnsuspendAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) BridgeTechnologyUnsuspend(bridgeTechnology string, opts ...RequestOption) (res *Response, err error) {
req := &BridgeTechnologyUnsuspendAction{
BridgeTechnology: bridgeTechnology,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BridgeListAction Get a list of bridges in the system.
type BridgeListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// BridgeType Optional type for filtering the resulting list of bridges.
BridgeType string
}
func (BridgeListAction) ActionTypeName() string {
return "BridgeList"
}
func (a BridgeListAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) BridgeList(opts ...RequestOption) (res *Response, err error) {
req := &BridgeListAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BridgeInfoAction Get information about a bridge.
type BridgeInfoAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// BridgeUniqueid The unique ID of the bridge about which to retrieve information.
BridgeUniqueid string
}
func (BridgeInfoAction) ActionTypeName() string {
return "BridgeInfo"
}
func (a BridgeInfoAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeInfoAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// BridgeDestroyAction Destroy a bridge.
type BridgeDestroyAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// BridgeUniqueid The unique ID of the bridge to destroy.
BridgeUniqueid string
}
func (BridgeDestroyAction) ActionTypeName() string {
return "BridgeDestroy"
}
func (a BridgeDestroyAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeDestroyAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) BridgeDestroy(bridgeUniqueid string, opts ...RequestOption) (res *Response, err error) {
req := &BridgeDestroyAction{
BridgeUniqueid: bridgeUniqueid,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// BridgeKickAction Kick a channel from a bridge.
type BridgeKickAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// BridgeUniqueid The unique ID of the bridge containing the channel to destroy. This parameter can be omitted, or supplied to insure that the channel is not removed from the wrong bridge.
BridgeUniqueid string
// Channel The channel to kick out of a bridge.
Channel string
}
func (BridgeKickAction) ActionTypeName() string {
return "BridgeKick"
}
func (a BridgeKickAction) GetActionID() string {
return a.ActionID
}
func (a *BridgeKickAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) BridgeKick(channel string, opts ...RequestOption) (res *Response, err error) {
req := &BridgeKickAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PresenceStateListAction List the current known presence states.
type PresenceStateListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PresenceStateListAction) ActionTypeName() string {
return "PresenceStateList"
}
func (a PresenceStateListAction) GetActionID() string {
return a.ActionID
}
func (a *PresenceStateListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// ParkinglotsAction Get a list of parking lots
type ParkinglotsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (ParkinglotsAction) ActionTypeName() string {
return "Parkinglots"
}
func (a ParkinglotsAction) GetActionID() string {
return a.ActionID
}
func (a *ParkinglotsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Parkinglots(opts ...RequestOption) (res *Response, err error) {
req := &ParkinglotsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ParkedCallsAction List parked calls.
type ParkedCallsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// ParkingLot If specified, only show parked calls from the parking lot with this name.
ParkingLot string
}
func (ParkedCallsAction) ActionTypeName() string {
return "ParkedCalls"
}
func (a ParkedCallsAction) GetActionID() string {
return a.ActionID
}
func (a *ParkedCallsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ParkedCalls(opts ...RequestOption) (res *Response, err error) {
req := &ParkedCallsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ParkAction Park a channel.
type ParkAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel name to park.
Channel string
// TimeoutChannel Channel name to use when constructing the dial string that will be dialed if the parked channel times out. If `TimeoutChannel` is in a two party bridge with `Channel`, then `TimeoutChannel` will receive an announcement and be treated as having parked `Channel` in the same manner as the Park Call DTMF feature.
TimeoutChannel string
// AnnounceChannel If specified, then this channel will receive an announcement when `Channel` is parked if `AnnounceChannel` is in a state where it can receive announcements (AnnounceChannel must be bridged). `AnnounceChannel` has no bearing on the actual state of the parked call.
AnnounceChannel string
// Timeout Overrides the timeout of the parking lot for this park action. Specified in milliseconds, but will be converted to seconds. Use a value of 0 to disable the timeout.
Timeout int
// Parkinglot The parking lot to use when parking the channel
Parkinglot string
}
func (ParkAction) ActionTypeName() string {
return "Park"
}
func (a ParkAction) GetActionID() string {
return a.ActionID
}
func (a *ParkAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Park(channel string, opts ...RequestOption) (res *Response, err error) {
req := &ParkAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MWIGetAction Get selected mailboxes with message counts.
type MWIGetAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Mailbox Mailbox ID in the form of / regex / for all mailboxes matching the regular expression. Otherwise it is for a specific mailbox.
Mailbox string
}
func (MWIGetAction) ActionTypeName() string {
return "MWIGet"
}
func (a MWIGetAction) GetActionID() string {
return a.ActionID
}
func (a *MWIGetAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MWIGet(mailbox string, opts ...RequestOption) (res *Response, err error) {
req := &MWIGetAction{
Mailbox: mailbox,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MWIDeleteAction Delete selected mailboxes.
type MWIDeleteAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Mailbox Mailbox ID in the form of / regex / for all mailboxes matching the regular expression. Otherwise it is for a specific mailbox.
Mailbox string
}
func (MWIDeleteAction) ActionTypeName() string {
return "MWIDelete"
}
func (a MWIDeleteAction) GetActionID() string {
return a.ActionID
}
func (a *MWIDeleteAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MWIDelete(mailbox string, opts ...RequestOption) (res *Response, err error) {
req := &MWIDeleteAction{
Mailbox: mailbox,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MWIUpdateAction Update the mailbox message counts.
type MWIUpdateAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Mailbox Specific mailbox ID.
Mailbox string
// OldMessages The number of old messages in the mailbox. Defaults to zero if missing.
OldMessages string
// NewMessages The number of new messages in the mailbox. Defaults to zero if missing.
NewMessages string
}
func (MWIUpdateAction) ActionTypeName() string {
return "MWIUpdate"
}
func (a MWIUpdateAction) GetActionID() string {
return a.ActionID
}
func (a *MWIUpdateAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MWIUpdate(mailbox string, opts ...RequestOption) (res *Response, err error) {
req := &MWIUpdateAction{
Mailbox: mailbox,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPShowRegistrationsInboundAction Lists PJSIP inbound registrations.
type PJSIPShowRegistrationsInboundAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowRegistrationsInboundAction) ActionTypeName() string {
return "PJSIPShowRegistrationsInbound"
}
func (a PJSIPShowRegistrationsInboundAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowRegistrationsInboundAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPShowRegistrationsInbound(opts ...RequestOption) (res *Response, err error) {
req := &PJSIPShowRegistrationsInboundAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPShowRegistrationInboundContactStatusesAction Lists ContactStatuses for PJSIP inbound registrations.
type PJSIPShowRegistrationInboundContactStatusesAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowRegistrationInboundContactStatusesAction) ActionTypeName() string {
return "PJSIPShowRegistrationInboundContactStatuses"
}
func (a PJSIPShowRegistrationInboundContactStatusesAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowRegistrationInboundContactStatusesAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPShowRegistrationInboundContactStatuses(opts ...RequestOption) (res *Response, err error) {
req := &PJSIPShowRegistrationInboundContactStatusesAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPNotifyAction Send a NOTIFY to either an endpoint, an arbitrary URI, or inside a SIP dialog.
type PJSIPNotifyAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Endpoint The endpoint to which to send the NOTIFY.
Endpoint string
// URI Abritrary URI to which to send the NOTIFY.
URI string
// Channel Channel name to send the NOTIFY. Must be a PJSIP channel.
Channel string
// Variable Appends variables as headers/content to the NOTIFY. If the variable is named `Content`, then the value will compose the body of the message if another variable sets `Content-Type`. name = value
Variable string
}
func (PJSIPNotifyAction) ActionTypeName() string {
return "PJSIPNotify"
}
func (a PJSIPNotifyAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPNotifyAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPNotify(variable string, opts ...RequestOption) (res *Response, err error) {
req := &PJSIPNotifyAction{
Variable: variable,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPQualifyAction Qualify a chan_pjsip endpoint.
type PJSIPQualifyAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Endpoint The endpoint you want to qualify.
Endpoint string
}
func (PJSIPQualifyAction) ActionTypeName() string {
return "PJSIPQualify"
}
func (a PJSIPQualifyAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPQualifyAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPQualify(endpoint string, opts ...RequestOption) (res *Response, err error) {
req := &PJSIPQualifyAction{
Endpoint: endpoint,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPShowEndpointsAction Lists PJSIP endpoints.
type PJSIPShowEndpointsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowEndpointsAction) ActionTypeName() string {
return "PJSIPShowEndpoints"
}
func (a PJSIPShowEndpointsAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowEndpointsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// PJSIPShowEndpointAction Detail listing of an endpoint and its objects.
type PJSIPShowEndpointAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Endpoint The endpoint to list.
Endpoint string
}
func (PJSIPShowEndpointAction) ActionTypeName() string {
return "PJSIPShowEndpoint"
}
func (a PJSIPShowEndpointAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowEndpointAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// PJSIPShowAorsAction Lists PJSIP AORs.
type PJSIPShowAorsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowAorsAction) ActionTypeName() string {
return "PJSIPShowAors"
}
func (a PJSIPShowAorsAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowAorsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// PJSIPShowAuthsAction Lists PJSIP Auths.
type PJSIPShowAuthsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowAuthsAction) ActionTypeName() string {
return "PJSIPShowAuths"
}
func (a PJSIPShowAuthsAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowAuthsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// PJSIPShowContactsAction Lists PJSIP Contacts.
type PJSIPShowContactsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowContactsAction) ActionTypeName() string {
return "PJSIPShowContacts"
}
func (a PJSIPShowContactsAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowContactsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// FAXSessionsAction Lists active FAX sessions
type FAXSessionsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (FAXSessionsAction) ActionTypeName() string {
return "FAXSessions"
}
func (a FAXSessionsAction) GetActionID() string {
return a.ActionID
}
func (a *FAXSessionsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) FAXSessions(opts ...RequestOption) (res *Response, err error) {
req := &FAXSessionsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// FAXSessionAction Responds with a detailed description of a single FAX session
type FAXSessionAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// SessionNumber The session ID of the fax the user is interested in.
SessionNumber string
}
func (FAXSessionAction) ActionTypeName() string {
return "FAXSession"
}
func (a FAXSessionAction) GetActionID() string {
return a.ActionID
}
func (a *FAXSessionAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) FAXSession(sessionNumber string, opts ...RequestOption) (res *Response, err error) {
req := &FAXSessionAction{
SessionNumber: sessionNumber,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// FAXStatsAction Responds with fax statistics
type FAXStatsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (FAXStatsAction) ActionTypeName() string {
return "FAXStats"
}
func (a FAXStatsAction) GetActionID() string {
return a.ActionID
}
func (a *FAXStatsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) FAXStats(opts ...RequestOption) (res *Response, err error) {
req := &FAXStatsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPUnregisterAction Unregister an outbound registration.
type PJSIPUnregisterAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Registration The outbound registration to unregister or '*all' to unregister them all.
Registration string
}
func (PJSIPUnregisterAction) ActionTypeName() string {
return "PJSIPUnregister"
}
func (a PJSIPUnregisterAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPUnregisterAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPUnregister(registration string, opts ...RequestOption) (res *Response, err error) {
req := &PJSIPUnregisterAction{
Registration: registration,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPRegisterAction Register an outbound registration.
type PJSIPRegisterAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Registration The outbound registration to register or '*all' to register them all.
Registration string
}
func (PJSIPRegisterAction) ActionTypeName() string {
return "PJSIPRegister"
}
func (a PJSIPRegisterAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPRegisterAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPRegister(registration string, opts ...RequestOption) (res *Response, err error) {
req := &PJSIPRegisterAction{
Registration: registration,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPShowRegistrationsOutboundAction Lists PJSIP outbound registrations.
type PJSIPShowRegistrationsOutboundAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowRegistrationsOutboundAction) ActionTypeName() string {
return "PJSIPShowRegistrationsOutbound"
}
func (a PJSIPShowRegistrationsOutboundAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowRegistrationsOutboundAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPShowRegistrationsOutbound(opts ...RequestOption) (res *Response, err error) {
req := &PJSIPShowRegistrationsOutboundAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MuteAudioAction Mute an audio stream.
type MuteAudioAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel The channel you want to mute.
Channel string
Direction string
State string
}
func (MuteAudioAction) ActionTypeName() string {
return "MuteAudio"
}
func (a MuteAudioAction) GetActionID() string {
return a.ActionID
}
func (a *MuteAudioAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) MuteAudio(channel string, direction string, state string, opts ...RequestOption) (res *Response, err error) {
req := &MuteAudioAction{
Channel: channel,
Direction: direction,
State: state,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// MonitorAction Monitor a channel.
type MonitorAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Used to specify the channel to record.
Channel string
// File Is the name of the file created in the monitor spool directory. Defaults to the same name as the channel (with slashes replaced with dashes).
File string
Format string // default to wav
// Mix Boolean parameter as to whether to mix the input and output channels together after the recording is finished.
Mix string
}
func (MonitorAction) ActionTypeName() string {
return "Monitor"
}
func (a MonitorAction) GetActionID() string {
return a.ActionID
}
func (a *MonitorAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) Monitor(channel string, opts ...RequestOption) (res *Response, err error) {
req := &MonitorAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// StopMonitorAction Stop monitoring a channel.
type StopMonitorAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel The name of the channel monitored.
Channel string
}
func (StopMonitorAction) ActionTypeName() string {
return "StopMonitor"
}
func (a StopMonitorAction) GetActionID() string {
return a.ActionID
}
func (a *StopMonitorAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) StopMonitor(channel string, opts ...RequestOption) (res *Response, err error) {
req := &StopMonitorAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// ChangeMonitorAction Change monitoring filename of a channel.
type ChangeMonitorAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Used to specify the channel to record.
Channel string
// File Is the new name of the file created in the monitor spool directory.
File string
}
func (ChangeMonitorAction) ActionTypeName() string {
return "ChangeMonitor"
}
func (a ChangeMonitorAction) GetActionID() string {
return a.ActionID
}
func (a *ChangeMonitorAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) ChangeMonitor(channel string, file string, opts ...RequestOption) (res *Response, err error) {
req := &ChangeMonitorAction{
Channel: channel,
File: file,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PauseMonitorAction Pause monitoring of a channel.
type PauseMonitorAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Used to specify the channel to record.
Channel string
}
func (PauseMonitorAction) ActionTypeName() string {
return "PauseMonitor"
}
func (a PauseMonitorAction) GetActionID() string {
return a.ActionID
}
func (a *PauseMonitorAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PauseMonitor(channel string, opts ...RequestOption) (res *Response, err error) {
req := &PauseMonitorAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// UnpauseMonitorAction Unpause monitoring of a channel.
type UnpauseMonitorAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Used to specify the channel to record.
Channel string
}
func (UnpauseMonitorAction) ActionTypeName() string {
return "UnpauseMonitor"
}
func (a UnpauseMonitorAction) GetActionID() string {
return a.ActionID
}
func (a *UnpauseMonitorAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) UnpauseMonitor(channel string, opts ...RequestOption) (res *Response, err error) {
req := &UnpauseMonitorAction{
Channel: channel,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPShowSubscriptionsInboundAction Lists subscriptions.
type PJSIPShowSubscriptionsInboundAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowSubscriptionsInboundAction) ActionTypeName() string {
return "PJSIPShowSubscriptionsInbound"
}
func (a PJSIPShowSubscriptionsInboundAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowSubscriptionsInboundAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPShowSubscriptionsInbound(opts ...RequestOption) (res *Response, err error) {
req := &PJSIPShowSubscriptionsInboundAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPShowSubscriptionsOutboundAction Lists subscriptions.
type PJSIPShowSubscriptionsOutboundAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowSubscriptionsOutboundAction) ActionTypeName() string {
return "PJSIPShowSubscriptionsOutbound"
}
func (a PJSIPShowSubscriptionsOutboundAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowSubscriptionsOutboundAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPShowSubscriptionsOutbound(opts ...RequestOption) (res *Response, err error) {
req := &PJSIPShowSubscriptionsOutboundAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// PJSIPShowResourceListsAction Displays settings for configured resource lists.
type PJSIPShowResourceListsAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (PJSIPShowResourceListsAction) ActionTypeName() string {
return "PJSIPShowResourceLists"
}
func (a PJSIPShowResourceListsAction) GetActionID() string {
return a.ActionID
}
func (a *PJSIPShowResourceListsAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) PJSIPShowResourceLists(opts ...RequestOption) (res *Response, err error) {
req := &PJSIPShowResourceListsAction{}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// AGIAction Add an AGI command to execute by Async AGI.
type AGIAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Channel Channel that is currently in Async AGI.
Channel string
// Command Application to execute.
Command string
// CommandID This will be sent back in CommandID header of AsyncAGI exec event notification.
CommandID string
}
func (AGIAction) ActionTypeName() string {
return "AGI"
}
func (a AGIAction) GetActionID() string {
return a.ActionID
}
func (a *AGIAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) AGI(channel string, command string, opts ...RequestOption) (res *Response, err error) {
req := &AGIAction{
Channel: channel,
Command: command,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// DeviceStateListAction List the current known device states.
type DeviceStateListAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (DeviceStateListAction) ActionTypeName() string {
return "DeviceStateList"
}
func (a DeviceStateListAction) GetActionID() string {
return a.ActionID
}
func (a *DeviceStateListAction) SetActionID(actionID string) {
a.ActionID = actionID
}
// SorceryMemoryCacheExpireObjectAction Expire (remove) an object from a sorcery memory cache.
type SorceryMemoryCacheExpireObjectAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Cache The name of the cache to expire the object from.
Cache string
// Object The name of the object to expire.
Object string
}
func (SorceryMemoryCacheExpireObjectAction) ActionTypeName() string {
return "SorceryMemoryCacheExpireObject"
}
func (a SorceryMemoryCacheExpireObjectAction) GetActionID() string {
return a.ActionID
}
func (a *SorceryMemoryCacheExpireObjectAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SorceryMemoryCacheExpireObject(cache string, object string, opts ...RequestOption) (res *Response, err error) {
req := &SorceryMemoryCacheExpireObjectAction{
Cache: cache,
Object: object,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SorceryMemoryCacheExpireAction Expire (remove) ALL objects from a sorcery memory cache.
type SorceryMemoryCacheExpireAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Cache The name of the cache to expire all objects from.
Cache string
}
func (SorceryMemoryCacheExpireAction) ActionTypeName() string {
return "SorceryMemoryCacheExpire"
}
func (a SorceryMemoryCacheExpireAction) GetActionID() string {
return a.ActionID
}
func (a *SorceryMemoryCacheExpireAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SorceryMemoryCacheExpire(cache string, opts ...RequestOption) (res *Response, err error) {
req := &SorceryMemoryCacheExpireAction{
Cache: cache,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SorceryMemoryCacheStaleObjectAction Mark an object in a sorcery memory cache as stale.
type SorceryMemoryCacheStaleObjectAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Cache The name of the cache to mark the object as stale in.
Cache string
// Object The name of the object to mark as stale.
Object string
// Reload If true, then immediately reload the object from the backend cache instead of waiting for the next retrieval
Reload string
}
func (SorceryMemoryCacheStaleObjectAction) ActionTypeName() string {
return "SorceryMemoryCacheStaleObject"
}
func (a SorceryMemoryCacheStaleObjectAction) GetActionID() string {
return a.ActionID
}
func (a *SorceryMemoryCacheStaleObjectAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SorceryMemoryCacheStaleObject(cache string, object string, opts ...RequestOption) (res *Response, err error) {
req := &SorceryMemoryCacheStaleObjectAction{
Cache: cache,
Object: object,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SorceryMemoryCacheStaleAction Marks ALL objects in a sorcery memory cache as stale.
type SorceryMemoryCacheStaleAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Cache The name of the cache to mark all object as stale in.
Cache string
}
func (SorceryMemoryCacheStaleAction) ActionTypeName() string {
return "SorceryMemoryCacheStale"
}
func (a SorceryMemoryCacheStaleAction) GetActionID() string {
return a.ActionID
}
func (a *SorceryMemoryCacheStaleAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SorceryMemoryCacheStale(cache string, opts ...RequestOption) (res *Response, err error) {
req := &SorceryMemoryCacheStaleAction{
Cache: cache,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// SorceryMemoryCachePopulateAction Expire all objects from a memory cache and populate it with all objects from the backend.
type SorceryMemoryCachePopulateAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Cache The name of the cache to populate.
Cache string
}
func (SorceryMemoryCachePopulateAction) ActionTypeName() string {
return "SorceryMemoryCachePopulate"
}
func (a SorceryMemoryCachePopulateAction) GetActionID() string {
return a.ActionID
}
func (a *SorceryMemoryCachePopulateAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) SorceryMemoryCachePopulate(cache string, opts ...RequestOption) (res *Response, err error) {
req := &SorceryMemoryCachePopulateAction{
Cache: cache,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
// JabberSendAction Sends a message to a Jabber Client.
type JabberSendAction struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// Jabber Client or transport Asterisk uses to connect to JABBER.
Jabber string
// JID XMPP/Jabber JID (Name) of recipient.
JID string
// Message Message to be sent to the buddy.
Message string
}
func (JabberSendAction) ActionTypeName() string {
return "JabberSend"
}
func (a JabberSendAction) GetActionID() string {
return a.ActionID
}
func (a *JabberSendAction) SetActionID(actionID string) {
a.ActionID = actionID
}
func (cli *Client) JabberSend(jabber string, jID string, message string, opts ...RequestOption) (res *Response, err error) {
req := &JabberSendAction{
Jabber: jabber,
JID: jID,
Message: message,
}
res = &Response{}
return res, cli.Action(req, res, opts...)
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/amimodels/events.go 0000664 0000000 0000000 00000317200 14650613361 0026036 0 ustar 00root root 0000000 0000000 // Code generated by xmlgen. DO NOT EDIT.
package amimodels
// MCIDEvent Published when a malicious call ID request arrives.
type MCIDEvent struct {
MCallerIDNumValid string
MCallerIDNum string
MCallerIDton string
MCallerIDNumPlan string
MCallerIDNumPres string
MCallerIDNameValid string
MCallerIDName string
MCallerIDNameCharSet string
MCallerIDNamePres string
MCallerIDSubaddr string
MCallerIDSubaddrType string
MCallerIDSubaddrOdd string
MCallerIDPres string
MConnectedIDNumValid string
MConnectedIDNum string
MConnectedIDton string
MConnectedIDNumPlan string
MConnectedIDNumPres string
MConnectedIDNameValid string
MConnectedIDName string
MConnectedIDNameCharSet string
MConnectedIDNamePres string
MConnectedIDSubaddr string
MConnectedIDSubaddrType string
MConnectedIDSubaddrOdd string
MConnectedIDPres string
}
func (MCIDEvent) EventTypeName() string {
return "MCID"
}
// AlarmClearEvent Raised when an alarm is cleared on a DAHDI channel.
type AlarmClearEvent struct {
// DAHDIChannel The DAHDI channel on which the alarm was cleared.
DAHDIChannel string
}
func (AlarmClearEvent) EventTypeName() string {
return "AlarmClear"
}
// SpanAlarmClearEvent Raised when an alarm is cleared on a DAHDI span.
type SpanAlarmClearEvent struct {
// Span The span on which the alarm was cleared.
Span string
}
func (SpanAlarmClearEvent) EventTypeName() string {
return "SpanAlarmClear"
}
// DNDStateEvent Raised when the Do Not Disturb state is changed on a DAHDI channel.
type DNDStateEvent struct {
// DAHDIChannel The DAHDI channel on which DND status changed.
DAHDIChannel string
Status string
}
func (DNDStateEvent) EventTypeName() string {
return "DNDState"
}
// AlarmEvent Raised when an alarm is set on a DAHDI channel.
type AlarmEvent struct {
// DAHDIChannel The channel on which the alarm occurred.
DAHDIChannel string
// Alarm A textual description of the alarm that occurred.
Alarm string
}
func (AlarmEvent) EventTypeName() string {
return "Alarm"
}
// SpanAlarmEvent Raised when an alarm is set on a DAHDI span.
type SpanAlarmEvent struct {
// Span The span on which the alarm occurred.
Span string
// Alarm A textual description of the alarm that occurred.
Alarm string
}
func (SpanAlarmEvent) EventTypeName() string {
return "SpanAlarm"
}
// DAHDIChannelEvent Raised when a DAHDI channel is created or an underlying technology is associated with a DAHDI channel.
type DAHDIChannelEvent struct {
// DAHDIGroup The DAHDI logical group associated with this channel.
DAHDIGroup string
// DAHDISpan The DAHDI span associated with this channel.
DAHDISpan string
// DAHDIChannel The DAHDI channel associated with this channel.
DAHDIChannel string
}
func (DAHDIChannelEvent) EventTypeName() string {
return "DAHDIChannel"
}
// SIPQualifyPeerDoneEvent Raised when SIPQualifyPeer has finished qualifying the specified peer.
type SIPQualifyPeerDoneEvent struct {
// Peer The name of the peer.
Peer string
// ActionID This is only included if an ActionID Header was sent with the action request, in which case it will be that ActionID.
ActionID string
}
func (SIPQualifyPeerDoneEvent) EventTypeName() string {
return "SIPQualifyPeerDone"
}
// SessionTimeoutEvent Raised when a SIP session times out.
type SessionTimeoutEvent struct {
// Source The source of the session timeout.
Source string
}
func (SessionTimeoutEvent) EventTypeName() string {
return "SessionTimeout"
}
// AgentsEvent Response event in a series to the Agents AMI action containing
// information about a defined agent.
type AgentsEvent struct {
// Agent Agent ID of the agent.
Agent string
// Name User friendly name of the agent.
Name string
// Status The valid values are:
Status string
// TalkingToChan Present if Status value is `AGENT_ONCALL`.
TalkingToChan string
// CallStarted Present if Status value is `AGENT_ONCALL`.
CallStarted string
// LoggedInTime Present if Status value is `AGENT_IDLE` or `AGENT_ONCALL`.
LoggedInTime string
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (AgentsEvent) EventTypeName() string {
return "Agents"
}
// AgentsCompleteEvent Final response event in a series of events to the Agents AMI action.
type AgentsCompleteEvent struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
}
func (AgentsCompleteEvent) EventTypeName() string {
return "AgentsComplete"
}
// ConfbridgeListEvent Raised as part of the ConfbridgeList action response list.
type ConfbridgeListEvent struct {
// Conference The name of the Confbridge conference.
Conference string
// Admin Identifies this user as an admin user.
Admin string
// MarkedUser Identifies this user as a marked user.
MarkedUser string
// WaitMarked Must this user wait for a marked user to join?
WaitMarked string
// EndMarked Does this user get kicked after the last marked user leaves?
EndMarked string
// Waiting Is this user waiting for a marked user to join?
Waiting string
// Muted The current mute status.
Muted string
// Talking Is this user talking?
Talking string
// AnsweredTime The number of seconds the channel has been up.
AnsweredTime string
}
func (ConfbridgeListEvent) EventTypeName() string {
return "ConfbridgeList"
}
// MeetmeJoinEvent Raised when a user joins a MeetMe conference.
type MeetmeJoinEvent struct {
// Meetme The identifier for the MeetMe conference.
Meetme string
// User The identifier of the MeetMe user who joined.
User string
}
func (MeetmeJoinEvent) EventTypeName() string {
return "MeetmeJoin"
}
// MeetmeLeaveEvent Raised when a user leaves a MeetMe conference.
type MeetmeLeaveEvent struct {
// Meetme The identifier for the MeetMe conference.
Meetme string
// User The identifier of the MeetMe user who joined.
User string
// Duration The length of time in seconds that the Meetme user was in the conference.
Duration string
}
func (MeetmeLeaveEvent) EventTypeName() string {
return "MeetmeLeave"
}
// MeetmeEndEvent Raised when a MeetMe conference ends.
type MeetmeEndEvent struct {
// Meetme The identifier for the MeetMe conference.
Meetme string
}
func (MeetmeEndEvent) EventTypeName() string {
return "MeetmeEnd"
}
// MeetmeTalkRequestEvent Raised when a MeetMe user has started talking.
type MeetmeTalkRequestEvent struct {
// Meetme The identifier for the MeetMe conference.
Meetme string
// User The identifier of the MeetMe user who joined.
User string
// Duration The length of time in seconds that the Meetme user has been in the conference at the time of this event.
Duration string
Status string
}
func (MeetmeTalkRequestEvent) EventTypeName() string {
return "MeetmeTalkRequest"
}
// MeetmeTalkingEvent Raised when a MeetMe user begins or ends talking.
type MeetmeTalkingEvent struct {
// Meetme The identifier for the MeetMe conference.
Meetme string
// User The identifier of the MeetMe user who joined.
User string
// Duration The length of time in seconds that the Meetme user has been in the conference at the time of this event.
Duration string
Status string
}
func (MeetmeTalkingEvent) EventTypeName() string {
return "MeetmeTalking"
}
// MeetmeMuteEvent Raised when a MeetMe user is muted or unmuted.
type MeetmeMuteEvent struct {
// Meetme The identifier for the MeetMe conference.
Meetme string
// User The identifier of the MeetMe user who joined.
User string
// Duration The length of time in seconds that the Meetme user has been in the conference at the time of this event.
Duration string
Status string
}
func (MeetmeMuteEvent) EventTypeName() string {
return "MeetmeMute"
}
// ConfbridgeStartEvent Raised when a conference starts.
type ConfbridgeStartEvent struct {
// Conference The name of the Confbridge conference.
Conference string
}
func (ConfbridgeStartEvent) EventTypeName() string {
return "ConfbridgeStart"
}
// ConfbridgeEndEvent Raised when a conference ends.
type ConfbridgeEndEvent struct {
// Conference The name of the Confbridge conference.
Conference string
}
func (ConfbridgeEndEvent) EventTypeName() string {
return "ConfbridgeEnd"
}
// ConfbridgeJoinEvent Raised when a channel joins a Confbridge conference.
type ConfbridgeJoinEvent struct {
// Conference The name of the Confbridge conference.
Conference string
// Admin Identifies this user as an admin user.
Admin string
// Muted The joining mute status.
Muted string
}
func (ConfbridgeJoinEvent) EventTypeName() string {
return "ConfbridgeJoin"
}
// ConfbridgeLeaveEvent Raised when a channel leaves a Confbridge conference.
type ConfbridgeLeaveEvent struct {
// Conference The name of the Confbridge conference.
Conference string
// Admin Identifies this user as an admin user.
Admin string
}
func (ConfbridgeLeaveEvent) EventTypeName() string {
return "ConfbridgeLeave"
}
// ConfbridgeRecordEvent Raised when a conference starts recording.
type ConfbridgeRecordEvent struct {
// Conference The name of the Confbridge conference.
Conference string
}
func (ConfbridgeRecordEvent) EventTypeName() string {
return "ConfbridgeRecord"
}
// ConfbridgeStopRecordEvent Raised when a conference that was recording stops recording.
type ConfbridgeStopRecordEvent struct {
// Conference The name of the Confbridge conference.
Conference string
}
func (ConfbridgeStopRecordEvent) EventTypeName() string {
return "ConfbridgeStopRecord"
}
// ConfbridgeMuteEvent Raised when a Confbridge participant mutes.
type ConfbridgeMuteEvent struct {
// Conference The name of the Confbridge conference.
Conference string
// Admin Identifies this user as an admin user.
Admin string
}
func (ConfbridgeMuteEvent) EventTypeName() string {
return "ConfbridgeMute"
}
// ConfbridgeUnmuteEvent Raised when a confbridge participant unmutes.
type ConfbridgeUnmuteEvent struct {
// Conference The name of the Confbridge conference.
Conference string
// Admin Identifies this user as an admin user.
Admin string
}
func (ConfbridgeUnmuteEvent) EventTypeName() string {
return "ConfbridgeUnmute"
}
// ConfbridgeTalkingEvent Raised when a confbridge participant begins or ends talking.
type ConfbridgeTalkingEvent struct {
// Conference The name of the Confbridge conference.
Conference string
TalkingStatus string
// Admin Identifies this user as an admin user.
Admin string
}
func (ConfbridgeTalkingEvent) EventTypeName() string {
return "ConfbridgeTalking"
}
// VarSetEvent Raised when a variable local to the gosub stack frame is set due to a subroutine call.
type VarSetEvent struct {
// Variable The LOCAL variable being set.
Variable string
// Value The new value of the variable.
Value string
}
func (VarSetEvent) EventTypeName() string {
return "VarSet"
}
// QueueMemberStatusEvent Raised when a Queue member's status has changed.
type QueueMemberStatusEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// StateInterface Channel technology or location from which to read device state changes.
StateInterface string
Membership string
// Penalty The penalty associated with the queue member.
Penalty string
// CallsTaken The number of calls this queue member has serviced.
CallsTaken string
// LastCall The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.
LastCall string
// LastPause The time when started last paused the queue member.
LastPause string
// InCall Set to 1 if member is in call. Set to 0 after LastCall time is updated.
InCall string
// Status The numeric device state status of the queue member.
Status string
Paused string
// PausedReason If set when paused, the reason the queue member was paused.
PausedReason string
Ringinuse string
// Wrapuptime The Wrapup Time of the queue member. If this value is set will override the wrapup time of queue.
Wrapuptime string
}
func (QueueMemberStatusEvent) EventTypeName() string {
return "QueueMemberStatus"
}
// QueueMemberAddedEvent Raised when a member is added to the queue.
type QueueMemberAddedEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// StateInterface Channel technology or location from which to read device state changes.
StateInterface string
Membership string
// Penalty The penalty associated with the queue member.
Penalty string
// CallsTaken The number of calls this queue member has serviced.
CallsTaken string
// LastCall The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.
LastCall string
// LastPause The time when started last paused the queue member.
LastPause string
// InCall Set to 1 if member is in call. Set to 0 after LastCall time is updated.
InCall string
// Status The numeric device state status of the queue member.
Status string
Paused string
// PausedReason If set when paused, the reason the queue member was paused.
PausedReason string
Ringinuse string
// Wrapuptime The Wrapup Time of the queue member. If this value is set will override the wrapup time of queue.
Wrapuptime string
}
func (QueueMemberAddedEvent) EventTypeName() string {
return "QueueMemberAdded"
}
// QueueMemberRemovedEvent Raised when a member is removed from the queue.
type QueueMemberRemovedEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// StateInterface Channel technology or location from which to read device state changes.
StateInterface string
Membership string
// Penalty The penalty associated with the queue member.
Penalty string
// CallsTaken The number of calls this queue member has serviced.
CallsTaken string
// LastCall The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.
LastCall string
// LastPause The time when started last paused the queue member.
LastPause string
// InCall Set to 1 if member is in call. Set to 0 after LastCall time is updated.
InCall string
// Status The numeric device state status of the queue member.
Status string
Paused string
// PausedReason If set when paused, the reason the queue member was paused.
PausedReason string
Ringinuse string
// Wrapuptime The Wrapup Time of the queue member. If this value is set will override the wrapup time of queue.
Wrapuptime string
}
func (QueueMemberRemovedEvent) EventTypeName() string {
return "QueueMemberRemoved"
}
// QueueMemberPauseEvent Raised when a member is paused/unpaused in the queue.
type QueueMemberPauseEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// StateInterface Channel technology or location from which to read device state changes.
StateInterface string
Membership string
// Penalty The penalty associated with the queue member.
Penalty string
// CallsTaken The number of calls this queue member has serviced.
CallsTaken string
// LastCall The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.
LastCall string
// LastPause The time when started last paused the queue member.
LastPause string
// InCall Set to 1 if member is in call. Set to 0 after LastCall time is updated.
InCall string
// Status The numeric device state status of the queue member.
Status string
Paused string
// PausedReason If set when paused, the reason the queue member was paused.
PausedReason string
Ringinuse string
// Wrapuptime The Wrapup Time of the queue member. If this value is set will override the wrapup time of queue.
Wrapuptime string
}
func (QueueMemberPauseEvent) EventTypeName() string {
return "QueueMemberPause"
}
// QueueMemberPenaltyEvent Raised when a member's penalty is changed.
type QueueMemberPenaltyEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// StateInterface Channel technology or location from which to read device state changes.
StateInterface string
Membership string
// Penalty The penalty associated with the queue member.
Penalty string
// CallsTaken The number of calls this queue member has serviced.
CallsTaken string
// LastCall The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.
LastCall string
// LastPause The time when started last paused the queue member.
LastPause string
// InCall Set to 1 if member is in call. Set to 0 after LastCall time is updated.
InCall string
// Status The numeric device state status of the queue member.
Status string
Paused string
// PausedReason If set when paused, the reason the queue member was paused.
PausedReason string
Ringinuse string
// Wrapuptime The Wrapup Time of the queue member. If this value is set will override the wrapup time of queue.
Wrapuptime string
}
func (QueueMemberPenaltyEvent) EventTypeName() string {
return "QueueMemberPenalty"
}
// QueueMemberRinginuseEvent Raised when a member's ringinuse setting is changed.
type QueueMemberRinginuseEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// StateInterface Channel technology or location from which to read device state changes.
StateInterface string
Membership string
// Penalty The penalty associated with the queue member.
Penalty string
// CallsTaken The number of calls this queue member has serviced.
CallsTaken string
// LastCall The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.
LastCall string
// LastPause The time when started last paused the queue member.
LastPause string
// InCall Set to 1 if member is in call. Set to 0 after LastCall time is updated.
InCall string
// Status The numeric device state status of the queue member.
Status string
Paused string
// PausedReason If set when paused, the reason the queue member was paused.
PausedReason string
Ringinuse string
// Wrapuptime The Wrapup Time of the queue member. If this value is set will override the wrapup time of queue.
Wrapuptime string
}
func (QueueMemberRinginuseEvent) EventTypeName() string {
return "QueueMemberRinginuse"
}
// QueueCallerJoinEvent Raised when a caller joins a Queue.
type QueueCallerJoinEvent struct {
// Queue The name of the queue.
Queue string
// Position This channel's current position in the queue.
Position string
// Count The total number of channels in the queue.
Count string
}
func (QueueCallerJoinEvent) EventTypeName() string {
return "QueueCallerJoin"
}
// QueueCallerLeaveEvent Raised when a caller leaves a Queue.
type QueueCallerLeaveEvent struct {
// Queue The name of the queue.
Queue string
// Count The total number of channels in the queue.
Count string
// Position This channel's current position in the queue.
Position string
}
func (QueueCallerLeaveEvent) EventTypeName() string {
return "QueueCallerLeave"
}
// QueueCallerAbandonEvent Raised when a caller abandons the queue.
type QueueCallerAbandonEvent struct {
// Queue The name of the queue.
Queue string
// Position This channel's current position in the queue.
Position string
// OriginalPosition The channel's original position in the queue.
OriginalPosition string
// HoldTime The time the channel was in the queue, expressed in seconds since 00:00, Jan 1, 1970 UTC.
HoldTime string
}
func (QueueCallerAbandonEvent) EventTypeName() string {
return "QueueCallerAbandon"
}
// AgentCalledEvent Raised when an queue member is notified of a caller in the queue.
type AgentCalledEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
}
func (AgentCalledEvent) EventTypeName() string {
return "AgentCalled"
}
// AgentRingNoAnswerEvent Raised when a queue member is notified of a caller in the queue and fails to answer.
type AgentRingNoAnswerEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// RingTime The time the queue member was rung, expressed in seconds since 00:00, Jan 1, 1970 UTC.
RingTime string
}
func (AgentRingNoAnswerEvent) EventTypeName() string {
return "AgentRingNoAnswer"
}
// AgentCompleteEvent Raised when a queue member has finished servicing a caller in the queue.
type AgentCompleteEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// HoldTime The time the channel was in the queue, expressed in seconds since 00:00, Jan 1, 1970 UTC.
HoldTime string
// TalkTime The time the queue member talked with the caller in the queue, expressed in seconds since 00:00, Jan 1, 1970 UTC.
TalkTime string
Reason string
}
func (AgentCompleteEvent) EventTypeName() string {
return "AgentComplete"
}
// AgentDumpEvent Raised when a queue member hangs up on a caller in the queue.
type AgentDumpEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
}
func (AgentDumpEvent) EventTypeName() string {
return "AgentDump"
}
// AgentConnectEvent Raised when a queue member answers and is bridged to a caller in the queue.
type AgentConnectEvent struct {
// Queue The name of the queue.
Queue string
// MemberName The name of the queue member.
MemberName string
// Interface The queue member's channel technology or location.
Interface string
// RingTime The time the queue member was rung, expressed in seconds since 00:00, Jan 1, 1970 UTC.
RingTime string
// HoldTime The time the channel was in the queue, expressed in seconds since 00:00, Jan 1, 1970 UTC.
HoldTime string
}
func (AgentConnectEvent) EventTypeName() string {
return "AgentConnect"
}
// MiniVoiceMailEvent Raised when a notification is sent out by a MiniVoiceMail application
type MiniVoiceMailEvent struct {
// Action What action was taken. Currently, this will always be `SentNotification`
Action string
// Mailbox The mailbox that the notification was about, specified as `mailbox`@ `context`
Mailbox string
// Counter A message counter derived from the `MVM_COUNTER` channel variable.
Counter string
}
func (MiniVoiceMailEvent) EventTypeName() string {
return "MiniVoiceMail"
}
// CdrEvent Raised when a CDR is generated.
type CdrEvent struct {
// AccountCode The account code of the Party A channel.
AccountCode string
// Source The Caller ID number associated with the Party A in the CDR.
Source string
// Destination The dialplan extension the Party A was executing.
Destination string
// DestinationContext The dialplan context the Party A was executing.
DestinationContext string
// CallerID The Caller ID name associated with the Party A in the CDR.
CallerID string
// Channel The channel name of the Party A.
Channel string
// DestinationChannel The channel name of the Party B.
DestinationChannel string
// LastApplication The last dialplan application the Party A executed.
LastApplication string
// LastData The parameters passed to the last dialplan application the Party A executed.
LastData string
// StartTime The time the CDR was created.
StartTime string
// AnswerTime The earliest of either the time when Party A answered, or the start time of this CDR.
AnswerTime string
// EndTime The time when the CDR was finished. This occurs when the Party A hangs up or when the bridge between Party A and Party B is broken.
EndTime string
// Duration The time, in seconds, of EndTime - StartTime .
Duration string
// BillableSeconds The time, in seconds, of AnswerTime - StartTime .
BillableSeconds string
// Disposition The final known disposition of the CDR.
Disposition string
// AMAFlags A flag that informs a billing system how to treat the CDR.
AMAFlags string
// UniqueID A unique identifier for the Party A channel.
UniqueID string
// UserField A user defined field set on the channels. If set on both the Party A and Party B channel, the userfields of both are concatenated and separated by a `;`.
UserField string
}
func (CdrEvent) EventTypeName() string {
return "Cdr"
}
// CELEvent Raised when a Channel Event Log is generated for a channel.
type CELEvent struct {
// EventName The name of the CEL event being raised. This can include both the system defined CEL events, as well as user defined events.
EventName string
// AccountCode The channel's account code.
AccountCode string
// CallerIDnum The Caller ID number.
CallerIDnum string
// CallerIDName The Caller ID name.
CallerIDName string
// CallerIDani The Caller ID Automatic Number Identification.
CallerIDani string
// CallerIDrdnis The Caller ID Redirected Dialed Number Identification Service.
CallerIDrdnis string
// CallerIDdnid The Caller ID Dialed Number Identifier.
CallerIDdnid string
// Exten The dialplan extension the channel is currently executing in.
Exten string
// Context The dialplan context the channel is currently executing in.
Context string
// Application The dialplan application the channel is currently executing.
Application string
// AppData The arguments passed to the dialplan Application .
AppData string
// EventTime The time the CEL event occurred.
EventTime string
// AMAFlags A flag that informs a billing system how to treat the CEL.
AMAFlags string
// UniqueID The unique ID of the channel.
UniqueID string
// LinkedID The linked ID of the channel, which ties this event to other related channel's events.
LinkedID string
// UserField A user defined field set on a channel, containing arbitrary application specific data.
UserField string
// Peer If this channel is in a bridge, the channel that it is in a bridge with.
Peer string
// PeerAccount If this channel is in a bridge, the accountcode of the channel it is in a bridge with.
PeerAccount string
// Extra Some events will have event specific data that accompanies the CEL record. This extra data is JSON encoded, and is dependent on the event in question.
Extra string
}
func (CELEvent) EventTypeName() string {
return "CEL"
}
// FailedACLEvent Raised when a request violates an ACL check.
type FailedACLEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Module If available, the name of the module that raised the event.
Module string
// ACLName If available, the name of the ACL that failed.
ACLName string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (FailedACLEvent) EventTypeName() string {
return "FailedACL"
}
// InvalidAccountIDEvent Raised when a request fails an authentication check due to an invalid account ID.
type InvalidAccountIDEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (InvalidAccountIDEvent) EventTypeName() string {
return "InvalidAccountID"
}
// SessionLimitEvent Raised when a request fails due to exceeding the number of allowed concurrent sessions for that
// service.
type SessionLimitEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (SessionLimitEvent) EventTypeName() string {
return "SessionLimit"
}
// MemoryLimitEvent Raised when a request fails due to an internal memory allocation failure.
type MemoryLimitEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (MemoryLimitEvent) EventTypeName() string {
return "MemoryLimit"
}
// LoadAverageLimitEvent Raised when a request fails because a configured load average limit has been reached.
type LoadAverageLimitEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (LoadAverageLimitEvent) EventTypeName() string {
return "LoadAverageLimit"
}
// RequestNotSupportedEvent Raised when a request fails due to some aspect of the requested item not being supported by the
// service.
type RequestNotSupportedEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// RequestType The type of request attempted.
RequestType string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (RequestNotSupportedEvent) EventTypeName() string {
return "RequestNotSupported"
}
// RequestNotAllowedEvent Raised when a request is not allowed by the service.
type RequestNotAllowedEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// RequestType The type of request attempted.
RequestType string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
// RequestParams Parameters provided to the rejected request.
RequestParams string
}
func (RequestNotAllowedEvent) EventTypeName() string {
return "RequestNotAllowed"
}
// AuthMethodNotAllowedEvent Raised when a request used an authentication method not allowed by the service.
type AuthMethodNotAllowedEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// AuthMethod The authentication method attempted.
AuthMethod string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (AuthMethodNotAllowedEvent) EventTypeName() string {
return "AuthMethodNotAllowed"
}
// RequestBadFormatEvent Raised when a request is received with bad formatting.
type RequestBadFormatEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// RequestType The type of request attempted.
RequestType string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
// RequestParams Parameters provided to the rejected request.
RequestParams string
}
func (RequestBadFormatEvent) EventTypeName() string {
return "RequestBadFormat"
}
// SuccessfulAuthEvent Raised when a request successfully authenticates with a service.
type SuccessfulAuthEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// UsingPassword Whether or not the authentication attempt included a password.
UsingPassword string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (SuccessfulAuthEvent) EventTypeName() string {
return "SuccessfulAuth"
}
// UnexpectedAddressEvent Raised when a request has a different source address then what is expected for a session already in
// progress with a service.
type UnexpectedAddressEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// ExpectedAddress The address that the request was expected to use.
ExpectedAddress string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (UnexpectedAddressEvent) EventTypeName() string {
return "UnexpectedAddress"
}
// ChallengeResponseFailedEvent Raised when a request's attempt to authenticate has been challenged, and the request failed the
// authentication challenge.
type ChallengeResponseFailedEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Challenge The challenge that was sent.
Challenge string
// Response The response that was received.
Response string
// ExpectedResponse The expected response to the challenge.
ExpectedResponse string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (ChallengeResponseFailedEvent) EventTypeName() string {
return "ChallengeResponseFailed"
}
// InvalidPasswordEvent Raised when a request provides an invalid password during an authentication attempt.
type InvalidPasswordEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
// Challenge The challenge that was sent.
Challenge string
// ReceivedChallenge The challenge that was received.
ReceivedChallenge string
// ReceivedHash The hash that was received.
ReceivedHash string
}
func (InvalidPasswordEvent) EventTypeName() string {
return "InvalidPassword"
}
// ChallengeSentEvent Raised when an Asterisk service sends an authentication challenge to a request.
type ChallengeSentEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// Challenge The challenge that was sent.
Challenge string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (ChallengeSentEvent) EventTypeName() string {
return "ChallengeSent"
}
// InvalidTransportEvent Raised when a request attempts to use a transport not allowed by the Asterisk service.
type InvalidTransportEvent struct {
// EventTV The time the event was detected.
EventTV string
// Severity A relative severity of the security event.
Severity string
// Service The Asterisk service that raised the security event.
Service string
// EventVersion The version of this event.
EventVersion string
// AccountID The Service account associated with the security event notification.
AccountID string
// SessionID A unique identifier for the session in the service that raised the event.
SessionID string
// LocalAddress The address of the Asterisk service that raised the security event.
LocalAddress string
// RemoteAddress The remote address of the entity that caused the security event to be raised.
RemoteAddress string
// AttemptedTransport The transport type that the request attempted to use.
AttemptedTransport string
// Module If available, the name of the module that raised the event.
Module string
// SessionTV The timestamp reported by the session.
SessionTV string
}
func (InvalidTransportEvent) EventTypeName() string {
return "InvalidTransport"
}
// StatusEvent Raised in response to a Status command.
type StatusEvent struct {
ActionID string
// Type Type of channel
Type string
// DNID Dialed number identifier
DNID string
EffectiveConnectedLineNum string
EffectiveConnectedLineName string
// TimeToHangup Absolute lifetime of the channel
TimeToHangup string
// BridgeID Identifier of the bridge the channel is in, may be empty if not in one
BridgeID string
// Application Application currently executing on the channel
Application string
// Data Data given to the currently executing channel
Data string
// Nativeformats Media formats the connected party is willing to send or receive
Nativeformats string
// Readformat Media formats that frames from the channel are received in
Readformat string
// Readtrans Translation path for media received in native formats
Readtrans string
// Writeformat Media formats that frames to the channel are accepted in
Writeformat string
// Writetrans Translation path for media sent to the connected party
Writetrans string
// Callgroup Configured call group on the channel
Callgroup string
// Pickupgroup Configured pickup group on the channel
Pickupgroup string
// Seconds Number of seconds the channel has been active
Seconds string
}
func (StatusEvent) EventTypeName() string {
return "Status"
}
// StatusCompleteEvent Raised in response to a Status command.
type StatusCompleteEvent struct {
// Items Number of Status events returned
Items string
}
func (StatusCompleteEvent) EventTypeName() string {
return "StatusComplete"
}
// OriginateResponseEvent Raised in response to an Originate command.
type OriginateResponseEvent struct {
ActionID string
Response string
Channel string
Context string
Exten string
Application string
Data string
Reason string
Uniqueid string
CallerIDNum string
CallerIDName string
}
func (OriginateResponseEvent) EventTypeName() string {
return "OriginateResponse"
}
// CoreShowChannelEvent Raised in response to a CoreShowChannels command.
type CoreShowChannelEvent struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// BridgeId Identifier of the bridge the channel is in, may be empty if not in one
BridgeId string
// Application Application currently executing on the channel
Application string
// ApplicationData Data given to the currently executing application
ApplicationData string
// Duration The amount of time the channel has existed
Duration string
}
func (CoreShowChannelEvent) EventTypeName() string {
return "CoreShowChannel"
}
// CoreShowChannelsCompleteEvent Raised at the end of the CoreShowChannel list produced by the CoreShowChannels command.
type CoreShowChannelsCompleteEvent struct {
// ActionID ActionID for this transaction. Will be returned.
ActionID string
// EventList Conveys the status of the command reponse list
EventList string
// ListItems The total number of list items produced
ListItems string
}
func (CoreShowChannelsCompleteEvent) EventTypeName() string {
return "CoreShowChannelsComplete"
}
// ExtensionStatusEvent Raised when a hint changes due to a device state change.
type ExtensionStatusEvent struct {
// Exten Name of the extension.
Exten string
// Context Context that owns the extension.
Context string
// Hint Hint set for the extension
Hint string
// Status Numerical value of the extension status. Extension status is determined by the combined device state of all items contained in the hint.
Status string
// StatusText Text representation of `Status`.
StatusText string
}
func (ExtensionStatusEvent) EventTypeName() string {
return "ExtensionStatus"
}
// PresenceStatusEvent Raised when a hint changes due to a presence state change.
type PresenceStatusEvent struct {
Exten string
Context string
Hint string
Status string
Subtype string
Message string
}
func (PresenceStatusEvent) EventTypeName() string {
return "PresenceStatus"
}
// LogChannelEvent Raised when a logging channel is re-enabled after a reload operation.
type LogChannelEvent struct {
// Channel The name of the logging channel.
Channel string
Enabled string
}
func (LogChannelEvent) EventTypeName() string {
return "LogChannel"
}
// PresenceStateChangeEvent Raised when a presence state changes
type PresenceStateChangeEvent struct {
// Presentity The entity whose presence state has changed
Presentity string
// Status The new status of the presentity
Status string
// Subtype The new subtype of the presentity
Subtype string
// Message The new message of the presentity
Message string
}
func (PresenceStateChangeEvent) EventTypeName() string {
return "PresenceStateChange"
}
// BlindTransferEvent Raised when a blind transfer is complete.
type BlindTransferEvent struct {
// Result Indicates if the transfer was successful or if it failed.
Result string
// IsExternal Indicates if the transfer was performed outside of Asterisk. For instance, a channel protocol native transfer is external. A DTMF transfer is internal.
IsExternal string
// Context Destination context for the blind transfer.
Context string
// Extension Destination extension for the blind transfer.
Extension string
}
func (BlindTransferEvent) EventTypeName() string {
return "BlindTransfer"
}
// AttendedTransferEvent Raised when an attended transfer is complete.
type AttendedTransferEvent struct {
// Result Indicates if the transfer was successful or if it failed.
Result string
// DestType Indicates the method by which the attended transfer completed.
DestType string
// DestBridgeUniqueid Indicates the surviving bridge when bridges were merged to complete the transfer
DestBridgeUniqueid string
// DestApp Indicates the application that is running when the transfer completes
DestApp string
// DestTransfererChannel The name of the surviving transferer channel when a transfer results in a threeway call
DestTransfererChannel string
}
func (AttendedTransferEvent) EventTypeName() string {
return "AttendedTransfer"
}
// PeerStatusEvent Raised when the state of a peer changes.
type PeerStatusEvent struct {
// ChannelType The channel technology of the peer.
ChannelType string
// Peer The name of the peer (including channel technology).
Peer string
// PeerStatus New status of the peer.
PeerStatus string
// Cause The reason the status has changed.
Cause string
// Address New address of the peer.
Address string
// Port New port for the peer.
Port string
// Time Time it takes to reach the peer and receive a response.
Time float64
}
func (PeerStatusEvent) EventTypeName() string {
return "PeerStatus"
}
// ContactStatusEvent Raised when the state of a contact changes.
type ContactStatusEvent struct {
// URI This contact's URI.
URI string
// ContactStatus New status of the contact.
ContactStatus string
// AOR The name of the associated aor.
AOR string
// EndpointName The name of the associated endpoint.
EndpointName string
// RoundtripUsec The RTT measured during the last qualify.
RoundtripUsec string
}
func (ContactStatusEvent) EventTypeName() string {
return "ContactStatus"
}
// AgentLoginEvent Raised when an Agent has logged in.
type AgentLoginEvent struct {
// Agent Agent ID of the agent.
Agent string
}
func (AgentLoginEvent) EventTypeName() string {
return "AgentLogin"
}
// AgentLogoffEvent Raised when an Agent has logged off.
type AgentLogoffEvent struct {
// Agent Agent ID of the agent.
Agent string
// Logintime The number of seconds the agent was logged in.
Logintime string
}
func (AgentLogoffEvent) EventTypeName() string {
return "AgentLogoff"
}
// ChannelTalkingStartEvent Raised when talking is detected on a channel.
type ChannelTalkingStartEvent struct {
}
func (ChannelTalkingStartEvent) EventTypeName() string {
return "ChannelTalkingStart"
}
// ChannelTalkingStopEvent Raised when talking is no longer detected on a channel.
type ChannelTalkingStopEvent struct {
// Duration The length in time, in milliseconds, that talking was detected on the channel.
Duration string
}
func (ChannelTalkingStopEvent) EventTypeName() string {
return "ChannelTalkingStop"
}
// ReloadEvent Raised when a module has been reloaded in Asterisk.
type ReloadEvent struct {
// Module The name of the module that was reloaded, or `All` if all modules were reloaded
Module string
// Status The numeric status code denoting the success or failure of the reload request.
Status string
}
func (ReloadEvent) EventTypeName() string {
return "Reload"
}
// LoadEvent Raised when a module has been loaded in Asterisk.
type LoadEvent struct {
// Module The name of the module that was loaded
Module string
// Status The result of the load request.
Status string
}
func (LoadEvent) EventTypeName() string {
return "Load"
}
// UnloadEvent Raised when a module has been unloaded in Asterisk.
type UnloadEvent struct {
// Module The name of the module that was unloaded
Module string
// Status The result of the unload request.
Status string
}
func (UnloadEvent) EventTypeName() string {
return "Unload"
}
// UserEventEvent A user defined event raised from the dialplan.
type UserEventEvent struct {
// UserEvent The event name, as specified in the dialplan.
UserEvent string
}
func (UserEventEvent) EventTypeName() string {
return "UserEvent"
}
// RegistryEvent Raised when an outbound registration completes.
type RegistryEvent struct {
// ChannelType The type of channel that was registered (or not).
ChannelType string
// UserName The username portion of the registration.
UserName string
// Domain The address portion of the registration.
Domain string
// Status The status of the registration request.
Status string
// Cause What caused the rejection of the request, if available.
Cause string
}
func (RegistryEvent) EventTypeName() string {
return "Registry"
}
// DeviceStateChangeEvent Raised when a device state changes
type DeviceStateChangeEvent struct {
// Device The device whose state has changed
Device string
// State The new state of the device
State string
}
func (DeviceStateChangeEvent) EventTypeName() string {
return "DeviceStateChange"
}
// MessageWaitingEvent Raised when the state of messages in a voicemail mailbox
// has changed or when a channel has finished interacting with a
// mailbox.
type MessageWaitingEvent struct {
// Mailbox The mailbox with the new message, specified as `mailbox`@ `context`
Mailbox string
// Waiting Whether or not the mailbox has messages waiting for it.
Waiting string
// New The number of new messages.
New string
// Old The number of old messages.
Old string
}
func (MessageWaitingEvent) EventTypeName() string {
return "MessageWaiting"
}
// FullyBootedEvent Raised when all Asterisk initialization procedures have finished.
type FullyBootedEvent struct {
// Status Informational message
Status string
// Uptime Seconds since start
Uptime string
// LastReload Seconds since last reload
LastReload string
}
func (FullyBootedEvent) EventTypeName() string {
return "FullyBooted"
}
// ShutdownEvent Raised when Asterisk is shutdown or restarted.
type ShutdownEvent struct {
// Shutdown Whether the shutdown is proceeding cleanly (all channels were hungup successfully) or uncleanly (channels will be terminated)
Shutdown string
// Restart Whether or not a restart will occur.
Restart string
}
func (ShutdownEvent) EventTypeName() string {
return "Shutdown"
}
// LocalBridgeEvent Raised when two halves of a Local Channel form a bridge.
type LocalBridgeEvent struct {
// Context The context in the dialplan that Channel2 starts in.
Context string
// Exten The extension in the dialplan that Channel2 starts in.
Exten string
LocalOptimization string
}
func (LocalBridgeEvent) EventTypeName() string {
return "LocalBridge"
}
// LocalOptimizationBeginEvent Raised when two halves of a Local Channel begin to optimize
// themselves out of the media path.
type LocalOptimizationBeginEvent struct {
// DestUniqueId The unique ID of the bridge into which the local channel is optimizing.
DestUniqueId string
// Id Identification for the optimization operation.
Id string
}
func (LocalOptimizationBeginEvent) EventTypeName() string {
return "LocalOptimizationBegin"
}
// LocalOptimizationEndEvent Raised when two halves of a Local Channel have finished optimizing
// themselves out of the media path.
type LocalOptimizationEndEvent struct {
// Success Indicates whether the local optimization succeeded.
Success string
// Id Identification for the optimization operation. Matches the Id from a previous `LocalOptimizationBegin`
Id string
}
func (LocalOptimizationEndEvent) EventTypeName() string {
return "LocalOptimizationEnd"
}
// RenameEvent Raised when the name of a channel is changed.
type RenameEvent struct {
Channel string
NewName string
Uniqueid string
}
func (RenameEvent) EventTypeName() string {
return "Rename"
}
// RTCPSentEvent Raised when an RTCP packet is sent.
type RTCPSentEvent struct {
// SSRC The SSRC identifier for our stream
SSRC string
// PT The type of packet for this RTCP report.
PT string
// To The address the report is sent to.
To string
// ReportCount The report count determines the number of ReportX headers in the message. The X for each set of report headers will range from 0 to `ReportCount - 1`.
ReportCount string
// SentNTP The time the sender generated the report. Only valid when PT is `200(SR)`.
SentNTP string
// SentRTP The sender's last RTP timestamp. Only valid when PT is `200(SR)`.
SentRTP string
// SentPackets The number of packets the sender has sent. Only valid when PT is `200(SR)`.
SentPackets string
// SentOctets The number of bytes the sender has sent. Only valid when PT is `200(SR)`.
SentOctets string
// ReportXSourceSSRC The SSRC for the source of this report block.
ReportXSourceSSRC string
// ReportXFractionLost The fraction of RTP data packets from `ReportXSourceSSRC` lost since the previous SR or RR report was sent.
ReportXFractionLost string
// ReportXCumulativeLost The total number of RTP data packets from `ReportXSourceSSRC` lost since the beginning of reception.
ReportXCumulativeLost string
// ReportXHighestSequence The highest sequence number received in an RTP data packet from `ReportXSourceSSRC`.
ReportXHighestSequence string
// ReportXSequenceNumberCycles The number of sequence number cycles seen for the RTP data received from `ReportXSourceSSRC`.
ReportXSequenceNumberCycles string
// ReportXIAJitter An estimate of the statistical variance of the RTP data packet interarrival time, measured in timestamp units.
ReportXIAJitter string
// ReportXLSR The last SR timestamp received from `ReportXSourceSSRC`. If no SR has been received from `ReportXSourceSSRC`, then 0.
ReportXLSR string
// ReportXDLSR The delay, expressed in units of 1/65536 seconds, between receiving the last SR packet from `ReportXSourceSSRC` and sending this report.
ReportXDLSR string
}
func (RTCPSentEvent) EventTypeName() string {
return "RTCPSent"
}
// RTCPReceivedEvent Raised when an RTCP packet is received.
type RTCPReceivedEvent struct {
// SSRC The SSRC identifier for the remote system
SSRC string
// PT The type of packet for this RTCP report.
PT string
// From The address the report was received from.
From string
// RTT Calculated Round-Trip Time in seconds
RTT string
// ReportCount The report count determines the number of ReportX headers in the message. The X for each set of report headers will range from 0 to `ReportCount - 1`.
ReportCount string
// SentNTP The time the sender generated the report. Only valid when PT is `200(SR)`.
SentNTP string
// SentRTP The sender's last RTP timestamp. Only valid when PT is `200(SR)`.
SentRTP string
// SentPackets The number of packets the sender has sent. Only valid when PT is `200(SR)`.
SentPackets string
// SentOctets The number of bytes the sender has sent. Only valid when PT is `200(SR)`.
SentOctets string
// ReportXSourceSSRC The SSRC for the source of this report block.
ReportXSourceSSRC string
// ReportXFractionLost The fraction of RTP data packets from `ReportXSourceSSRC` lost since the previous SR or RR report was sent.
ReportXFractionLost string
// ReportXCumulativeLost The total number of RTP data packets from `ReportXSourceSSRC` lost since the beginning of reception.
ReportXCumulativeLost string
// ReportXHighestSequence The highest sequence number received in an RTP data packet from `ReportXSourceSSRC`.
ReportXHighestSequence string
// ReportXSequenceNumberCycles The number of sequence number cycles seen for the RTP data received from `ReportXSourceSSRC`.
ReportXSequenceNumberCycles string
// ReportXIAJitter An estimate of the statistical variance of the RTP data packet interarrival time, measured in timestamp units.
ReportXIAJitter string
// ReportXLSR The last SR timestamp received from `ReportXSourceSSRC`. If no SR has been received from `ReportXSourceSSRC`, then 0.
ReportXLSR string
// ReportXDLSR The delay, expressed in units of 1/65536 seconds, between receiving the last SR packet from `ReportXSourceSSRC` and sending this report.
ReportXDLSR string
}
func (RTCPReceivedEvent) EventTypeName() string {
return "RTCPReceived"
}
// NewchannelEvent Raised when a new channel is created.
type NewchannelEvent struct {
}
func (NewchannelEvent) EventTypeName() string {
return "Newchannel"
}
// NewstateEvent Raised when a channel's state changes.
type NewstateEvent struct {
}
func (NewstateEvent) EventTypeName() string {
return "Newstate"
}
// HangupEvent Raised when a channel is hung up.
type HangupEvent struct {
// Cause A numeric cause code for why the channel was hung up.
Cause string
// CauseTxt A description of why the channel was hung up.
CauseTxt string
}
func (HangupEvent) EventTypeName() string {
return "Hangup"
}
// HangupRequestEvent Raised when a hangup is requested.
type HangupRequestEvent struct {
// Cause A numeric cause code for why the channel was hung up.
Cause string
}
func (HangupRequestEvent) EventTypeName() string {
return "HangupRequest"
}
// SoftHangupRequestEvent Raised when a soft hangup is requested with a specific cause code.
type SoftHangupRequestEvent struct {
// Cause A numeric cause code for why the channel was hung up.
Cause string
}
func (SoftHangupRequestEvent) EventTypeName() string {
return "SoftHangupRequest"
}
// NewExtenEvent Raised when a channel enters a new context, extension, priority.
type NewExtenEvent struct {
// Extension Deprecated in 12, but kept for backward compatability. Please use 'Exten' instead.
Extension string
// Application The application about to be executed.
Application string
// AppData The data to be passed to the application.
AppData string
}
func (NewExtenEvent) EventTypeName() string {
return "NewExten"
}
// NewCalleridEvent Raised when a channel receives new Caller ID information.
type NewCalleridEvent struct {
// CIDCallingPres A description of the Caller ID presentation.
CIDCallingPres string
}
func (NewCalleridEvent) EventTypeName() string {
return "NewCallerid"
}
// NewConnectedLineEvent Raised when a channel's connected line information is changed.
type NewConnectedLineEvent struct {
}
func (NewConnectedLineEvent) EventTypeName() string {
return "NewConnectedLine"
}
// NewAccountCodeEvent Raised when a Channel's AccountCode is changed.
type NewAccountCodeEvent struct {
// OldAccountCode The channel's previous account code
OldAccountCode string
}
func (NewAccountCodeEvent) EventTypeName() string {
return "NewAccountCode"
}
// DialBeginEvent Raised when a dial action has started.
type DialBeginEvent struct {
// DialString The non-technology specific device being dialed.
DialString string
}
func (DialBeginEvent) EventTypeName() string {
return "DialBegin"
}
// DialStateEvent Raised when dial status has changed.
type DialStateEvent struct {
// DialStatus The new state of the outbound dial attempt.
DialStatus string
// Forward If the call was forwarded, where the call was forwarded to.
Forward string
}
func (DialStateEvent) EventTypeName() string {
return "DialState"
}
// DialEndEvent Raised when a dial action has completed.
type DialEndEvent struct {
// DialStatus The result of the dial operation.
DialStatus string
// Forward If the call was forwarded, where the call was forwarded to.
Forward string
}
func (DialEndEvent) EventTypeName() string {
return "DialEnd"
}
// HoldEvent Raised when a channel goes on hold.
type HoldEvent struct {
// MusicClass The suggested MusicClass, if provided.
MusicClass string
}
func (HoldEvent) EventTypeName() string {
return "Hold"
}
// UnholdEvent Raised when a channel goes off hold.
type UnholdEvent struct {
}
func (UnholdEvent) EventTypeName() string {
return "Unhold"
}
// ChanSpyStartEvent Raised when one channel begins spying on another channel.
type ChanSpyStartEvent struct {
}
func (ChanSpyStartEvent) EventTypeName() string {
return "ChanSpyStart"
}
// ChanSpyStopEvent Raised when a channel has stopped spying.
type ChanSpyStopEvent struct {
}
func (ChanSpyStopEvent) EventTypeName() string {
return "ChanSpyStop"
}
// HangupHandlerRunEvent Raised when a hangup handler is about to be called.
type HangupHandlerRunEvent struct {
// Handler Hangup handler parameter string passed to the Gosub application.
Handler string
}
func (HangupHandlerRunEvent) EventTypeName() string {
return "HangupHandlerRun"
}
// HangupHandlerPopEvent Raised when a hangup handler is removed from the handler stack
// by the CHANNEL() function.
type HangupHandlerPopEvent struct {
// Handler Hangup handler parameter string passed to the Gosub application.
Handler string
}
func (HangupHandlerPopEvent) EventTypeName() string {
return "HangupHandlerPop"
}
// HangupHandlerPushEvent Raised when a hangup handler is added to the handler stack by
// the CHANNEL() function.
type HangupHandlerPushEvent struct {
// Handler Hangup handler parameter string passed to the Gosub application.
Handler string
}
func (HangupHandlerPushEvent) EventTypeName() string {
return "HangupHandlerPush"
}
// FAXStatusEvent Raised periodically during a fax transmission.
type FAXStatusEvent struct {
Operation string
// Status A text message describing the current status of the fax
Status string
// LocalStationID The value of the `LOCALSTATIONID` channel variable
LocalStationID string
// FileName The files being affected by the fax operation
FileName string
}
func (FAXStatusEvent) EventTypeName() string {
return "FAXStatus"
}
// ReceiveFAXEvent Raised when a receive fax operation has completed.
type ReceiveFAXEvent struct {
// LocalStationID The value of the `LOCALSTATIONID` channel variable
LocalStationID string
// RemoteStationID The value of the `REMOTESTATIONID` channel variable
RemoteStationID string
// PagesTransferred The number of pages that have been transferred
PagesTransferred string
// Resolution The negotiated resolution
Resolution string
// TransferRate The negotiated transfer rate
TransferRate string
// FileName The files being affected by the fax operation
FileName string
}
func (ReceiveFAXEvent) EventTypeName() string {
return "ReceiveFAX"
}
// SendFAXEvent Raised when a send fax operation has completed.
type SendFAXEvent struct {
// LocalStationID The value of the `LOCALSTATIONID` channel variable
LocalStationID string
// RemoteStationID The value of the `REMOTESTATIONID` channel variable
RemoteStationID string
// PagesTransferred The number of pages that have been transferred
PagesTransferred string
// Resolution The negotiated resolution
Resolution string
// TransferRate The negotiated transfer rate
TransferRate string
// FileName The files being affected by the fax operation
FileName string
}
func (SendFAXEvent) EventTypeName() string {
return "SendFAX"
}
// MusicOnHoldStartEvent Raised when music on hold has started on a channel.
type MusicOnHoldStartEvent struct {
// Class The class of music being played on the channel
Class string
}
func (MusicOnHoldStartEvent) EventTypeName() string {
return "MusicOnHoldStart"
}
// MusicOnHoldStopEvent Raised when music on hold has stopped on a channel.
type MusicOnHoldStopEvent struct {
}
func (MusicOnHoldStopEvent) EventTypeName() string {
return "MusicOnHoldStop"
}
// MonitorStartEvent Raised when monitoring has started on a channel.
type MonitorStartEvent struct {
}
func (MonitorStartEvent) EventTypeName() string {
return "MonitorStart"
}
// MonitorStopEvent Raised when monitoring has stopped on a channel.
type MonitorStopEvent struct {
}
func (MonitorStopEvent) EventTypeName() string {
return "MonitorStop"
}
// DTMFBeginEvent Raised when a DTMF digit has started on a channel.
type DTMFBeginEvent struct {
// Digit DTMF digit received or transmitted (0-9, A-E, # or *
Digit string
Direction string
}
func (DTMFBeginEvent) EventTypeName() string {
return "DTMFBegin"
}
// DTMFEndEvent Raised when a DTMF digit has ended on a channel.
type DTMFEndEvent struct {
// Digit DTMF digit received or transmitted (0-9, A-E, # or *
Digit string
// DurationMs Duration (in milliseconds) DTMF was sent/received
DurationMs string
Direction string
}
func (DTMFEndEvent) EventTypeName() string {
return "DTMFEnd"
}
// AOCSEvent Raised when an Advice of Charge message is sent at the beginning of a call.
type AOCSEvent struct {
Chargeable string
RateType string
Currency string
Name string
Cost string
Multiplier string
ChargingType string
StepFunction string
Granularity string
Length string
Scale string
Unit string
SpecialCode string
}
func (AOCSEvent) EventTypeName() string {
return "AOC-S"
}
// AOCDEvent Raised when an Advice of Charge message is sent during a call.
type AOCDEvent struct {
Charge string
Type string
BillingID string
TotalType string
Currency string
Name string
Cost string
Multiplier string
Units string
NumberOf string
TypeOf string
}
func (AOCDEvent) EventTypeName() string {
return "AOC-D"
}
// AOCEEvent Raised when an Advice of Charge message is sent at the end of a call.
type AOCEEvent struct {
ChargingAssociation string
Number string
Plan string
Id string
Charge string
Type string
BillingID string
TotalType string
Currency string
Name string
Cost string
Multiplier string
Units string
NumberOf string
TypeOf string
}
func (AOCEEvent) EventTypeName() string {
return "AOC-E"
}
// PickupEvent Raised when a call pickup occurs.
type PickupEvent struct {
}
func (PickupEvent) EventTypeName() string {
return "Pickup"
}
// BridgeCreateEvent Raised when a bridge is created.
type BridgeCreateEvent struct {
}
func (BridgeCreateEvent) EventTypeName() string {
return "BridgeCreate"
}
// BridgeDestroyEvent Raised when a bridge is destroyed.
type BridgeDestroyEvent struct {
}
func (BridgeDestroyEvent) EventTypeName() string {
return "BridgeDestroy"
}
// BridgeEnterEvent Raised when a channel enters a bridge.
type BridgeEnterEvent struct {
// SwapUniqueid The uniqueid of the channel being swapped out of the bridge
SwapUniqueid string
}
func (BridgeEnterEvent) EventTypeName() string {
return "BridgeEnter"
}
// BridgeLeaveEvent Raised when a channel leaves a bridge.
type BridgeLeaveEvent struct {
}
func (BridgeLeaveEvent) EventTypeName() string {
return "BridgeLeave"
}
// BridgeVideoSourceUpdateEvent Raised when the channel that is the source of video in a bridge changes.
type BridgeVideoSourceUpdateEvent struct {
// BridgePreviousVideoSource The unique ID of the channel that was the video source.
BridgePreviousVideoSource string
}
func (BridgeVideoSourceUpdateEvent) EventTypeName() string {
return "BridgeVideoSourceUpdate"
}
// BridgeMergeEvent Raised when two bridges are merged.
type BridgeMergeEvent struct {
}
func (BridgeMergeEvent) EventTypeName() string {
return "BridgeMerge"
}
// ParkedCallEvent Raised when a channel is parked.
type ParkedCallEvent struct {
// ParkerDialString Dial String that can be used to call back the parker on ParkingTimeout.
ParkerDialString string
// Parkinglot Name of the parking lot that the parkee is parked in
Parkinglot string
// ParkingSpace Parking Space that the parkee is parked in
ParkingSpace string
// ParkingTimeout Time remaining until the parkee is forcefully removed from parking in seconds
ParkingTimeout string
// ParkingDuration Time the parkee has been in the parking bridge (in seconds)
ParkingDuration string
}
func (ParkedCallEvent) EventTypeName() string {
return "ParkedCall"
}
// ParkedCallTimeOutEvent Raised when a channel leaves a parking lot due to reaching the time limit of being parked.
type ParkedCallTimeOutEvent struct {
// ParkerDialString Dial String that can be used to call back the parker on ParkingTimeout.
ParkerDialString string
// Parkinglot Name of the parking lot that the parkee is parked in
Parkinglot string
// ParkingSpace Parking Space that the parkee is parked in
ParkingSpace string
// ParkingTimeout Time remaining until the parkee is forcefully removed from parking in seconds
ParkingTimeout string
// ParkingDuration Time the parkee has been in the parking bridge (in seconds)
ParkingDuration string
}
func (ParkedCallTimeOutEvent) EventTypeName() string {
return "ParkedCallTimeOut"
}
// ParkedCallGiveUpEvent Raised when a channel leaves a parking lot because it hung up without being answered.
type ParkedCallGiveUpEvent struct {
// ParkerDialString Dial String that can be used to call back the parker on ParkingTimeout.
ParkerDialString string
// Parkinglot Name of the parking lot that the parkee is parked in
Parkinglot string
// ParkingSpace Parking Space that the parkee is parked in
ParkingSpace string
// ParkingTimeout Time remaining until the parkee is forcefully removed from parking in seconds
ParkingTimeout string
// ParkingDuration Time the parkee has been in the parking bridge (in seconds)
ParkingDuration string
}
func (ParkedCallGiveUpEvent) EventTypeName() string {
return "ParkedCallGiveUp"
}
// UnParkedCallEvent Raised when a channel leaves a parking lot because it was retrieved from the parking lot and
// reconnected.
type UnParkedCallEvent struct {
// ParkerDialString Dial String that can be used to call back the parker on ParkingTimeout.
ParkerDialString string
// Parkinglot Name of the parking lot that the parkee is parked in
Parkinglot string
// ParkingSpace Parking Space that the parkee is parked in
ParkingSpace string
// ParkingTimeout Time remaining until the parkee is forcefully removed from parking in seconds
ParkingTimeout string
// ParkingDuration Time the parkee has been in the parking bridge (in seconds)
ParkingDuration string
}
func (UnParkedCallEvent) EventTypeName() string {
return "UnParkedCall"
}
// ParkedCallSwapEvent Raised when a channel takes the place of a previously parked channel
type ParkedCallSwapEvent struct {
// ParkerDialString Dial String that can be used to call back the parker on ParkingTimeout.
ParkerDialString string
// Parkinglot Name of the parking lot that the parkee is parked in
Parkinglot string
// ParkingSpace Parking Space that the parkee is parked in
ParkingSpace string
// ParkingTimeout Time remaining until the parkee is forcefully removed from parking in seconds
ParkingTimeout string
// ParkingDuration Time the parkee has been in the parking bridge (in seconds)
ParkingDuration string
}
func (ParkedCallSwapEvent) EventTypeName() string {
return "ParkedCallSwap"
}
// MWIGetEvent Raised in response to a MWIGet command.
type MWIGetEvent struct {
ActionID string
// Mailbox Specific mailbox ID.
Mailbox string
// OldMessages The number of old messages in the mailbox.
OldMessages string
// NewMessages The number of new messages in the mailbox.
NewMessages string
}
func (MWIGetEvent) EventTypeName() string {
return "MWIGet"
}
// MWIGetCompleteEvent Raised in response to a MWIGet command.
type MWIGetCompleteEvent struct {
ActionID string
EventList string
// ListItems The number of mailboxes reported.
ListItems string
}
func (MWIGetCompleteEvent) EventTypeName() string {
return "MWIGetComplete"
}
// IdentifyDetailEvent Provide details about an identify section.
type IdentifyDetailEvent struct {
// ObjectType The object's type. This will always be 'identify'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// Endpoint Name of endpoint identified
Endpoint string
// SrvLookups Perform SRV lookups for provided hostnames.
SrvLookups string
// Match IP addresses or networks to match against.
Match string
// MatchHeader Header/value pair to match against.
MatchHeader string
// EndpointName The name of the endpoint associated with this information.
EndpointName string
}
func (IdentifyDetailEvent) EventTypeName() string {
return "IdentifyDetail"
}
// AorDetailEvent Provide details about an Address of Record (AoR) section.
type AorDetailEvent struct {
// ObjectType The object's type. This will always be 'aor'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// MinimumExpiration Minimum keep alive time for an AoR
MinimumExpiration string
// MaximumExpiration Maximum time to keep an AoR
MaximumExpiration string
// DefaultExpiration Default expiration time in seconds for contacts that are dynamically bound to an AoR.
DefaultExpiration string
// QualifyFrequency Interval at which to qualify an AoR
QualifyFrequency string
// AuthenticateQualify Authenticates a qualify challenge response if needed
AuthenticateQualify string
// MaxContacts Maximum number of contacts that can bind to an AoR
MaxContacts string
// RemoveExisting Determines whether new contacts replace existing ones.
RemoveExisting string
// Mailboxes Allow subscriptions for the specified mailbox(es)
Mailboxes string
// OutboundProxy Outbound proxy used when sending OPTIONS request
OutboundProxy string
// SupportPath Enables Path support for REGISTER requests and Route support for other requests.
SupportPath string
// TotalContacts The total number of contacts associated with this AoR.
TotalContacts string
// ContactsRegistered The number of non-permanent contacts associated with this AoR.
ContactsRegistered string
// EndpointName The name of the endpoint associated with this information.
EndpointName string
}
func (AorDetailEvent) EventTypeName() string {
return "AorDetail"
}
// AuthDetailEvent Provide details about an authentication section.
type AuthDetailEvent struct {
// ObjectType The object's type. This will always be 'auth'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// UserName Username to use for account
UserName string
// Password Username to use for account
Password string
// Md5Cred MD5 Hash used for authentication.
Md5Cred string
// Realm SIP realm for endpoint
Realm string
// NonceLifetime Lifetime of a nonce associated with this authentication config.
NonceLifetime string
// AuthType Authentication type
AuthType string
// EndpointName The name of the endpoint associated with this information.
EndpointName string
}
func (AuthDetailEvent) EventTypeName() string {
return "AuthDetail"
}
// TransportDetailEvent Provide details about an authentication section.
type TransportDetailEvent struct {
// ObjectType The object's type. This will always be 'transport'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// Protocol Protocol to use for SIP traffic
Protocol string
// Bind IP Address and optional port to bind to for this transport
Bind string
// AsycOperations Number of simultaneous Asynchronous Operations
AsycOperations string
// CaListFile File containing a list of certificates to read (TLS ONLY, not WSS)
CaListFile string
// CaListPath Path to directory containing a list of certificates to read (TLS ONLY, not WSS)
CaListPath string
// CertFile Certificate file for endpoint (TLS ONLY, not WSS)
CertFile string
// PrivKeyFile Private key file (TLS ONLY, not WSS)
PrivKeyFile string
// Password Password required for transport
Password string
// ExternalSignalingAddress External address for SIP signalling
ExternalSignalingAddress string
// ExternalSignalingPort External port for SIP signalling
ExternalSignalingPort string
// ExternalMediaAddress External IP address to use in RTP handling
ExternalMediaAddress string
// Domain Domain the transport comes from
Domain string
// VerifyServer Require verification of server certificate (TLS ONLY, not WSS)
VerifyServer string
// VerifyClient Require verification of client certificate (TLS ONLY, not WSS)
VerifyClient string
// RequireClientCert Require client certificate (TLS ONLY, not WSS)
RequireClientCert string
// Method Method of SSL transport (TLS ONLY, not WSS)
Method string
// Cipher Preferred cryptography cipher names (TLS ONLY, not WSS)
Cipher string
// LocalNet Network to consider local (used for NAT purposes).
LocalNet string
// Tos Enable TOS for the signalling sent over this transport
Tos string
// Cos Enable COS for the signalling sent over this transport
Cos string
// WebsocketWriteTimeout The timeout (in milliseconds) to set on WebSocket connections.
WebsocketWriteTimeout string
// EndpointName The name of the endpoint associated with this information.
EndpointName string
}
func (TransportDetailEvent) EventTypeName() string {
return "TransportDetail"
}
// EndpointDetailEvent Provide details about an endpoint section.
type EndpointDetailEvent struct {
// ObjectType The object's type. This will always be 'endpoint'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// Context Dialplan context for inbound sessions
Context string
// Disallow Media Codec(s) to disallow
Disallow string
// Allow Media Codec(s) to allow
Allow string
// DtmfMode DTMF mode
DtmfMode string
// RtpIpv6 Allow use of IPv6 for RTP traffic
RtpIpv6 string
// RtpSymmetric Enforce that RTP must be symmetric
RtpSymmetric string
// IceSupport Enable the ICE mechanism to help traverse NAT
IceSupport string
// UsePtime Use Endpoint's requested packetization interval
UsePtime string
// ForceRport Force use of return port
ForceRport string
// RewriteContact Allow Contact header to be rewritten with the source IP address-port
RewriteContact string
// Transport Explicit transport configuration to use
Transport string
// OutboundProxy Full SIP URI of the outbound proxy used to send requests
OutboundProxy string
// MohSuggest Default Music On Hold class
MohSuggest string
// Field100Rel Allow support for RFC3262 provisional ACK tags
Field100Rel string
// Timers Session timers for SIP packets
Timers string
// TimersMinSe Minimum session timers expiration period
TimersMinSe string
// TimersSessExpires Maximum session timer expiration period
TimersSessExpires string
// Auth Authentication Object(s) associated with the endpoint
Auth string
// OutboundAuth Authentication object(s) used for outbound requests
OutboundAuth string
// Aors AoR(s) to be used with the endpoint
Aors string
// MediaAddress IP address used in SDP for media handling
MediaAddress string
// IdentifyBy Way(s) for the endpoint to be identified
IdentifyBy string
// DirectMedia Determines whether media may flow directly between endpoints.
DirectMedia string
// DirectMediaMethod Direct Media method type
DirectMediaMethod string
// TrustConnectedLine Accept Connected Line updates from this endpoint
TrustConnectedLine string
// SendConnectedLine Send Connected Line updates to this endpoint
SendConnectedLine string
// ConnectedLineMethod Connected line method type
ConnectedLineMethod string
// DirectMediaGlareMitigation Mitigation of direct media (re)INVITE glare
DirectMediaGlareMitigation string
// DisableDirectMediaOnNat Disable direct media session refreshes when NAT obstructs the media session
DisableDirectMediaOnNat string
// Callerid CallerID information for the endpoint
Callerid string
// CalleridPrivacy Default privacy level
CalleridPrivacy string
// CalleridTag Internal id_tag for the endpoint
CalleridTag string
// TrustIdInbound Accept identification information received from this endpoint
TrustIdInbound string
// TrustIdOutbound Send private identification details to the endpoint.
TrustIdOutbound string
// SendPai Send the P-Asserted-Identity header
SendPai string
// SendRpid Send the Remote-Party-ID header
SendRpid string
// SendDiversion Send the Diversion header, conveying the diversion information to the called user agent
SendDiversion string
// Mailboxes NOTIFY the endpoint when state changes for any of the specified mailboxes
Mailboxes string
// AggregateMwi Condense MWI notifications into a single NOTIFY.
AggregateMwi string
// MediaEncryption Determines whether res_pjsip will use and enforce usage of media encryption for this endpoint.
MediaEncryption string
// MediaEncryptionOptimistic Determines whether encryption should be used if possible but does not terminate the session if not achieved.
MediaEncryptionOptimistic string
// UseAvpf Determines whether res_pjsip will use and enforce usage of AVPF for this endpoint.
UseAvpf string
// ForceAvp Determines whether res_pjsip will use and enforce usage of AVP, regardless of the RTP profile in use for this endpoint.
ForceAvp string
// MediaUseReceivedTransport Determines whether res_pjsip will use the media transport received in the offer SDP in the corresponding answer SDP.
MediaUseReceivedTransport string
// OneTouchRecording Determines whether one-touch recording is allowed for this endpoint.
OneTouchRecording string
// InbandProgress Determines whether chan_pjsip will indicate ringing using inband progress.
InbandProgress string
// CallGroup The numeric pickup groups for a channel.
CallGroup string
// PickupGroup The numeric pickup groups that a channel can pickup.
PickupGroup string
// NamedCallGroup The named pickup groups for a channel.
NamedCallGroup string
// NamedPickupGroup The named pickup groups that a channel can pickup.
NamedPickupGroup string
// DeviceStateBusyAt The number of in-use channels which will cause busy to be returned as device state
DeviceStateBusyAt string
// T38Udptl Whether T.38 UDPTL support is enabled or not
T38Udptl string
// T38UdptlEc T.38 UDPTL error correction method
T38UdptlEc string
// T38UdptlMaxdatagram T.38 UDPTL maximum datagram size
T38UdptlMaxdatagram string
// FaxDetect Whether CNG tone detection is enabled
FaxDetect string
// T38UdptlNat Whether NAT support is enabled on UDPTL sessions
T38UdptlNat string
// T38UdptlIpv6 Whether IPv6 is used for UDPTL Sessions
T38UdptlIpv6 string
// ToneZone Set which country's indications to use for channels created for this endpoint.
ToneZone string
// Language Set the default language to use for channels created for this endpoint.
Language string
// RecordOnFeature The feature to enact when one-touch recording is turned on.
RecordOnFeature string
// RecordOffFeature The feature to enact when one-touch recording is turned off.
RecordOffFeature string
// AllowTransfer Determines whether SIP REFER transfers are allowed for this endpoint
AllowTransfer string
// UserEqPhone Determines whether a user=phone parameter is placed into the request URI if the user is determined to be a phone number
UserEqPhone string
// MohPassthrough Determines whether hold and unhold will be passed through using re-INVITEs with recvonly and sendrecv to the remote side
MohPassthrough string
// SdpOwner String placed as the username portion of an SDP origin (o=) line.
SdpOwner string
// SdpSession String used for the SDP session (s=) line.
SdpSession string
// TosAudio DSCP TOS bits for audio streams
TosAudio string
// TosVideo DSCP TOS bits for video streams
TosVideo string
// CosAudio Priority for audio streams
CosAudio string
// CosVideo Priority for video streams
CosVideo string
// AllowSubscribe Determines if endpoint is allowed to initiate subscriptions with Asterisk.
AllowSubscribe string
// SubMinExpiry The minimum allowed expiry time for subscriptions initiated by the endpoint.
SubMinExpiry string
// FromUser Username to use in From header for requests to this endpoint.
FromUser string
// FromDomain Domain to user in From header for requests to this endpoint.
FromDomain string
// MwiFromUser Username to use in From header for unsolicited MWI NOTIFYs to this endpoint.
MwiFromUser string
// RtpEngine Name of the RTP engine to use for channels created for this endpoint
RtpEngine string
// DtlsVerify Verify that the provided peer certificate is valid
DtlsVerify string
// DtlsRekey Interval at which to renegotiate the TLS session and rekey the SRTP session
DtlsRekey string
// DtlsCertFile Path to certificate file to present to peer
DtlsCertFile string
// DtlsPrivateKey Path to private key for certificate file
DtlsPrivateKey string
// DtlsCipher Cipher to use for DTLS negotiation
DtlsCipher string
// DtlsCaFile Path to certificate authority certificate
DtlsCaFile string
// DtlsCaPath Path to a directory containing certificate authority certificates
DtlsCaPath string
// DtlsSetup Whether we are willing to accept connections, connect to the other party, or both.
DtlsSetup string
// SrtpTag32 Determines whether 32 byte tags should be used instead of 80 byte tags.
SrtpTag32 string
// RedirectMethod How redirects received from an endpoint are handled
RedirectMethod string
// SetVar Variable set on a channel involving the endpoint.
SetVar string
// MessageContext Context to route incoming MESSAGE requests to.
MessageContext string
// Accountcode An accountcode to set automatically on any channels created for this endpoint.
Accountcode string
// PreferredCodecOnly Respond to a SIP invite with the single most preferred codec (DEPRECATED)
PreferredCodecOnly string
// DeviceState The aggregate device state for this endpoint.
DeviceState string
// ActiveChannels The number of active channels associated with this endpoint.
ActiveChannels string
// SubscribeContext Context for incoming MESSAGE requests.
SubscribeContext string
// Allowoverlap Enable RFC3578 overlap dialing support.
Allowoverlap string
}
func (EndpointDetailEvent) EventTypeName() string {
return "EndpointDetail"
}
// AorListEvent Provide details about an Address of Record (AoR) section.
type AorListEvent struct {
// ObjectType The object's type. This will always be 'aor'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// MinimumExpiration Minimum keep alive time for an AoR
MinimumExpiration string
// MaximumExpiration Maximum time to keep an AoR
MaximumExpiration string
// DefaultExpiration Default expiration time in seconds for contacts that are dynamically bound to an AoR.
DefaultExpiration string
// QualifyFrequency Interval at which to qualify an AoR
QualifyFrequency string
// AuthenticateQualify Authenticates a qualify challenge response if needed
AuthenticateQualify string
// MaxContacts Maximum number of contacts that can bind to an AoR
MaxContacts string
// RemoveExisting Determines whether new contacts replace existing ones.
RemoveExisting string
// Mailboxes Allow subscriptions for the specified mailbox(es)
Mailboxes string
// OutboundProxy Outbound proxy used when sending OPTIONS request
OutboundProxy string
// SupportPath Enables Path support for REGISTER requests and Route support for other requests.
SupportPath string
}
func (AorListEvent) EventTypeName() string {
return "AorList"
}
// AuthListEvent Provide details about an Address of Record (Auth) section.
type AuthListEvent struct {
// ObjectType The object's type. This will always be 'auth'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// UserName Username to use for account
UserName string
// Md5Cred MD5 Hash used for authentication.
Md5Cred string
// Realm SIP realm for endpoint
Realm string
// AuthType Authentication type
AuthType string
// Password Plain text password used for authentication.
Password string
// NonceLifetime Lifetime of a nonce associated with this authentication config.
NonceLifetime string
}
func (AuthListEvent) EventTypeName() string {
return "AuthList"
}
// ContactListEvent Provide details about a contact section.
type ContactListEvent struct {
// ObjectType The object's type. This will always be 'contact'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// ViaAddr IP address of the last Via header in REGISTER request. Will only appear in the event if available.
ViaAddr string
// ViaPort Port number of the last Via header in REGISTER request. Will only appear in the event if available.
ViaPort string
// QualifyTimeout The elapsed time in decimal seconds after which an OPTIONS message is sent before the contact is considered unavailable.
QualifyTimeout string
// CallId Content of the Call-ID header in REGISTER request. Will only appear in the event if available.
CallId string
// RegServer Asterisk Server name.
RegServer string
// PruneOnBoot If true delete the contact on Asterisk restart/boot.
PruneOnBoot string
// Path The Path header received on the REGISTER.
Path string
// Endpoint The name of the endpoint associated with this information.
Endpoint string
// AuthenticateQualify A boolean indicating whether a qualify should be authenticated.
AuthenticateQualify string
// Uri This contact's URI.
Uri string
// QualifyFrequency The interval in seconds at which the contact will be qualified.
QualifyFrequency string
// UserAgent Content of the User-Agent header in REGISTER request
UserAgent string
// ExpirationTime Absolute time that this contact is no longer valid after
ExpirationTime string
// OutboundProxy The contact's outbound proxy.
OutboundProxy string
// Status This contact's status.
Status string
// RoundtripUsec The round trip time in microseconds.
RoundtripUsec string
}
func (ContactListEvent) EventTypeName() string {
return "ContactList"
}
// ContactStatusDetailEvent Provide details about a contact's status.
type ContactStatusDetailEvent struct {
// AOR The AoR that owns this contact.
AOR string
// URI This contact's URI.
URI string
// Status This contact's status.
Status string
// RoundtripUsec The round trip time in microseconds.
RoundtripUsec string
// EndpointName The name of the endpoint associated with this information.
EndpointName string
// UserAgent Content of the User-Agent header in REGISTER request
UserAgent string
// RegExpire Absolute time that this contact is no longer valid after
RegExpire string
// ViaAddress IP address:port of the last Via header in REGISTER request. Will only appear in the event if available.
ViaAddress string
// CallID Content of the Call-ID header in REGISTER request. Will only appear in the event if available.
CallID string
// Id The sorcery ID of the contact.
Id string
// AuthenticateQualify A boolean indicating whether a qualify should be authenticated.
AuthenticateQualify string
// OutboundProxy The contact's outbound proxy.
OutboundProxy string
// Path The Path header received on the REGISTER.
Path string
// QualifyFrequency The interval in seconds at which the contact will be qualified.
QualifyFrequency string
// QualifyTimeout The elapsed time in decimal seconds after which an OPTIONS message is sent before the contact is considered unavailable.
QualifyTimeout string
}
func (ContactStatusDetailEvent) EventTypeName() string {
return "ContactStatusDetail"
}
// EndpointListEvent Provide details about a contact's status.
type EndpointListEvent struct {
// ObjectType The object's type. This will always be 'endpoint'.
ObjectType string
// ObjectName The name of this object.
ObjectName string
// Transport The transport configurations associated with this endpoint.
Transport string
// Aor The aor configurations associated with this endpoint.
Aor string
// Auths The inbound authentication configurations associated with this endpoint.
Auths string
// OutboundAuths The outbound authentication configurations associated with this endpoint.
OutboundAuths string
// DeviceState The aggregate device state for this endpoint.
DeviceState string
// ActiveChannels The number of active channels associated with this endpoint.
ActiveChannels string
}
func (EndpointListEvent) EventTypeName() string {
return "EndpointList"
}
// FAXSessionsEntryEvent A single list item for the FAXSessions AMI command
type FAXSessionsEntryEvent struct {
ActionID string
// Channel Name of the channel responsible for the FAX session
Channel string
// Technology The FAX technology that the FAX session is using
Technology string
// SessionNumber The numerical identifier for this particular session
SessionNumber string
// SessionType FAX session passthru/relay type
SessionType string
// Operation FAX session operation type
Operation string
// State Current state of the FAX session
State string
// Files File or list of files associated with this FAX session
Files string
}
func (FAXSessionsEntryEvent) EventTypeName() string {
return "FAXSessionsEntry"
}
// FAXSessionsCompleteEvent Raised when all FAXSession events are completed for a FAXSessions command
type FAXSessionsCompleteEvent struct {
ActionID string
// Total Count of FAXSession events sent in response to FAXSessions action
Total string
}
func (FAXSessionsCompleteEvent) EventTypeName() string {
return "FAXSessionsComplete"
}
// FAXSessionEvent Raised in response to FAXSession manager command
type FAXSessionEvent struct {
ActionID string
// SessionNumber The numerical identifier for this particular session
SessionNumber string
// Operation FAX session operation type
Operation string
// State Current state of the FAX session
State string
// ErrorCorrectionMode Whether error correcting mode is enabled for the FAX session. This field is not included when operation is 'V.21 Detect' or if operation is 'gateway' and state is 'Uninitialized'
ErrorCorrectionMode string
// DataRate Bit rate of the FAX. This field is not included when operation is 'V.21 Detect' or if operation is 'gateway' and state is 'Uninitialized'.
DataRate string
// ImageResolution Resolution of each page of the FAX. Will be in the format of X_RESxY_RES. This field is not included if the operation is anything other than Receive/Transmit.
ImageResolution string
// PageNumber Current number of pages transferred during this FAX session. May change as the FAX progresses. This field is not included when operation is 'V.21 Detect' or if operation is 'gateway' and state is 'Uninitialized'.
PageNumber string
// FileName Filename of the image being sent/received for this FAX session. This field is not included if Operation isn't 'send' or 'receive'.
FileName string
// PagesTransmitted Total number of pages sent during this session. This field is not included if Operation isn't 'send' or 'receive'. Will always be 0 for 'receive'.
PagesTransmitted string
// PagesReceived Total number of pages received during this session. This field is not included if Operation is not 'send' or 'receive'. Will be 0 for 'send'.
PagesReceived string
// TotalBadLines Total number of bad lines sent/received during this session. This field is not included if Operation is not 'send' or 'received'.
TotalBadLines string
}
func (FAXSessionEvent) EventTypeName() string {
return "FAXSession"
}
// FAXStatsEvent Raised in response to FAXStats manager command
type FAXStatsEvent struct {
ActionID string
// CurrentSessions Number of active FAX sessions
CurrentSessions string
// ReservedSessions Number of reserved FAX sessions
ReservedSessions string
// TransmitAttempts Total FAX sessions for which Asterisk is/was the transmitter
TransmitAttempts string
// ReceiveAttempts Total FAX sessions for which Asterisk is/was the recipient
ReceiveAttempts string
// CompletedFAXes Total FAX sessions which have been completed successfully
CompletedFAXes string
// FailedFAXes Total FAX sessions which failed to complete successfully
FailedFAXes string
}
func (FAXStatsEvent) EventTypeName() string {
return "FAXStats"
}
// AsyncAGIStartEvent Raised when a channel starts AsyncAGI command processing.
type AsyncAGIStartEvent struct {
// Env URL encoded string read from the AsyncAGI server.
Env string
}
func (AsyncAGIStartEvent) EventTypeName() string {
return "AsyncAGIStart"
}
// AsyncAGIEndEvent Raised when a channel stops AsyncAGI command processing.
type AsyncAGIEndEvent struct {
}
func (AsyncAGIEndEvent) EventTypeName() string {
return "AsyncAGIEnd"
}
// AsyncAGIExecEvent Raised when AsyncAGI completes an AGI command.
type AsyncAGIExecEvent struct {
// CommandID Optional command ID sent by the AsyncAGI server to identify the command.
CommandID string
// Result URL encoded result string from the executed AGI command.
Result string
}
func (AsyncAGIExecEvent) EventTypeName() string {
return "AsyncAGIExec"
}
// AGIExecStartEvent Raised when a received AGI command starts processing.
type AGIExecStartEvent struct {
// Command The AGI command as received from the external source.
Command string
// CommandId Random identification number assigned to the execution of this command.
CommandId string
}
func (AGIExecStartEvent) EventTypeName() string {
return "AGIExecStart"
}
// AGIExecEndEvent Raised when a received AGI command completes processing.
type AGIExecEndEvent struct {
// Command The AGI command as received from the external source.
Command string
// CommandId Random identification number assigned to the execution of this command.
CommandId string
// ResultCode The numeric result code from AGI
ResultCode string
// Result The text result reason from AGI
Result string
}
func (AGIExecEndEvent) EventTypeName() string {
return "AGIExecEnd"
}
// ExtensionStateListCompleteEvent Indicates the end of the list the current known extension states.
type ExtensionStateListCompleteEvent struct {
// EventList Conveys the status of the event list.
EventList string
// ListItems Conveys the number of statuses reported.
ListItems string
}
func (ExtensionStateListCompleteEvent) EventTypeName() string {
return "ExtensionStateListComplete"
}
// BridgeInfoCompleteEvent Information about a bridge.
type BridgeInfoCompleteEvent struct {
}
func (BridgeInfoCompleteEvent) EventTypeName() string {
return "BridgeInfoComplete"
}
// BridgeInfoChannelEvent Information about a channel in a bridge.
type BridgeInfoChannelEvent struct {
}
func (BridgeInfoChannelEvent) EventTypeName() string {
return "BridgeInfoChannel"
}
// PresenceStateListCompleteEvent Indicates the end of the list the current known extension states.
type PresenceStateListCompleteEvent struct {
// EventList Conveys the status of the event list.
EventList string
// ListItems Conveys the number of statuses reported.
ListItems string
}
func (PresenceStateListCompleteEvent) EventTypeName() string {
return "PresenceStateListComplete"
}
// EndpointListCompleteEvent Provide final information about an endpoint list.
type EndpointListCompleteEvent struct {
EventList string
ListItems string
}
func (EndpointListCompleteEvent) EventTypeName() string {
return "EndpointListComplete"
}
// EndpointDetailCompleteEvent Provide final information about endpoint details.
type EndpointDetailCompleteEvent struct {
EventList string
ListItems string
}
func (EndpointDetailCompleteEvent) EventTypeName() string {
return "EndpointDetailComplete"
}
// AorListCompleteEvent Provide final information about an aor list.
type AorListCompleteEvent struct {
EventList string
ListItems string
}
func (AorListCompleteEvent) EventTypeName() string {
return "AorListComplete"
}
// AuthListCompleteEvent Provide final information about an auth list.
type AuthListCompleteEvent struct {
EventList string
ListItems string
}
func (AuthListCompleteEvent) EventTypeName() string {
return "AuthListComplete"
}
// ContactListCompleteEvent Provide final information about a contact list.
type ContactListCompleteEvent struct {
EventList string
ListItems string
}
func (ContactListCompleteEvent) EventTypeName() string {
return "ContactListComplete"
}
// DeviceStateListCompleteEvent Indicates the end of the list the current known extension states.
type DeviceStateListCompleteEvent struct {
// EventList Conveys the status of the event list.
EventList string
// ListItems Conveys the number of statuses reported.
ListItems string
}
func (DeviceStateListCompleteEvent) EventTypeName() string {
return "DeviceStateListComplete"
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/amimodels/evt.go 0000664 0000000 0000000 00000000352 14650613361 0025325 0 ustar 00root root 0000000 0000000 package amimodels
import "github.com/pkg/errors"
func (evt OriginateResponseEvent) Err() error {
if evt.Response == "Failure" {
return errors.Errorf("Originate failed: exten %v reason %v", evt.Exten, evt.Reason)
}
return nil
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/amimodels/iface.go 0000664 0000000 0000000 00000002417 14650613361 0025602 0 ustar 00root root 0000000 0000000 package amimodels
import "errors"
type Event interface {
EventTypeName() string
}
type Action interface {
ActionTypeName() string
}
type HasActionID interface {
GetActionID() string
SetActionID(actionID string)
}
type Handler interface {
Request(req *Request) *Response
}
type HandlerFunc func(req *Request) *Response
func (f HandlerFunc) Request(req *Request) *Response {
return f(req)
}
type Client struct {
Handler
}
func (cli *Client) Action(act Action, res interface{}, opts ...RequestOption) error {
r, err := BuildRequest(act, res, opts...)
if err != nil {
return err
}
return cli.Request(r).Err()
}
type Response struct {
Response string // Success, Error
ActionID string
Message string
Timestamp string // 1621260071.803488
Headers map[string]string
Error error
}
func (res *Response) Err() error {
if res.Error != nil {
return res.Error
}
if res.Response == "Error" {
return errors.New(res.Message)
}
return nil
}
type Request struct {
Action Action
Response *Response
}
type RequestOption func(r *Request) error
func BuildRequest(act Action, res interface{}, opts ...RequestOption) (r *Request, err error) {
r = &Request{
Action: act,
}
for _, v := range opts {
if err = v(r); err != nil {
return nil, err
}
}
return
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/conn.go 0000664 0000000 0000000 00000000667 14650613361 0023523 0 ustar 00root root 0000000 0000000 package ami
import (
"bufio"
"context"
"net"
"sync"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
)
type Conn struct {
g *errgroup.Group
conn net.Conn
reader *bufio.Reader
nextID func() string
pending chan *asyncMsg
recv chan *Message
ctx context.Context
closer context.CancelFunc
closed bool
version string
logger *zap.Logger
conf *ConnectOptions
subs []*subscribe
subLoc sync.Mutex
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/conn_internal.go 0000664 0000000 0000000 00000004722 14650613361 0025413 0 ustar 00root root 0000000 0000000 package ami
import (
"context"
"errors"
"os"
"time"
)
// promise like
type asyncMsg struct {
id string
msg *Message
resp *Message
err error
result chan *asyncMsg
cb func(v *asyncMsg)
ctx context.Context
done bool
}
func (async *asyncMsg) complete() {
if async.done {
return
}
if async.result != nil {
async.result <- async
close(async.result)
}
if async.cb != nil {
go func() {
async.cb(async)
}()
}
async.done = true
}
func (c *Conn) read(ctx context.Context) (err error) {
log := c.logger
log.Debug("start read loop")
defer func() {
log.Debug("done read loop")
}()
for {
msg := &Message{}
if err = msg.Read(c.reader); err != nil && !errors.Is(err, os.ErrDeadlineExceeded) {
return
}
if msg.Type != "" {
c.recv <- msg
}
if ctx.Err() != nil {
return ctx.Err()
}
}
}
func (c *Conn) loop(ctx context.Context) (err error) {
ids := map[string]*asyncMsg{}
defer func() {
for _, v := range ids {
v.err = err
v.complete()
}
}()
log := c.logger
cleanTicker := time.NewTicker(5 * time.Second)
c.logger.Debug("start event loop")
defer func() {
log.Debug("done event loop")
}()
for {
select {
case <-ctx.Done():
return ctx.Err()
case <-cleanTicker.C:
c.cleanUnsub()
case async := <-c.pending:
//err = c.conn.SetDeadline(time.Now().Add(1 * time.Second))
//if err != nil {
// return
//}
// send pending message
msg := async.msg
//log.Sugar().With("id", async.id, "type", msg.Type, "name", msg.Name).Debug("send message")
err = msg.Write(c.conn)
if err != nil {
async.err = err
async.complete()
} else if async.id != "" {
ids[async.id] = async
}
c.onSend(async)
case msg := <-c.recv:
// received
if msg.Type == MessageTypeResponse {
id := msg.AttrString(attrActionID)
if id != "" {
async := ids[id]
if async == nil {
log.Sugar().With("id", id).Warn("response untracked")
} else {
async.resp = msg
async.complete()
}
}
}
c.onRecv(msg)
}
}
}
func (c *Conn) onSend(msg *asyncMsg) {
subs := c.subs
for _, v := range subs {
if v.unsub || !v.onSent {
continue
}
ctx := v.ctx
if ctx == nil {
ctx = c.ctx
}
v.unsub = !v.f(ctx, msg.msg)
}
}
func (c *Conn) onRecv(msg *Message) {
subs := c.subs
for _, v := range subs {
if v.unsub || !v.onRecv {
continue
}
ctx := v.ctx
if ctx == nil {
ctx = c.ctx
}
// NOTE blocked
v.unsub = !v.f(ctx, msg)
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/connect.go 0000664 0000000 0000000 00000012011 14650613361 0024201 0 ustar 00root root 0000000 0000000 package ami
import (
"bufio"
"context"
"fmt"
"net"
"regexp"
"sync/atomic"
"time"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"github.com/wenerme/astgo/ami/amimodels"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
)
// CustomDialer can be used to specify any dialer, not necessarily
// a *net.Dialer.
type CustomDialer interface {
Dial(network, address string) (net.Conn, error)
}
type ConnErrHandler func(*Conn, error)
type ConnHandler func(*Conn)
type ConnectOptions struct {
Context context.Context
Timeout time.Duration
AllowReconnect bool
Username string // login username
Secret string // login secret
Logger *zap.Logger
Dialer CustomDialer
OnConnectErr ConnErrHandler
OnConnected ConnHandler
subscribers []struct {
sub SubscribeFunc
opts []SubscribeOption
}
}
type ConnectOption func(c *ConnectOptions) error
func WithAuth(username string, secret string) ConnectOption {
return func(c *ConnectOptions) error {
c.Username = username
c.Secret = secret
return nil
}
}
func WithSubscribe(cb SubscribeFunc, opts ...SubscribeOption) ConnectOption {
return func(c *ConnectOptions) error {
c.subscribers = append(c.subscribers, struct {
sub SubscribeFunc
opts []SubscribeOption
}{sub: cb, opts: opts})
return nil
}
}
func Connect(addr string, opts ...ConnectOption) (conn *Conn, err error) {
opt := &ConnectOptions{
Timeout: 10 * time.Second,
Context: context.Background(),
Logger: zap.L(),
}
for _, v := range opts {
if err = v(opt); err != nil {
return nil, err
}
}
if opt.Dialer == nil {
opt.Dialer = &net.Dialer{
Timeout: opt.Timeout,
}
}
var id uint64
conn = &Conn{
ctx: opt.Context,
conf: opt,
logger: opt.Logger,
recv: make(chan *Message, 4096),
pending: make(chan *asyncMsg, 100),
nextID: func() string {
return fmt.Sprint(atomic.AddUint64(&id, 1))
},
}
for _, sub := range opt.subscribers {
_, err = conn.Subscribe(sub.sub, sub.opts...)
if err != nil {
return nil, err
}
}
return conn, conn.dial(addr)
}
func (c *Conn) Close() error {
if c.closer != nil {
c.closed = true
c.closer()
c.closer = nil
err := c.g.Wait()
if errors.Is(err, errClose) {
return nil
}
return err
}
if c.closed {
return nil
}
return errors.New("not init")
}
func (c *Conn) dial(addr string) (err error) {
conf := c.conf
if conf.AllowReconnect {
// NOTE reconnect keep pending, but fail all async
go func() {
log := c.logger
onErr := conf.OnConnectErr
if onErr == nil {
onErr = func(conn *Conn, err error) {
}
}
var err error
for !c.closed {
err = c.dialOnce(addr)
if err != nil {
log.Sugar().With("err", err).Warn("ami.Conn: dial")
onErr(c, err)
// fixme improve wait strategy
<-time.NewTimer(time.Second).C
continue
}
if conf.OnConnected != nil {
conf.OnConnected(c)
log.Sugar().Info("ami.Conn: connected")
}
err = c.g.Wait()
if err != nil {
log.Sugar().With("err", err).Warn("ami.Conn: error")
onErr(c, err)
}
c.g = nil
}
log.Sugar().Info("ami.Conn: stop reconnect, conn closed")
}()
return nil
}
return c.dialOnce(addr)
}
func (c *Conn) dialOnce(addr string) (err error) {
conf := c.conf
conn, err := conf.Dialer.Dial("tcp", addr)
if err != nil {
return err
}
defer func() {
if err != nil {
if e := conn.Close(); e != nil {
err = multierror.Append(err, e)
}
}
}()
return c.connect(conn)
}
var errClose = errors.New("Close")
func (c *Conn) connect(conn net.Conn) (err error) {
log := c.logger
r := bufio.NewReader(conn)
c.reader = r
c.conn = conn
line, err := r.ReadString('\n')
if err != nil {
return errors.Wrap(err, "scan ami initial line")
}
// check connection
match := regexp.MustCompile("Asterisk Call Manager/([0-9.]+)").FindStringSubmatch(line)
if len(match) > 1 {
c.version = match[1]
log.Sugar().With("version", c.version).Debug("AMI Version")
} else {
err = errors.Errorf("Invalid server header: %q", line)
return
}
ctx := c.ctx
if ctx == nil {
ctx = context.Background()
}
c.g, ctx = errgroup.WithContext(ctx)
c.g.Go(func() error {
return c.read(ctx)
})
c.g.Go(func() error {
return c.loop(ctx)
})
// manual close
waitCtx, closer := context.WithCancel(ctx)
c.g.Go(func() error {
<-ctx.Done()
closer()
return conn.Close()
})
c.g.Go(func() error {
<-waitCtx.Done()
return errClose
})
c.closer = closer
conf := c.conf
if conf.Username != "" {
var resp *Message
resp, err = c.Request(amimodels.LoginAction{
UserName: conf.Username,
Secret: conf.Secret,
}, RequestTimeout(2*time.Second))
if err != nil {
err = errors.Wrap(err, "request login")
} else if !resp.Success() {
err = errors.Wrap(resp.Error(), "login")
}
if err != nil {
log.Sugar().With("err", err).Info("login failed")
return err
}
log.Info("login success")
}
//log.Sugar().Debug("do conn check ping")
// be ready
// may not FullyBooted
// _, err = c.Request(amimodels.PingAction{})
return
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/connect_demo_test.go 0000664 0000000 0000000 00000001207 14650613361 0026251 0 ustar 00root root 0000000 0000000 package ami_test
import (
"context"
"fmt"
"github.com/wenerme/astgo/ami"
)
func ExampleConnect() {
boot := make(chan *ami.Message, 1)
conn, err := ami.Connect(
"192.168.1.1:5038",
ami.WithAuth("admin", "admin"), // AMI auth
// add predefined subscriber
ami.WithSubscribe(ami.SubscribeFullyBootedChanOnce(boot)),
ami.WithSubscribe(func(ctx context.Context, msg *ami.Message) bool {
fmt.Println(msg.Format()) // log everything
return true // keep subscribe
}, ami.SubscribeSend(), // subscribe send message - default recv only
))
if err != nil {
panic(err)
}
<-boot
// AMI now FullyBooted
_ = conn
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/handler.go 0000664 0000000 0000000 00000001312 14650613361 0024167 0 ustar 00root root 0000000 0000000 package ami
import "context"
func SubscribeChan(c chan *Message, names ...string) SubscribeFunc {
m := make(map[string]struct{}, len(names))
for _, v := range names {
m[v] = struct{}{}
}
filter := func(ctx context.Context, msg *Message) bool {
_, ok := m[msg.Name]
return ok
}
if len(names) == 0 {
filter = func(ctx context.Context, msg *Message) bool {
return true
}
}
return func(ctx context.Context, msg *Message) bool {
if filter(ctx, msg) {
c <- msg
}
return true
}
}
func SubscribeFullyBootedChanOnce(c chan *Message) SubscribeFunc {
return func(ctx context.Context, msg *Message) bool {
if msg.Name == "FullyBooted" {
c <- msg
return false
}
return true
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/msg.go 0000664 0000000 0000000 00000010116 14650613361 0023342 0 ustar 00root root 0000000 0000000 package ami
import (
"bufio"
"bytes"
"fmt"
"io"
"strings"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/wenerme/astgo/ami/amimodels"
)
type MessageType string
const (
MessageTypeAction MessageType = "Action"
MessageTypeEvent MessageType = "Event"
MessageTypeResponse MessageType = "Response"
)
type Message struct {
Type MessageType // type of message
Name string // name of message
Attributes map[string]interface{}
}
func ReadMessage(m *Message, rd io.Reader) (err error) {
r := bufio.NewReader(rd)
m.Attributes = map[string]interface{}{}
var line string
line, err = r.ReadString('\n')
if err != nil {
return err
}
RETRY:
line = strings.TrimSuffix(line, "\r\n")
if line == "" {
goto RETRY
}
sp := strings.SplitN(line, ":", 2)
if len(sp) != 2 {
return errors.Errorf("invalid type line read: %q", line)
}
m.Type = MessageType(sp[0])
m.Name = strings.TrimSpace(sp[1])
switch m.Type {
case MessageTypeAction:
case MessageTypeEvent:
case MessageTypeResponse:
default:
return errors.Errorf("invalid message type: %q", sp[0])
}
var stack [][]string
for {
// may contain BOM
line, err = r.ReadString('\n')
if err != nil {
return err
}
if line == "\r\n" {
break
}
sp = strings.SplitN(line, ":", 2)
switch {
case len(sp) == 2 && strings.HasSuffix(line, "\r\n"):
// valid line
stack = append(stack, sp)
case len(stack) == 0 && len(sp) == 2:
// first line
stack = append(stack, sp)
case len(stack) != 0:
// continue line
stack = append(stack, []string{"", line})
}
}
var k, v string
for _, pair := range stack {
switch {
case pair[0] != "" && k != "":
m.Attributes[k] = strings.TrimSuffix(v, "\r\n")
k = ""
v = ""
fallthrough
case pair[0] != "":
k = pair[0]
v = strings.TrimLeft(pair[1], " ")
case pair[0] == "":
v += pair[1]
}
}
if k != "" {
m.Attributes[k] = strings.TrimSuffix(v, "\r\n")
}
return
}
func WriteMessage(m *Message, w io.Writer) (err error) {
wr := bufio.NewWriter(w)
_, _ = wr.WriteString(fmt.Sprintf("%v: %v\r\n", m.Type, m.Name))
for k, v := range m.Attributes {
_, _ = wr.WriteString(fmt.Sprintf("%v: %v\r\n", k, v))
}
_, _ = wr.WriteString("\r\n")
err = wr.Flush()
return
}
func (m *Message) Read(r *bufio.Reader) (err error) {
return ReadMessage(m, r)
}
func (m *Message) Write(w io.Writer) (err error) {
return WriteMessage(m, w)
}
func (m Message) Format() string {
b := bytes.Buffer{}
_ = m.Write(&b)
return b.String()
}
func (m *Message) AttrString(name string) string {
if m.Attributes == nil {
return ""
}
msg := m.Attributes[name]
if msg == nil {
return ""
}
return fmt.Sprint(msg)
}
func (m *Message) Message() string {
return m.AttrString("Message")
}
func (m *Message) Success() bool {
if m.Type == MessageTypeResponse && m.Name == "Success" {
return true
}
return false
}
func (m *Message) Error() error {
if m.Type == MessageTypeResponse && m.Name == "Error" {
msg := m.Message()
if msg == "" {
msg = "error response"
}
return errors.New(msg)
}
return nil
}
func (m *Message) SetAttr(name string, val interface{}) {
if m.Attributes == nil {
m.Attributes = make(map[string]interface{})
}
m.Attributes[name] = val
}
func MustConvertToMessage(in interface{}) (msg *Message) {
m, err := ConvertToMessage(in)
if err != nil {
panic(err)
}
return m
}
func ConvertToMessage(in interface{}) (msg *Message, err error) {
msg = &Message{}
switch a := in.(type) {
case Message:
return &a, err
case *Message:
return a, err
case amimodels.Action:
msg.Type = MessageTypeAction
msg.Name = a.ActionTypeName()
case amimodels.Event:
msg.Type = MessageTypeEvent
msg.Name = a.EventTypeName()
default:
return nil, errors.Errorf("invalid type: %T", in)
}
m := make(map[string]interface{})
err = mapstructure.Decode(in, &m)
// remove zero
for k, v := range m {
rm := v == nil
// NOTE support require tag, prevent remove required empty value ?
switch v := v.(type) {
case string:
rm = v == ""
case int:
rm = v == 0
}
if rm {
delete(m, k)
}
}
msg.Attributes = m
return
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/msg_test.go 0000664 0000000 0000000 00000003053 14650613361 0024403 0 ustar 00root root 0000000 0000000 package ami
import (
"bufio"
"bytes"
"io"
"sort"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/wenerme/astgo/ami/amimodels"
)
func TestMsgIO(t *testing.T) {
for _, test := range []struct {
msg *Message
out string
}{
{
msg: &Message{
Type: MessageTypeEvent,
Name: "Name",
Attributes: map[string]interface{}{
"Text": "12\r\n34",
"More": "Yes",
},
},
// more after multi line
out: "Event: Name\r\nText: 12\r\n34\r\nMore: Yes\r\n\r\n",
},
{
msg: &Message{
Type: MessageTypeEvent,
Name: "Name",
Attributes: map[string]interface{}{
"Text": "12\r\n34",
},
},
// simple multi line
out: "Event: Name\r\nText: 12\r\n34\r\n\r\n",
},
{
msg: &Message{
Type: MessageTypeEvent,
Name: "FullyBooted",
Attributes: map[string]interface{}{
"Uptime": "1234",
},
},
out: "Event: FullyBooted\r\nUptime: 1234\r\n\r\n",
},
{msg: MustConvertToMessage(amimodels.FullyBootedEvent{
Uptime: "1234",
}),
out: "Event: FullyBooted\r\nUptime: 1234\r\n\r\n"},
} {
msg := test.msg
// ignore order
exp := strings.Split(test.out, "\r\n")
act := strings.Split(msg.Format(), "\r\n")
sort.Strings(exp)
sort.Strings(act)
assert.Equal(t, exp, act)
r := bufio.NewReader(bytes.NewReader([]byte(test.out)))
rm := &Message{}
assert.NoError(t, rm.Read(r))
assert.Equal(t, msg.Type, rm.Type)
assert.Equal(t, msg.Name, rm.Name)
assert.Equal(t, msg.Attributes, rm.Attributes)
_, err := r.ReadByte()
assert.Equal(t, io.EOF, err)
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/request.go 0000664 0000000 0000000 00000003477 14650613361 0024260 0 ustar 00root root 0000000 0000000 package ami
import (
"context"
"time"
"github.com/pkg/errors"
)
const attrActionID = "ActionID"
type requestOptions struct {
Timeout time.Duration
OnComplete func(ctx context.Context, msg *Message, err error)
}
type RequestOption func(o *requestOptions) error
func RequestTimeout(d time.Duration) RequestOption {
return func(o *requestOptions) error {
o.Timeout = d
return nil
}
}
// RequestResponseCallback will case Conn.Request run async, will not timeout
func RequestResponseCallback(cb func(ctx context.Context, msg *Message, err error)) RequestOption {
return func(o *requestOptions) error {
o.OnComplete = cb
return nil
}
}
func (c *Conn) Request(r interface{}, opts ...RequestOption) (resp *Message, err error) {
var msg *Message
msg, err = ConvertToMessage(r)
if err != nil {
return nil, err
}
if msg.Type != MessageTypeAction {
return nil, errors.Errorf("can only request action: %v", msg.Type)
}
async := &asyncMsg{
id: c.nextID(),
msg: msg,
result: make(chan *asyncMsg, 1),
ctx: context.Background(),
}
o := requestOptions{
Timeout: time.Second * 30,
}
for _, opt := range opts {
if err = opt(&o); err != nil {
return
}
}
onComplete := o.OnComplete
if onComplete != nil {
async.cb = func(v *asyncMsg) {
onComplete(v.ctx, v.resp, v.err)
}
}
msg.SetAttr(attrActionID, async.id)
if async.cb == nil {
var cancel context.CancelFunc
// todo allowed custom timeout
async.ctx, cancel = context.WithTimeout(async.ctx, o.Timeout)
defer cancel()
}
// enqueue
c.pending <- async
if async.cb != nil {
return nil, errors.New("No response yet")
}
select {
case <-async.ctx.Done():
return nil, async.ctx.Err()
case <-async.result:
err = async.err
if err == nil && async.resp != nil {
err = async.resp.Error()
}
return async.resp, err
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/ami/subscribe.go 0000664 0000000 0000000 00000002034 14650613361 0024535 0 ustar 00root root 0000000 0000000 package ami
import "context"
type subscribe struct {
f SubscribeFunc
ctx context.Context
unsub bool
onSent bool
onRecv bool
}
type SubscribeFunc func(ctx context.Context, message *Message) bool
type SubscribeOption func(o *subscribe) error
func SubscribeSend() SubscribeOption {
return func(o *subscribe) error {
o.onSent = true
return nil
}
}
func SubscribeSetContext(ctx context.Context) SubscribeOption {
return func(o *subscribe) error {
o.ctx = ctx
return nil
}
}
func (c *Conn) Subscribe(cb SubscribeFunc, opts ...SubscribeOption) (func(), error) {
c.subLoc.Lock()
defer c.subLoc.Unlock()
sub := &subscribe{
f: cb,
onRecv: true,
}
for _, v := range opts {
err := v(sub)
if err != nil {
return nil, err
}
}
c.subs = append(c.subs, sub)
return func() {
sub.unsub = true
}, nil
}
func (c *Conn) cleanUnsub() {
c.subLoc.Lock()
defer c.subLoc.Unlock()
var neo []*subscribe
subs := c.subs
for _, sub := range subs {
if !sub.unsub {
neo = append(neo, sub)
}
}
c.subs = neo
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/astdb/ 0000775 0000000 0000000 00000000000 14650613361 0022555 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/astdb/_enum_gen_test.go 0000664 0000000 0000000 00000014767 14650613361 0026116 0 ustar 00root root 0000000 0000000 package astdb_test
import (
"bytes"
"fmt"
"os"
"regexp"
"sort"
"strings"
"testing"
"text/template"
"github.com/iancoleman/strcase"
"github.com/stretchr/testify/assert"
"github.com/wenerme/astgo/pkg/tools/xmlgen"
)
func TestEnumGen(t *testing.T) {
// from exported pg sql
s := `
CREATE TYPE ast_bool_values AS ENUM ('0', '1', 'off', 'on', 'false', 'true', 'no', 'yes');
CREATE TYPE iax_encryption_values AS ENUM ('yes', 'no', 'aes128');
CREATE TYPE iax_requirecalltoken_values AS ENUM ('yes', 'no', 'auto');
CREATE TYPE iax_transfer_values AS ENUM ('yes', 'no', 'mediaonly');
CREATE TYPE moh_mode_values AS ENUM ('custom', 'files', 'mp3nb', 'quietmp3nb', 'quietmp3');
CREATE TYPE moh_mode_values AS ENUM ('custom', 'files', 'mp3nb', 'quietmp3nb', 'quietmp3', 'playlist');
CREATE TYPE pjsip_100rel_values AS ENUM ('no', 'required', 'yes');
CREATE TYPE pjsip_auth_type_values AS ENUM ('md5', 'userpass');
CREATE TYPE pjsip_auth_type_values_v2 AS ENUM ('md5', 'userpass', 'google_oauth');
CREATE TYPE pjsip_cid_privacy_values AS ENUM ('allowed_not_screened', 'allowed_passed_screened', 'allowed_failed_screened', 'allowed', 'prohib_not_screened', 'prohib_passed_screened', 'prohib_failed_screened', 'prohib', 'unavailable');
CREATE TYPE pjsip_connected_line_method_values AS ENUM ('invite', 'reinvite', 'update');
CREATE TYPE pjsip_direct_media_glare_mitigation_values AS ENUM ('none', 'outgoing', 'incoming');
CREATE TYPE pjsip_dtls_setup_values AS ENUM ('active', 'passive', 'actpass');
CREATE TYPE pjsip_dtmf_mode_values AS ENUM ('rfc4733', 'inband', 'info');
CREATE TYPE pjsip_dtmf_mode_values_v2 AS ENUM ('rfc4733', 'inband', 'info', 'auto');
CREATE TYPE pjsip_dtmf_mode_values_v3 AS ENUM ('rfc4733', 'inband', 'info', 'auto', 'auto_info');
CREATE TYPE pjsip_identify_by_values AS ENUM ('username');
CREATE TYPE pjsip_identify_by_values AS ENUM ('username', 'auth_username');
CREATE TYPE pjsip_identify_by_values AS ENUM ('username', 'auth_username', 'ip');
CREATE TYPE pjsip_media_encryption_values AS ENUM ('no', 'sdes', 'dtls');
CREATE TYPE pjsip_redirect_method_values AS ENUM ('user', 'uri_core', 'uri_pjsip');
CREATE TYPE pjsip_t38udptl_ec_values AS ENUM ('none', 'fec', 'redundancy');
CREATE TYPE pjsip_taskprocessor_overload_trigger_values AS ENUM ('none', 'global', 'pjsip_only');
CREATE TYPE pjsip_timer_values AS ENUM ('forced', 'no', 'required', 'yes');
CREATE TYPE pjsip_transport_method_values AS ENUM ('default', 'unspecified', 'tlsv1', 'sslv2', 'sslv3', 'sslv23');
CREATE TYPE pjsip_transport_protocol_values AS ENUM ('udp', 'tcp', 'tls', 'ws', 'wss');
CREATE TYPE pjsip_transport_protocol_values_v2 AS ENUM ('udp', 'tcp', 'tls', 'ws', 'wss', 'flow');
CREATE TYPE queue_autopause_values AS ENUM ('yes', 'no', 'all');
CREATE TYPE queue_strategy_values AS ENUM ('ringall', 'leastrecent', 'fewestcalls', 'random', 'rrmemory', 'linear', 'wrandom', 'rrordered');
CREATE TYPE sha_hash_values AS ENUM ('SHA-1', 'SHA-256');
CREATE TYPE sip_callingpres_values AS ENUM ('allowed_not_screened', 'allowed_passed_screen', 'allowed_failed_screen', 'allowed', 'prohib_not_screened', 'prohib_passed_screen', 'prohib_failed_screen', 'prohib');
CREATE TYPE sip_directmedia_values AS ENUM ('yes', 'no', 'nonat', 'update');
CREATE TYPE sip_directmedia_values_v2 AS ENUM ('yes', 'no', 'nonat', 'update', 'outgoing');
CREATE TYPE sip_dtmfmode_values AS ENUM ('rfc2833', 'info', 'shortinfo', 'inband', 'auto');
CREATE TYPE sip_progressinband_values AS ENUM ('yes', 'no', 'never');
CREATE TYPE sip_session_refresher_values AS ENUM ('uac', 'uas');
CREATE TYPE sip_session_timers_values AS ENUM ('accept', 'refuse', 'originate');
CREATE TYPE sip_transport_values AS ENUM ('udp', 'tcp', 'tls', 'ws', 'wss', 'udp,tcp', 'tcp,udp');
CREATE TYPE type_values AS ENUM ('friend', 'user', 'peer');
CREATE TYPE yes_no_values AS ENUM ('yes', 'no');
CREATE TYPE yesno_values AS ENUM ('yes', 'no');
`
s = strings.TrimSpace(s)
lines := strings.Split(s, "\n")
reg := regexp.MustCompile(`CREATE TYPE (\S+) AS ENUM\s\(([^)]+)`)
enumDedup := map[string]*EnumModel{}
for _, v := range lines {
m := reg.FindStringSubmatch(v)
if len(m) < 1 {
fmt.Println("Failed Match", v)
continue
}
d := &EnumModel{
Name: m[1],
}
for _, v := range strings.Split(strings.ReplaceAll(m[2], "'", ""), ",") {
d.Values = append(d.Values, strings.TrimSpace(v))
}
d.Name = strings.TrimSuffix(d.Name, "_values")
d.Name = strings.TrimSuffix(d.Name, "_values_v2")
d.Name = strings.TrimSuffix(d.Name, "_values_v3")
switch d.Name {
case "yesno":
d.Name = "yes_no"
case "type":
d.Name = "sip_peer_type"
}
enumDedup[strings.ReplaceAll(d.Name, "_", "")] = d
}
var enums []*EnumModel
for _, def := range enumDedup {
def.Values = dedup(def.Values)
enums = append(enums, def)
}
sort.Slice(enums, func(i, j int) bool {
return enums[i].Name < enums[j].Name
})
for _, d := range enums {
fmt.Println("Enum", d.Name, d.Values)
}
strcase.ConfigureAcronym("TCP", "tcp")
strcase.ConfigureAcronym("UDP", "udp")
strcase.ConfigureAcronym("WS", "ws")
strcase.ConfigureAcronym("WSS", "wss")
strcase.ConfigureAcronym("TLS", "tls")
strcase.ConfigureAcronym("SSL", "ttl")
tpl := template.Must(template.New("enum").Parse(`
{{define "enums"}}
// Code generated by enums_test.go, DO NOT EDIT.
package adb
{{- range $_,$e := .Enums}}
{{template "enum/type" $e}}
{{- end}}
{{- range $_,$e := .Enums}}
{{template "enum/func" $e}}
{{- end}}
{{end}}
{{define "enum/type"}}
type {{.TypeName}} string
{{$e := .}}
const (
{{- range $_,$v := $.Values}}
{{$.ValueName $v}} {{$e.TypeName}} = "{{$v}}"
{{- end}}
)
{{end}}
{{define "enum/func"}}
func (e {{.TypeName}}) String() string {
return string(e)
}
func ({{.TypeName}}) Values() []string {
return []string{
{{- range $_,$v := $.Values}}
"{{$v}}",
{{- end}}
}
}
{{end}}
`))
buffer := bytes.NewBuffer(nil)
if assert.NoError(t, tpl.ExecuteTemplate(buffer, "enums", &EnumGenModel{
Enums: enums,
})) {
f := &xmlgen.File{Name: "inmem", Content: buffer.Bytes()}
if !assert.NoError(t, xmlgen.GoFormatter(f)) {
xmlgen.ReportFile(f)
} else {
assert.NoError(t, os.WriteFile("enums.go", f.Content, 0644))
}
}
}
type EnumModel struct {
Name string
Values []string
}
func (e EnumModel) TypeName() string {
return strcase.ToCamel(e.Name)
}
func (e EnumModel) ValueName(s string) string {
return e.TypeName() + strcase.ToCamel(s)
}
type EnumGenModel struct {
Enums []*EnumModel
}
func dedup(s []string) []string {
m := map[string]bool{}
for _, v := range s {
m[v] = true
}
var o []string
for k := range m {
o = append(o, k)
}
sort.Strings(o)
return o
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/astdb/enums.go 0000664 0000000 0000000 00000033611 14650613361 0024237 0 ustar 00root root 0000000 0000000 // Code generated by enums_test.go, DO NOT EDIT.
package astdb
type AstBool string
const (
AstBool0 AstBool = "0"
AstBool1 AstBool = "1"
AstBoolFalse AstBool = "false"
AstBoolNo AstBool = "no"
AstBoolOff AstBool = "off"
AstBoolOn AstBool = "on"
AstBoolTrue AstBool = "true"
AstBoolYes AstBool = "yes"
)
type IaxEncryption string
const (
IaxEncryptionAes128 IaxEncryption = "aes128"
IaxEncryptionNo IaxEncryption = "no"
IaxEncryptionYes IaxEncryption = "yes"
)
type IaxRequirecalltoken string
const (
IaxRequirecalltokenAuto IaxRequirecalltoken = "auto"
IaxRequirecalltokenNo IaxRequirecalltoken = "no"
IaxRequirecalltokenYes IaxRequirecalltoken = "yes"
)
type IaxTransfer string
const (
IaxTransferMediaonly IaxTransfer = "mediaonly"
IaxTransferNo IaxTransfer = "no"
IaxTransferYes IaxTransfer = "yes"
)
type MohMode string
const (
MohModeCustom MohMode = "custom"
MohModeFiles MohMode = "files"
MohModeMp3Nb MohMode = "mp3nb"
MohModePlaylist MohMode = "playlist"
MohModeQuietmp3 MohMode = "quietmp3"
MohModeQuietmp3Nb MohMode = "quietmp3nb"
)
type Pjsip100Rel string
const (
Pjsip100RelNo Pjsip100Rel = "no"
Pjsip100RelRequired Pjsip100Rel = "required"
Pjsip100RelYes Pjsip100Rel = "yes"
)
type PjsipAuthType string
const (
PjsipAuthTypeGoogleOauth PjsipAuthType = "google_oauth"
PjsipAuthTypeMd5 PjsipAuthType = "md5"
PjsipAuthTypeUserpass PjsipAuthType = "userpass"
)
type PjsipCidPrivacy string
const (
PjsipCidPrivacyAllowed PjsipCidPrivacy = "allowed"
PjsipCidPrivacyAllowedFailedScreened PjsipCidPrivacy = "allowed_failed_screened"
PjsipCidPrivacyAllowedNotScreened PjsipCidPrivacy = "allowed_not_screened"
PjsipCidPrivacyAllowedPassedScreened PjsipCidPrivacy = "allowed_passed_screened"
PjsipCidPrivacyProhib PjsipCidPrivacy = "prohib"
PjsipCidPrivacyProhibFailedScreened PjsipCidPrivacy = "prohib_failed_screened"
PjsipCidPrivacyProhibNotScreened PjsipCidPrivacy = "prohib_not_screened"
PjsipCidPrivacyProhibPassedScreened PjsipCidPrivacy = "prohib_passed_screened"
PjsipCidPrivacyUnavailable PjsipCidPrivacy = "unavailable"
)
type PjsipConnectedLineMethod string
const (
PjsipConnectedLineMethodInvite PjsipConnectedLineMethod = "invite"
PjsipConnectedLineMethodReinvite PjsipConnectedLineMethod = "reinvite"
PjsipConnectedLineMethodUpdate PjsipConnectedLineMethod = "update"
)
type PjsipDirectMediaGlareMitigation string
const (
PjsipDirectMediaGlareMitigationIncoming PjsipDirectMediaGlareMitigation = "incoming"
PjsipDirectMediaGlareMitigationNone PjsipDirectMediaGlareMitigation = "none"
PjsipDirectMediaGlareMitigationOutgoing PjsipDirectMediaGlareMitigation = "outgoing"
)
type PjsipDtlsSetup string
const (
PjsipDtlsSetupActive PjsipDtlsSetup = "active"
PjsipDtlsSetupActpass PjsipDtlsSetup = "actpass"
PjsipDtlsSetupPassive PjsipDtlsSetup = "passive"
)
type PjsipDtmfMode string
const (
PjsipDtmfModeAuto PjsipDtmfMode = "auto"
PjsipDtmfModeAutoInfo PjsipDtmfMode = "auto_info"
PjsipDtmfModeInband PjsipDtmfMode = "inband"
PjsipDtmfModeInfo PjsipDtmfMode = "info"
PjsipDtmfModeRfc4733 PjsipDtmfMode = "rfc4733"
)
type PjsipIdentifyBy string
const (
PjsipIdentifyByAuthUsername PjsipIdentifyBy = "auth_username"
PjsipIdentifyByIp PjsipIdentifyBy = "ip"
PjsipIdentifyByUsername PjsipIdentifyBy = "username"
)
type PjsipMediaEncryption string
const (
PjsipMediaEncryptionDtls PjsipMediaEncryption = "dtls"
PjsipMediaEncryptionNo PjsipMediaEncryption = "no"
PjsipMediaEncryptionSdes PjsipMediaEncryption = "sdes"
)
type PjsipRedirectMethod string
const (
PjsipRedirectMethodUriCore PjsipRedirectMethod = "uri_core"
PjsipRedirectMethodUriPjsip PjsipRedirectMethod = "uri_pjsip"
PjsipRedirectMethodUser PjsipRedirectMethod = "user"
)
type PjsipT38UdptlEc string
const (
PjsipT38UdptlEcFec PjsipT38UdptlEc = "fec"
PjsipT38UdptlEcNone PjsipT38UdptlEc = "none"
PjsipT38UdptlEcRedundancy PjsipT38UdptlEc = "redundancy"
)
type PjsipTaskprocessorOverloadTrigger string
const (
PjsipTaskprocessorOverloadTriggerGlobal PjsipTaskprocessorOverloadTrigger = "global"
PjsipTaskprocessorOverloadTriggerNone PjsipTaskprocessorOverloadTrigger = "none"
PjsipTaskprocessorOverloadTriggerPjsipOnly PjsipTaskprocessorOverloadTrigger = "pjsip_only"
)
type PjsipTimer string
const (
PjsipTimerForced PjsipTimer = "forced"
PjsipTimerNo PjsipTimer = "no"
PjsipTimerRequired PjsipTimer = "required"
PjsipTimerYes PjsipTimer = "yes"
)
type PjsipTransportMethod string
const (
PjsipTransportMethodDefault PjsipTransportMethod = "default"
PjsipTransportMethodSslv2 PjsipTransportMethod = "sslv2"
PjsipTransportMethodSslv23 PjsipTransportMethod = "sslv23"
PjsipTransportMethodSslv3 PjsipTransportMethod = "sslv3"
PjsipTransportMethodTlsv1 PjsipTransportMethod = "tlsv1"
PjsipTransportMethodUnspecified PjsipTransportMethod = "unspecified"
)
type PjsipTransportProtocol string
const (
PjsipTransportProtocolFlow PjsipTransportProtocol = "flow"
PjsipTransportProtocolTcp PjsipTransportProtocol = "tcp"
PjsipTransportProtocolTls PjsipTransportProtocol = "tls"
PjsipTransportProtocolUdp PjsipTransportProtocol = "udp"
PjsipTransportProtocolWs PjsipTransportProtocol = "ws"
PjsipTransportProtocolWss PjsipTransportProtocol = "wss"
)
type QueueAutopause string
const (
QueueAutopauseAll QueueAutopause = "all"
QueueAutopauseNo QueueAutopause = "no"
QueueAutopauseYes QueueAutopause = "yes"
)
type QueueStrategy string
const (
QueueStrategyFewestcalls QueueStrategy = "fewestcalls"
QueueStrategyLeastrecent QueueStrategy = "leastrecent"
QueueStrategyLinear QueueStrategy = "linear"
QueueStrategyRandom QueueStrategy = "random"
QueueStrategyRingall QueueStrategy = "ringall"
QueueStrategyRrmemory QueueStrategy = "rrmemory"
QueueStrategyRrordered QueueStrategy = "rrordered"
QueueStrategyWrandom QueueStrategy = "wrandom"
)
type ShaHash string
const (
ShaHashSHA1 ShaHash = "SHA-1"
ShaHashSHA256 ShaHash = "SHA-256"
)
type SipCallingpres string
const (
SipCallingpresAllowed SipCallingpres = "allowed"
SipCallingpresAllowedFailedScreen SipCallingpres = "allowed_failed_screen"
SipCallingpresAllowedNotScreened SipCallingpres = "allowed_not_screened"
SipCallingpresAllowedPassedScreen SipCallingpres = "allowed_passed_screen"
SipCallingpresProhib SipCallingpres = "prohib"
SipCallingpresProhibFailedScreen SipCallingpres = "prohib_failed_screen"
SipCallingpresProhibNotScreened SipCallingpres = "prohib_not_screened"
SipCallingpresProhibPassedScreen SipCallingpres = "prohib_passed_screen"
)
type SipDirectmedia string
const (
SipDirectmediaNo SipDirectmedia = "no"
SipDirectmediaNonat SipDirectmedia = "nonat"
SipDirectmediaOutgoing SipDirectmedia = "outgoing"
SipDirectmediaUpdate SipDirectmedia = "update"
SipDirectmediaYes SipDirectmedia = "yes"
)
type SipDtmfmode string
const (
SipDtmfmodeAuto SipDtmfmode = "auto"
SipDtmfmodeInband SipDtmfmode = "inband"
SipDtmfmodeInfo SipDtmfmode = "info"
SipDtmfmodeRfc2833 SipDtmfmode = "rfc2833"
SipDtmfmodeShortinfo SipDtmfmode = "shortinfo"
)
type SipPeerType string
const (
SipPeerTypeFriend SipPeerType = "friend"
SipPeerTypePeer SipPeerType = "peer"
SipPeerTypeUser SipPeerType = "user"
)
type SipProgressinband string
const (
SipProgressinbandNever SipProgressinband = "never"
SipProgressinbandNo SipProgressinband = "no"
SipProgressinbandYes SipProgressinband = "yes"
)
type SipSessionRefresher string
const (
SipSessionRefresherUac SipSessionRefresher = "uac"
SipSessionRefresherUas SipSessionRefresher = "uas"
)
type SipSessionTimers string
const (
SipSessionTimersAccept SipSessionTimers = "accept"
SipSessionTimersOriginate SipSessionTimers = "originate"
SipSessionTimersRefuse SipSessionTimers = "refuse"
)
type SipTransport string
const (
SipTransportTcp SipTransport = "tcp"
SipTransportTls SipTransport = "tls"
SipTransportUdp SipTransport = "udp"
SipTransportWs SipTransport = "ws"
SipTransportWss SipTransport = "wss"
)
type YesNo string
const (
YesNoNo YesNo = "no"
YesNoYes YesNo = "yes"
)
func (e AstBool) String() string {
return string(e)
}
func (AstBool) Values() []string {
return []string{
"0",
"1",
"false",
"no",
"off",
"on",
"true",
"yes",
}
}
func (e IaxEncryption) String() string {
return string(e)
}
func (IaxEncryption) Values() []string {
return []string{
"aes128",
"no",
"yes",
}
}
func (e IaxRequirecalltoken) String() string {
return string(e)
}
func (IaxRequirecalltoken) Values() []string {
return []string{
"auto",
"no",
"yes",
}
}
func (e IaxTransfer) String() string {
return string(e)
}
func (IaxTransfer) Values() []string {
return []string{
"mediaonly",
"no",
"yes",
}
}
func (e MohMode) String() string {
return string(e)
}
func (MohMode) Values() []string {
return []string{
"custom",
"files",
"mp3nb",
"playlist",
"quietmp3",
"quietmp3nb",
}
}
func (e Pjsip100Rel) String() string {
return string(e)
}
func (Pjsip100Rel) Values() []string {
return []string{
"no",
"required",
"yes",
}
}
func (e PjsipAuthType) String() string {
return string(e)
}
func (PjsipAuthType) Values() []string {
return []string{
"google_oauth",
"md5",
"userpass",
}
}
func (e PjsipCidPrivacy) String() string {
return string(e)
}
func (PjsipCidPrivacy) Values() []string {
return []string{
"allowed",
"allowed_failed_screened",
"allowed_not_screened",
"allowed_passed_screened",
"prohib",
"prohib_failed_screened",
"prohib_not_screened",
"prohib_passed_screened",
"unavailable",
}
}
func (e PjsipConnectedLineMethod) String() string {
return string(e)
}
func (PjsipConnectedLineMethod) Values() []string {
return []string{
"invite",
"reinvite",
"update",
}
}
func (e PjsipDirectMediaGlareMitigation) String() string {
return string(e)
}
func (PjsipDirectMediaGlareMitigation) Values() []string {
return []string{
"incoming",
"none",
"outgoing",
}
}
func (e PjsipDtlsSetup) String() string {
return string(e)
}
func (PjsipDtlsSetup) Values() []string {
return []string{
"active",
"actpass",
"passive",
}
}
func (e PjsipDtmfMode) String() string {
return string(e)
}
func (PjsipDtmfMode) Values() []string {
return []string{
"auto",
"auto_info",
"inband",
"info",
"rfc4733",
}
}
func (e PjsipIdentifyBy) String() string {
return string(e)
}
func (PjsipIdentifyBy) Values() []string {
return []string{
"auth_username",
"ip",
"username",
}
}
func (e PjsipMediaEncryption) String() string {
return string(e)
}
func (PjsipMediaEncryption) Values() []string {
return []string{
"dtls",
"no",
"sdes",
}
}
func (e PjsipRedirectMethod) String() string {
return string(e)
}
func (PjsipRedirectMethod) Values() []string {
return []string{
"uri_core",
"uri_pjsip",
"user",
}
}
func (e PjsipT38UdptlEc) String() string {
return string(e)
}
func (PjsipT38UdptlEc) Values() []string {
return []string{
"fec",
"none",
"redundancy",
}
}
func (e PjsipTaskprocessorOverloadTrigger) String() string {
return string(e)
}
func (PjsipTaskprocessorOverloadTrigger) Values() []string {
return []string{
"global",
"none",
"pjsip_only",
}
}
func (e PjsipTimer) String() string {
return string(e)
}
func (PjsipTimer) Values() []string {
return []string{
"forced",
"no",
"required",
"yes",
}
}
func (e PjsipTransportMethod) String() string {
return string(e)
}
func (PjsipTransportMethod) Values() []string {
return []string{
"default",
"sslv2",
"sslv23",
"sslv3",
"tlsv1",
"unspecified",
}
}
func (e PjsipTransportProtocol) String() string {
return string(e)
}
func (PjsipTransportProtocol) Values() []string {
return []string{
"flow",
"tcp",
"tls",
"udp",
"ws",
"wss",
}
}
func (e QueueAutopause) String() string {
return string(e)
}
func (QueueAutopause) Values() []string {
return []string{
"all",
"no",
"yes",
}
}
func (e QueueStrategy) String() string {
return string(e)
}
func (QueueStrategy) Values() []string {
return []string{
"fewestcalls",
"leastrecent",
"linear",
"random",
"ringall",
"rrmemory",
"rrordered",
"wrandom",
}
}
func (e ShaHash) String() string {
return string(e)
}
func (ShaHash) Values() []string {
return []string{
"SHA-1",
"SHA-256",
}
}
func (e SipCallingpres) String() string {
return string(e)
}
func (SipCallingpres) Values() []string {
return []string{
"allowed",
"allowed_failed_screen",
"allowed_not_screened",
"allowed_passed_screen",
"prohib",
"prohib_failed_screen",
"prohib_not_screened",
"prohib_passed_screen",
}
}
func (e SipDirectmedia) String() string {
return string(e)
}
func (SipDirectmedia) Values() []string {
return []string{
"no",
"nonat",
"outgoing",
"update",
"yes",
}
}
func (e SipDtmfmode) String() string {
return string(e)
}
func (SipDtmfmode) Values() []string {
return []string{
"auto",
"inband",
"info",
"rfc2833",
"shortinfo",
}
}
func (e SipPeerType) String() string {
return string(e)
}
func (SipPeerType) Values() []string {
return []string{
"friend",
"peer",
"user",
}
}
func (e SipProgressinband) String() string {
return string(e)
}
func (SipProgressinband) Values() []string {
return []string{
"never",
"no",
"yes",
}
}
func (e SipSessionRefresher) String() string {
return string(e)
}
func (SipSessionRefresher) Values() []string {
return []string{
"uac",
"uas",
}
}
func (e SipSessionTimers) String() string {
return string(e)
}
func (SipSessionTimers) Values() []string {
return []string{
"accept",
"originate",
"refuse",
}
}
func (e SipTransport) String() string {
return string(e)
}
func (SipTransport) Values() []string {
return []string{
"tcp",
"tls",
"udp",
"ws",
"wss",
}
}
func (e YesNo) String() string {
return string(e)
}
func (YesNo) Values() []string {
return []string{
"no",
"yes",
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/astdb/model.go 0000664 0000000 0000000 00000002421 14650613361 0024203 0 ustar 00root root 0000000 0000000 package astdb
import "time"
// https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CEL+Specification
type CallEventLog struct {
ID int64 `gorm:"primary_key"`
EventType string `gorm:"column:eventtype"`
EventTime *time.Time `gorm:"column:eventtime"`
UserDefType string `gorm:"column:userdeftype"`
CidName string
CidNum string
CidAni string
CidRdnis string
CidDnid string
Exten string
Context string
ChanName string `gorm:"column:channame"`
AppName string `gorm:"column:appname"`
AppData string `gorm:"column:appdata"`
AmaFlags int `gorm:"column:amaflags"`
AccountCode string `gorm:"column:accountcode"`
PeerAccount string `gorm:"column:peeraccount"`
UniqueId string `gorm:"column:uniqueid"`
LinkedId string `gorm:"column:linkedid"`
UserField string `gorm:"column:userfield"`
Peer string `gorm:"column:peer"`
}
func (CallEventLog) TableName() string {
return "cel"
}
// https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CDR+Specification
type CallDetailRecord struct {
}
func (CallDetailRecord) TableName() string {
return "cdr"
}
type Extension struct {
ID int `gorm:"primary_key"`
Context string
Exten string
Priority int
App string
AppData string
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/astdb/ps_model.go 0000664 0000000 0000000 00000002225 14650613361 0024707 0 ustar 00root root 0000000 0000000 package astdb
import "database/sql"
type PsAor struct {
ID string `gorm:"primary_key"`
Contact sql.NullString
// 3600
DefaultExpiration int
MinimumExpiration int
MaximumExpiration int
Mailboxes sql.NullString
MaxContacts int
QualifyFrequency int
QualifyTimeout float64
AuthenticateQualify YesNo
OutboundProxy sql.NullString
SupportPath YesNo
VoicemailExtension sql.NullString
}
type PsContact struct {
ID string `gorm:"primary_key"`
URI string
ExpirationTime string
QualifyFrequency int
}
type PsDomainAlias struct {
ID string `gorm:"primary_key"`
Domain string
}
type PsEndpointIdIp struct {
ID string `gorm:"primary_key"`
Endpoint string
Match string
}
type PsAuth struct {
ID string `gorm:"primary_key"`
// userpass
AuthType string
NonceLifetime sql.NullString
Md5Cred sql.NullString
Username string
Password string
Realm sql.NullString
}
type PsGlobal struct {
ID string `gorm:"primary_key"`
MaxForwards *int
UserAgent *string
DefaultOutboundEndpoint *string
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/codecov.yml 0000664 0000000 0000000 00000000142 14650613361 0023622 0 ustar 00root root 0000000 0000000 ignore:
- pkg/tools
- astdb # not ready yet
# generated
- ami/amimodels
- agi/agimodels
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/go.mod 0000664 0000000 0000000 00000001654 14650613361 0022574 0 ustar 00root root 0000000 0000000 module github.com/wenerme/astgo
go 1.16
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/go-pg/pg v8.0.7+incompatible
github.com/google/uuid v1.2.0 // indirect
github.com/hashicorp/go-multierror v1.1.1
github.com/huandu/xstrings v1.3.2
github.com/iancoleman/strcase v0.1.3
github.com/imdario/mergo v0.3.12 // indirect
github.com/jinzhu/gorm v1.9.16
github.com/mitchellh/copystructure v1.1.2 // indirect
github.com/mitchellh/mapstructure v1.4.1
github.com/onsi/ginkgo v1.15.2 // indirect
github.com/onsi/gomega v1.11.0 // indirect
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
go.uber.org/zap v1.16.0
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e
mellium.im/sasl v0.2.1 // indirect
)
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/go.sum 0000664 0000000 0000000 00000042217 14650613361 0022621 0 ustar 00root root 0000000 0000000 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-pg/pg v8.0.7+incompatible h1:ty/sXL1OZLo+47KK9N8llRcmbA9tZasqbQ/OO4ld53g=
github.com/go-pg/pg v8.0.7+incompatible/go.mod h1:a2oXow+aFOrvwcKs3eIA0lNFmMilrxK2sOkB5NWe0vA=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.1.3 h1:dJBk1m2/qjL1twPLf68JND55vvivMupZ4wIzE8CTdBw=
github.com/iancoleman/strcase v0.1.3/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mitchellh/copystructure v1.1.2 h1:Th2TIvG1+6ma3e/0/bopBKohOTY7s4dA8V2q4EUcBJ0=
github.com/mitchellh/copystructure v1.1.2/go.mod h1:EBArHfARyrSWO/+Wyr9zwEkc6XMFB9XyNgFNmRkZZU4=
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE=
github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.15.2 h1:l77YT15o814C2qVL47NOyjV/6RbaP7kKdrvZnxQ3Org=
github.com/onsi/ginkgo v1.15.2/go.mod h1:Dd6YFfwBW84ETqqtL0CPyPXillHgY6XhQH3uuCCTr/o=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.11.0 h1:+CqWgvj0OZycCaqclBD1pxKHAU+tOkHmQIWvDHq2aug=
github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM=
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e h1:4nW4NLDYnU28ojHaHO8OVxFHk/aQ33U01a9cjED+pzE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
mellium.im/sasl v0.2.1 h1:nspKSRg7/SyO0cRGY71OkfHab8tf9kCts6a6oTDut0w=
mellium.im/sasl v0.2.1/go.mod h1:ROaEDLQNuf9vjKqE1SrAfnsobm2YKXT1gnN1uDp1PjQ=
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/ 0000775 0000000 0000000 00000000000 14650613361 0022241 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/ 0000775 0000000 0000000 00000000000 14650613361 0023401 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/ 0000775 0000000 0000000 00000000000 14650613361 0024673 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/_ami_parse_test.go 0000664 0000000 0000000 00000001033 14650613361 0030355 0 ustar 00root root 0000000 0000000 package xmlgen
import (
"context"
"encoding/xml"
"log"
"os"
"testing"
)
func TestParse(t *testing.T) {
f, _ := os.Open("out.xml")
defer f.Close()
dec := xml.NewDecoder(f)
var doc Docs
if err := dec.Decode(&doc); err != nil {
log.Fatal(err)
}
ge := NewAMIGenerator()
ge.Debug = true
d := &AstDoc{}
BuildAstDoc(&doc, d)
err := ge.Generate(context.Background(), d)
if err != nil {
panic(err)
}
err = ge.Write(WriteConfig{
Target: "./../../../ami/models",
//DryRun: true,
})
if err != nil {
panic(err)
}
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/_doc_test.go 0000664 0000000 0000000 00000002411 14650613361 0027163 0 ustar 00root root 0000000 0000000 package xmlgen
import (
"context"
"encoding/json"
"encoding/xml"
"os"
"testing"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
func TestDocParse(t *testing.T) {
f, _ := os.Open("out.xml")
defer f.Close()
dec := xml.NewDecoder(f)
var doc DocModel
if err := dec.Decode(&doc); err != nil {
log.Fatal(err)
}
//for _, v := range doc.Agi {
// if v.Name == "control stream file" {
// indent, err := json.MarshalIndent(v, "", " ")
// if err != nil {
// log.Fatal(err)
// }
// fmt.Println(string(indent))
// return
// }
//}
ge := NewAGIGenerator()
ge.Debug = true
d := &Model{}
BuildModel(&doc, d)
{
b, err := json.MarshalIndent(doc, "", " ")
assert.NoError(t, err)
err = os.WriteFile("doc.json", b, 0644)
assert.NoError(t, err)
}
{
b, err := json.MarshalIndent(d, "", " ")
assert.NoError(t, err)
err = os.WriteFile("gen.json", b, 0644)
assert.NoError(t, err)
}
err := ge.Generate(context.Background(), d)
if err != nil {
panic(err)
}
err = ge.Write(WriteConfig{
Target: "./../../../",
//DryRun: true,
})
if err != nil {
panic(err)
}
log.Println("AGI Commands", len(d.AGICommands))
}
//func TestName(t *testing.T) {
// println(fieldName("Variablename"))
// println(fieldName("Keytree"))
//}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/build.go 0000664 0000000 0000000 00000006264 14650613361 0026331 0 ustar 00root root 0000000 0000000 package xmlgen
import (
"fmt"
"log"
"regexp"
"strings"
)
func BuildAstDoc(doc *Docs, d *AstDoc) {
byName := map[string]*Type{}
byFieldName := map[string]map[string]*Field{}
for _, e := range doc.Manager {
typ, dup := byName[e.Name]
if !dup {
log.Println("duplicate action", e.Name)
typ = &Type{
Name: e.Name,
Doc: strings.TrimSpace(e.Synopsis),
}
}
if byFieldName[typ.Name] == nil {
byFieldName[typ.Name] = map[string]*Field{}
}
for _, p := range e.Syntax.Parameter {
name := p.Name
fieldName := goName(name)
field, dup := byFieldName[typ.Name][fieldName]
if dup {
log.Println("duplicate field", typ.Name, fieldName)
continue
}
field = &Field{
Name: fieldName,
Required: p.Required != "",
Default: p.Default,
Type: &TypeInfo{Type: "string"},
}
var s []string
for _, v := range p.Para {
text := strings.TrimSpace(v.Text)
if text != "" {
s = append(s, text)
} else {
log.Println(v)
}
}
field.Doc = strings.Join(s, "\n")
if field.Name != name {
field.StructTag = fmt.Sprintf(`json:"%s,omitempty"`, name)
}
byFieldName[typ.Name][fieldName] = field
typ.Fields = append(typ.Fields, field)
}
if !dup {
byName[typ.Name] = typ
d.Actions = append(d.Actions, typ)
}
}
{
byName := map[string]*Type{}
byFieldName := map[string]map[string]*Field{}
for _, e := range doc.ManagerEvent {
typeName := e.Name
typ, dup := byName[typeName]
e := e.ManagerEventInstance
if !dup {
log.Println("duplicate action", typeName)
typ = &Type{
Name: goName(typeName),
Doc: strings.TrimSpace(e.Synopsis),
}
}
if byFieldName[typ.Name] == nil {
byFieldName[typ.Name] = map[string]*Field{}
}
for _, p := range e.Syntax.Parameter {
name := p.Name
fieldName := goName(name)
_, dup := byFieldName[typ.Name][fieldName]
if dup {
log.Println("duplicate field", typ.Name, fieldName)
continue
}
field := &Field{
Name: fieldName,
Required: p.Required != "",
// Default: p.Default,
Type: &TypeInfo{Type: "string"},
}
var s []string
for _, v := range p.Para {
text := strings.TrimSpace(v.Text)
if text != "" {
s = append(s, text)
} else {
log.Println(v)
}
}
field.Doc = strings.Join(s, "\n")
if field.Name != name {
field.StructTag = fmt.Sprintf(`json:"%s,omitempty"`, name)
}
byFieldName[typ.Name][fieldName] = field
typ.Fields = append(typ.Fields, field)
}
if !dup {
byName[typ.Name] = typ
d.Events = append(d.Events, typ)
}
}
}
for _, v := range d.Actions {
_, ok := byFieldName[v.Name]["ActionID"]
if !ok {
v.Fields = append(v.Fields, &Field{
Name: "ActionID",
Doc: "ActionID for tx - compensate",
Type: &TypeInfo{
Type: "string",
},
})
}
}
}
var invalid = regexp.MustCompile(`[- ]|\(.*?\)`)
var valid = regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9]*$")
func goName(s string) string {
s = invalid.ReplaceAllLiteralString(s, "")
if s[0] >= '0' && s[0] <= '9' {
s = "Field" + s
}
// UnitAmount(0)
if !valid.MatchString(s) {
panic("invalid id: " + s)
}
return s
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/doc_model.go 0000664 0000000 0000000 00000022640 14650613361 0027153 0 ustar 00root root 0000000 0000000 package xmlgen
//go:generate gomodifytags -file=doc_model.go -w -all -add-tags json -transform camelcase --skip-unexported -add-options json=omitempty
import (
"encoding/xml"
"fmt"
"log"
"regexp"
"strings"
"github.com/iancoleman/strcase"
)
type AgiDocModel struct {
Name string `xml:"name,attr" json:"name,omitempty"`
Language string `xml:"language,attr" json:"language,omitempty"`
Synopsis string `xml:"synopsis" json:"synopsis,omitempty"`
Syntax *SyntaxDocModel `xml:"syntax" json:"syntax,omitempty"`
SeeAlso *SeeAlsoModel `xml:"see-also" json:"seeAlso,omitempty"`
Description *DescriptionModel `xml:"description" json:"description,omitempty"`
}
type ManagerResponseListElementModel struct {
Text string `xml:",chardata" json:"text,omitempty"`
ManagerEvent []*ManagerEventModel `xml:"managerEvent" json:"managerEvent,omitempty"`
}
type ManagerResponseModel struct {
Text string `xml:",chardata" json:"text,omitempty"`
ListElements *ManagerResponseListElementModel `xml:"list-elements" json:"listElements,omitempty"`
ManagerEvent *ManagerEventModel `xml:"managerEvent" json:"managerEvent,omitempty"`
}
func (m ManagerResponseModel) Events() []*ManagerEventModel {
var o []*ManagerEventModel
if m.ManagerEvent != nil {
o = append(o, m.ManagerEvent)
}
if m.ListElements != nil {
o = append(o, m.ListElements.ManagerEvent...)
}
return o
}
type ManagerActionModel struct {
Name string `xml:"name,attr" json:"name,omitempty"`
Language string `xml:"language,attr" json:"language,omitempty"`
Synopsis string `xml:"synopsis" json:"synopsis,omitempty"`
Syntax *SyntaxDocModel `xml:"syntax" json:"syntax,omitempty"`
SeeAlso *SeeAlsoModel `xml:"see-also" json:"seeAlso,omitempty"`
Description *DescriptionModel `xml:"description" json:"description,omitempty"`
Responses ManagerResponseModel `xml:"responses" json:"responses,omitempty"`
}
type ManagerEventInstanceModel struct {
Text string `xml:",chardata"`
Class string `xml:"class,attr"`
Synopsis string `xml:"synopsis"`
Language string `xml:"language,attr" json:"language,omitempty"`
Syntax *SyntaxDocModel `xml:"syntax" json:"syntax,omitempty"`
SeeAlso *SeeAlsoModel `xml:"see-also" json:"seeAlso,omitempty"`
Description *DescriptionModel `xml:"description" json:"description,omitempty"`
}
type ManagerEventModel struct {
Name string `xml:"name,attr" json:"name,omitempty"`
Instance ManagerEventInstanceModel `xml:"managerEventInstance"`
}
type SyntaxDocModel struct {
Parameter []SyntaxParameterDocModel `xml:"parameter" json:"parameter,omitempty"`
ChannelSnapshot []struct {
Text string `xml:",chardata"`
Prefix string `xml:"prefix,attr"`
} `xml:"channel_snapshot"`
BridgeSnapshot []struct {
Text string `xml:",chardata"`
Prefix string `xml:"prefix,attr"`
} `xml:"bridge_snapshot"`
}
type SyntaxParameterDocModel struct {
Name string `xml:"name,attr" json:"name,omitempty"`
Required bool `xml:"required,attr" json:"required,omitempty"`
Para ParaRaw `xml:"para" json:"para,omitempty"`
EnumList *EnumListModel `xml:"enumlist" json:"enumList,omitempty"`
Note *struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Filename string `xml:"filename"`
Replaceable string `xml:"replaceable"`
} `xml:"para"`
} `xml:"note"`
}
type DocModel struct {
XMLName xml.Name `xml:"docs" json:"xmlName,omitempty"`
Agi []*AgiDocModel `xml:"agi" json:"agi,omitempty"`
Manager []*ManagerActionModel `xml:"manager" json:"manager,omitempty"`
ManagerEvent []*ManagerEventModel `xml:"managerEvent" json:"managerEvent,omitempty"`
}
// ParaRaw contain ELEMENT astcli|literal|emphasis|filename|directory|replaceable|variable
type ParaRaw struct {
Data string `xml:",innerxml" json:"data,omitempty"`
}
type DescriptionModel struct {
//Text string `xml:",chardata"`
Para []ParaRaw `xml:"para" json:"para,omitempty"`
EnumList *EnumListModel `xml:"enumlist" json:"enumList,omitempty"`
VariableList *VariableListModel `xml:"variablelist" json:"variableList,omitempty"`
Note *struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Filename string `xml:"filename"`
} `xml:"para"`
} `xml:"note"`
}
type VariableListVariableValueModel struct {
Text string `xml:",chardata" json:"text,omitempty"`
Name string `xml:"name,attr" json:"name,omitempty"`
}
type VariableListVariableModel struct {
Name string `xml:"name,attr" json:"name,omitempty"`
Para ParaRaw `xml:"para" json:"para,omitempty"`
Value []VariableListVariableValueModel `xml:"value" json:"value,omitempty"`
}
type VariableListModel struct {
Variable []VariableListVariableModel `xml:"variable" json:"variable,omitempty"`
}
type SeeAlsoModel struct {
Ref []SeeAlsoRefModel `json:"ref,omitempty"`
}
type SeeAlsoRefModel struct {
Text string `xml:",chardata" json:"text,omitempty"`
Type string `xml:"type,attr" json:"type,omitempty"`
}
type EnumModel struct {
//Text string `xml:",chardata"`
Name string `xml:"name,attr" json:"name,omitempty"`
Para ParaRaw `xml:"para" json:"para,omitempty"`
}
type EnumListModel struct {
//Text string `xml:",chardata"`
Enum []EnumModel `xml:"enum" json:"enum,omitempty"`
}
func (d *DocModel) Synopsis(in string) string {
s := strings.TrimSpace(in)
s = deindent(s)
return s
}
func (d *DocModel) ManagerModel(in *ManagerActionModel) *ManagerAction {
o := &ManagerAction{
Name: in.Name,
Synopsis: d.Synopsis(in.Synopsis),
Syntax: d.Syntax(in.Syntax),
SeeAlso: d.SeeAlso(in.SeeAlso),
Description: d.Description(in.Description),
}
resp := in.Responses.Events()
for _, v := range resp {
o.Responses = append(o.Responses, d.ManagerEventModel(v))
}
if len(resp) > 1 {
fmt.Println("Multi response", len(resp), o.Name)
for _, v := range resp {
fmt.Print(" ", v.Name)
}
fmt.Println()
}
return o
}
func (d *DocModel) ManagerEventModel(in *ManagerEventModel) *ManagerEvent {
o := &ManagerEvent{
Name: in.Name,
Synopsis: d.Synopsis(in.Instance.Synopsis),
Syntax: d.Syntax(in.Instance.Syntax),
SeeAlso: d.SeeAlso(in.Instance.SeeAlso),
}
return o
}
func (d *DocModel) Description(in *DescriptionModel) string {
if in == nil {
return ""
}
var p []string
for _, v := range in.Para {
p = append(p, v.Data)
}
// ignore enum,note
return formatParas(p)
}
func (d *DocModel) AGIModel(in *AgiDocModel) *AGICommand {
o := &AGICommand{
Name: in.Name,
Synopsis: d.Synopsis(in.Synopsis),
Syntax: d.Syntax(in.Syntax),
SeeAlso: d.SeeAlso(in.SeeAlso),
Description: d.Description(in.Description),
}
return o
}
func (d *DocModel) SeeAlso(in *SeeAlsoModel) (o []*SeeAlso) {
if in == nil {
return
}
for _, v := range in.Ref {
o = append(o, &SeeAlso{
Name: v.Text,
Type: v.Type,
})
}
return
}
func (d *DocModel) Syntax(in *SyntaxDocModel) *Syntax {
o := &Syntax{}
if in == nil {
return o
}
for _, v := range in.Parameter {
parameter := d.Parameter(&v)
if parameter.Name == "" {
log.Println("drop param", in)
o.Missing = true
continue
}
o.Params = append(o.Params, parameter)
}
return o
}
var regDefaultTo = regexp.MustCompile(`Defaults to\s*(.*?)`)
func parseParaDefaultTo(s string) string {
sub := regDefaultTo.FindStringSubmatch(s)
if len(sub) > 1 {
return sub[1]
}
return ""
}
var regIndent = regexp.MustCompile(`(?m)^\s+`)
func deindent(s string) string {
return regIndent.ReplaceAllString(s, "")
}
var paraTagReplace = strings.NewReplacer(
"", "`", "", "`",
"", "`", "", "`",
"", "`", "", "`",
"", " ", "", " ",
"", " ", "", " ",
"\n", " ",
)
func formatParas(s []string) string {
sb := strings.Builder{}
for _, v := range s {
sb.WriteString(formatPara(v))
sb.WriteString("\n\n")
}
return strings.TrimSpace(sb.String())
}
func formatPara(s string) string {
s = deindent(s)
return paraTagReplace.Replace(s)
}
func (*DocModel) Parameter(in *SyntaxParameterDocModel) *Parameter {
o := &Parameter{
RawName: in.Name,
Required: in.Required,
}
para := strings.TrimSpace(in.Para.Data)
if para != "" {
o.Default = parseParaDefaultTo(para)
if o.Default == "" {
// description
o.Description = formatPara(para)
}
}
processParameter(o)
return o
}
func processParameter(p *Parameter) {
rawName := p.RawName
var name string
typ := "string"
switch rawName {
case "skipms":
name = "SkipMS"
case "offsetms":
name = "OffsetMS"
case "keytree":
name = "KeyTree"
}
if name == "" {
name = rawName
// s=slicense
name = strings.ReplaceAll(name, "=", "-")
if len(name) > 4 {
name = strings.ReplaceAll(name, "name", "Name")
}
// xstrings VariableName -> Variablename
name = strcase.ToCamel(name)
}
switch name {
case "SkipMS", "OffsetMS", "SampleOffset", "Priority", "Timeout":
typ = "int"
case "Time": // AutoHangup
typ = "float64"
case "":
default:
if name[0] >= '0' && name[0] <= '9' {
name = "Field" + name
}
}
p.Name = name
p.Type = typ
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/gen_model.go 0000664 0000000 0000000 00000003614 14650613361 0027157 0 ustar 00root root 0000000 0000000 package xmlgen
import (
"strings"
"github.com/huandu/xstrings"
)
type AstDoc struct {
Actions []*Type
Events []*Type
}
type Model struct {
AGICommands []*AGICommand
Actions []*ManagerAction
Events []*ManagerEvent
}
type AGICommand struct {
Name string
Module string
Syntax *Syntax
Synopsis string
Description string
SeeAlso []*SeeAlso
}
type ManagerAction struct {
Name string
Synopsis string
Syntax *Syntax
Description string
Response *ManagerEvent
SeeAlso []*SeeAlso
Responses []*ManagerEvent
}
func (m ManagerAction) StructName() string {
return validGoTypeName(m.Name) + "Action"
}
type ManagerEvent struct {
Name string
Synopsis string
Syntax *Syntax
SeeAlso []*SeeAlso
}
func (m ManagerEvent) StructName() string {
return validGoTypeName(m.Name) + "Event"
}
type SeeAlso struct {
Type string
Name string
}
var nameFixReplace = strings.NewReplacer("Callerid", "CallerID")
func (a AGICommand) StructName() string {
switch a.Name {
case "set autohangup":
return "SetAutoHangup"
case "asyncagi break":
return "AsyncAGIBreak"
case "database deltree":
return "DatabaseDelTree"
}
name := xstrings.ToCamelCase(a.Name)
name = nameFixReplace.Replace(name)
return name
}
type Syntax struct {
Params []*Parameter
Missing bool
}
func (d Syntax) HasRequiredParam() bool {
for _, v := range d.Params {
if v.Required {
return true
}
}
return false
}
type Parameter struct {
RawName string
Name string
Type string
Default string
Required bool
Description string
/*
enumlist
*/
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/gen_model_build.go 0000664 0000000 0000000 00000003712 14650613361 0030335 0 ustar 00root root 0000000 0000000 package xmlgen
import (
"fmt"
"reflect"
)
func BuildModel(in *DocModel, out *Model) {
for _, v := range in.Agi {
out.AGICommands = append(out.AGICommands, in.AGIModel(v))
}
for _, v := range in.Manager {
out.Actions = append(out.Actions, in.ManagerModel(v))
}
for _, v := range in.ManagerEvent {
out.Events = append(out.Events, in.ManagerEventModel(v))
}
//
Dedup(&out.Actions, func(i int) string {
return out.Actions[i].Name
})
Dedup(&out.Events, func(i int) string {
return out.Events[i].Name
})
for _, v := range out.Events {
Dedup(&v.Syntax.Params, func(i int) string {
return v.Syntax.Params[i].Name
})
}
// add missing event, unify event
events := map[string]*ManagerEvent{}
for _, v := range out.Events {
events[v.Name] = v
}
for _, action := range out.Actions {
for k, v := range action.Responses {
if e, ok := events[v.Name]; ok {
action.Responses[k] = e
} else {
out.Events = append(out.Events, v)
fmt.Println("Append Response Event", v.Name)
}
}
}
// add missing ActionID
for _, v := range out.Actions {
found := false
for _, v := range v.Syntax.Params {
if found = v.Name == "ActionID"; found {
break
}
}
if !found {
o := []*Parameter{{
Name: "ActionID",
Type: "string",
Description: "ActionID for this transaction. Will be returned.",
}}
v.Syntax.Params = append(o, v.Syntax.Params...)
}
}
}
func validGoTypeName(s string) string {
s = invalid.ReplaceAllLiteralString(s, "")
return s
}
func Dedup(arr interface{}, cond func(int) string) {
m := map[string]bool{}
Filter(arr, func(i int) bool {
k := cond(i)
if _, ok := m[k]; ok {
return false
}
m[k] = true
return true
})
}
func Filter(arr interface{}, cond func(int) bool) {
rv := reflect.ValueOf(arr).Elem()
rt := rv.Type()
neo := reflect.MakeSlice(rt, 0, 0)
for i := 0; i < rv.Len(); i++ {
if v := rv.Index(i); cond(i) {
neo = reflect.Append(neo, v)
}
}
rv.Set(neo)
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/model.go 0000664 0000000 0000000 00000076560 14650613361 0026340 0 ustar 00root root 0000000 0000000 package xmlgen
import "encoding/xml"
type Docs struct {
XMLName xml.Name `xml:"docs"`
Text string `xml:",chardata"`
Xi string `xml:"xi,attr"`
ConfigInfo []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Language string `xml:"language,attr"`
Synopsis string `xml:"synopsis"`
Description struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Emphasis []string `xml:"emphasis"`
Literal []string `xml:"literal"`
Filename string `xml:"filename"`
} `xml:"para"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Emphasis string `xml:"emphasis"`
} `xml:"para"`
} `xml:"warning"`
Note struct {
Text string `xml:",chardata"`
Para string `xml:"para"`
} `xml:"note"`
Enumlist []struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
} `xml:"description"`
ConfigFile struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
ConfigObject []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Synopsis string `xml:"synopsis"`
ConfigOption []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Default string `xml:"default,attr"`
Synopsis string `xml:"synopsis"`
Description struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Filename []string `xml:"filename"`
Replaceable []string `xml:"replaceable"`
Variable string `xml:"variable"`
Emphasis []string `xml:"emphasis"`
Astcli string `xml:"astcli"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable string `xml:"replaceable"`
Emphasis string `xml:"emphasis"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"note"`
} `xml:"enum"`
} `xml:"enumlist"`
Note []struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Variable string `xml:"variable"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Filename string `xml:"filename"`
} `xml:"para"`
} `xml:"note"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"warning"`
Variablelist struct {
Text string `xml:",chardata"`
Variable []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para struct {
Text string `xml:",chardata"`
Variable string `xml:"variable"`
} `xml:"para"`
} `xml:"variable"`
} `xml:"variablelist"`
Example []struct {
Text string `xml:",chardata"`
Title string `xml:"title,attr"`
} `xml:"example"`
} `xml:"description"`
SeeAlso struct {
Text string `xml:",chardata"`
Ref []struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
} `xml:"ref"`
} `xml:"see-also"`
Syntax struct {
Text string `xml:",chardata"`
Argsep string `xml:"argsep,attr"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Para string `xml:"para"`
Optionlist struct {
Text string `xml:",chardata"`
Option []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"option"`
} `xml:"optionlist"`
Argument struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Para string `xml:"para"`
} `xml:"argument"`
} `xml:"parameter"`
} `xml:"syntax"`
} `xml:"configOption"`
Description struct {
Text string `xml:",chardata"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Emphasis []string `xml:"emphasis"`
Filename string `xml:"filename"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Emphasis string `xml:"emphasis"`
Filename string `xml:"filename"`
} `xml:"para"`
} `xml:"note"`
} `xml:"description"`
} `xml:"configObject"`
} `xml:"configFile"`
} `xml:"configInfo"`
Manager []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Language string `xml:"language,attr"`
Module string `xml:"module,attr"`
Synopsis string `xml:"synopsis"`
Syntax struct {
Text string `xml:",chardata"`
Include []struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Default string `xml:"default,attr"`
Para []struct {
Text string `xml:",chardata"`
Replaceable []string `xml:"replaceable"`
Literal []string `xml:"literal"`
Variable string `xml:"variable"`
Filename string `xml:"filename"`
} `xml:"para"`
Enumlist []struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para struct {
Text string `xml:",chardata"`
Replaceable string `xml:"replaceable"`
} `xml:"para"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"note"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
} `xml:"enum"`
} `xml:"enumlist"`
} `xml:"enum"`
} `xml:"enumlist"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Variable []string `xml:"variable"`
} `xml:"para"`
} `xml:"warning"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
} `xml:"parameter"`
} `xml:"syntax"`
Description struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Variable string `xml:"variable"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
} `xml:"para"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
} `xml:"para"`
} `xml:"note"`
Variablelist struct {
Text string `xml:",chardata"`
Variable struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"variable"`
} `xml:"variablelist"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"warning"`
} `xml:"description"`
SeeAlso struct {
Text string `xml:",chardata"`
Ref []struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
Module string `xml:"module,attr"`
} `xml:"ref"`
} `xml:"see-also"`
Responses struct {
Text string `xml:",chardata"`
ListElements struct {
Text string `xml:",chardata"`
Include []struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
ManagerEvent struct {
Text string `xml:",chardata"`
Language string `xml:"language,attr"`
Name string `xml:"name,attr"`
ManagerEventInstance struct {
Text string `xml:",chardata"`
Class string `xml:"class,attr"`
Synopsis string `xml:"synopsis"`
Syntax struct {
Text string `xml:",chardata"`
ChannelSnapshot string `xml:"channel_snapshot"`
} `xml:"syntax"`
} `xml:"managerEventInstance"`
} `xml:"managerEvent"`
} `xml:"list-elements"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
ManagerEvent struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Language string `xml:"language,attr"`
ManagerEventInstance struct {
Text string `xml:",chardata"`
Class string `xml:"class,attr"`
Synopsis string `xml:"synopsis"`
Syntax struct {
Text string `xml:",chardata"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"parameter"`
BridgeSnapshot string `xml:"bridge_snapshot"`
} `xml:"syntax"`
} `xml:"managerEventInstance"`
} `xml:"managerEvent"`
} `xml:"responses"`
} `xml:"manager"`
Function []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Language string `xml:"language,attr"`
Module string `xml:"module,attr"`
Synopsis string `xml:"synopsis"`
Syntax struct {
Text string `xml:",chardata"`
Argsep string `xml:"argsep,attr"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Argsep string `xml:"argsep,attr"`
Multiple string `xml:"multiple,attr"`
Default string `xml:"default,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Filename string `xml:"filename"`
Emphasis string `xml:"emphasis"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Replaceable []string `xml:"replaceable"`
Literal []string `xml:"literal"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
Filename string `xml:"filename"`
Emphasis []string `xml:"emphasis"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Warning struct {
Text string `xml:",chardata"`
Para string `xml:"para"`
} `xml:"warning"`
Note struct {
Text string `xml:",chardata"`
Para string `xml:"para"`
} `xml:"note"`
} `xml:"enum"`
ConfigOptionToEnum struct {
Text string `xml:",chardata"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
} `xml:"configOptionToEnum"`
} `xml:"enumlist"`
Optionlist struct {
Text string `xml:",chardata"`
Option []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
} `xml:"para"`
Argument []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Para string `xml:"para"`
} `xml:"argument"`
} `xml:"option"`
} `xml:"optionlist"`
Argument []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
} `xml:"argument"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Variable []string `xml:"variable"`
} `xml:"para"`
} `xml:"warning"`
Note struct {
Text string `xml:",chardata"`
Para string `xml:"para"`
} `xml:"note"`
} `xml:"parameter"`
} `xml:"syntax"`
Description struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Replaceable []string `xml:"replaceable"`
Literal []string `xml:"literal"`
Variable []string `xml:"variable"`
Filename []string `xml:"filename"`
Emphasis string `xml:"emphasis"`
} `xml:"para"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Emphasis []string `xml:"emphasis"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"warning"`
Example []struct {
Text string `xml:",chardata"`
Title string `xml:"title,attr"`
Language string `xml:"language,attr"`
} `xml:"example"`
Note []struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Emphasis []string `xml:"emphasis"`
} `xml:"para"`
} `xml:"note"`
Enumlist []struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
Variablelist struct {
Text string `xml:",chardata"`
Variable struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Value []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
} `xml:"value"`
Para string `xml:"para"`
} `xml:"variable"`
} `xml:"variablelist"`
} `xml:"description"`
SeeAlso struct {
Text string `xml:",chardata"`
Ref []struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
Module string `xml:"module,attr"`
} `xml:"ref"`
} `xml:"see-also"`
} `xml:"function"`
Info []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Language string `xml:"language,attr"`
Tech string `xml:"tech,attr"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Replaceable string `xml:"replaceable"`
Literal []string `xml:"literal"`
} `xml:"para"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Para struct {
Text string `xml:",chardata"`
Replaceable string `xml:"replaceable"`
Literal string `xml:"literal"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"note"`
} `xml:"enum"`
} `xml:"enumlist"`
} `xml:"parameter"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
} `xml:"enum"`
} `xml:"enumlist"`
Example struct {
Text string `xml:",chardata"`
Title string `xml:"title,attr"`
} `xml:"example"`
Para struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
} `xml:"para"`
} `xml:"info"`
Application []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Language string `xml:"language,attr"`
Module string `xml:"module,attr"`
Synopsis string `xml:"synopsis"`
Syntax struct {
Text string `xml:",chardata"`
Argsep string `xml:"argsep,attr"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Argsep string `xml:"argsep,attr"`
Multiple string `xml:"multiple,attr"`
Hasparams string `xml:"hasparams,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Directory string `xml:"directory"`
Filename string `xml:"filename"`
Variable string `xml:"variable"`
Replaceable []string `xml:"replaceable"`
Emphasis string `xml:"emphasis"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Optionlist struct {
Text string `xml:",chardata"`
Option []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Implies string `xml:"implies,attr"`
Argsep string `xml:"argsep,attr"`
Hasparams string `xml:"hasparams,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Variable []string `xml:"variable"`
Emphasis []string `xml:"emphasis"`
Filename string `xml:"filename"`
Directory string `xml:"directory"`
} `xml:"para"`
Argument []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Hasparams string `xml:"hasparams,attr"`
Argsep string `xml:"argsep,attr"`
Multiple string `xml:"multiple,attr"`
Para []struct {
Text string `xml:",chardata"`
Replaceable string `xml:"replaceable"`
Variable string `xml:"variable"`
Literal []string `xml:"literal"`
Filename string `xml:"filename"`
Emphasis string `xml:"emphasis"`
} `xml:"para"`
Argument []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Multiple string `xml:"multiple,attr"`
Required string `xml:"required,attr"`
} `xml:"argument"`
} `xml:"argument"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Variable []string `xml:"variable"`
} `xml:"para"`
} `xml:"warning"`
Note []struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable string `xml:"replaceable"`
Variable string `xml:"variable"`
} `xml:"para"`
} `xml:"note"`
Variablelist struct {
Text string `xml:",chardata"`
Variable []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para struct {
Text string `xml:",chardata"`
Replaceable []string `xml:"replaceable"`
} `xml:"para"`
Value []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Default string `xml:"default,attr"`
} `xml:"value"`
} `xml:"variable"`
} `xml:"variablelist"`
} `xml:"option"`
} `xml:"optionlist"`
Argument []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Argsep string `xml:"argsep,attr"`
Required string `xml:"required,attr"`
Multiple string `xml:"multiple,attr"`
Hasparams string `xml:"hasparams,attr"`
Argument []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Multiple string `xml:"multiple,attr"`
} `xml:"argument"`
Para []struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Filename string `xml:"filename"`
} `xml:"para"`
} `xml:"argument"`
Warning struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Variable []string `xml:"variable"`
} `xml:"para"`
} `xml:"warning"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Replaceable []string `xml:"replaceable"`
Emphasis string `xml:"emphasis"`
Literal string `xml:"literal"`
} `xml:"para"`
} `xml:"note"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
} `xml:"parameter"`
Include []struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
} `xml:"syntax"`
Description struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Replaceable []string `xml:"replaceable"`
Literal []string `xml:"literal"`
Emphasis string `xml:"emphasis"`
Filename []string `xml:"filename"`
Variable []string `xml:"variable"`
Directory string `xml:"directory"`
Astcli string `xml:"astcli"`
} `xml:"para"`
Note []struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Variable []string `xml:"variable"`
Filename string `xml:"filename"`
} `xml:"para"`
} `xml:"note"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable string `xml:"replaceable"`
Directory string `xml:"directory"`
Filename string `xml:"filename"`
} `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Variablelist []struct {
Text string `xml:",chardata"`
Variable []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Emphasis string `xml:"emphasis"`
Variable string `xml:"variable"`
} `xml:"para"`
Value []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
} `xml:"value"`
} `xml:"variable"`
} `xml:"variablelist"`
Example []struct {
Text string `xml:",chardata"`
Title string `xml:"title,attr"`
} `xml:"example"`
Warning []struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Variable []string `xml:"variable"`
} `xml:"para"`
} `xml:"warning"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
} `xml:"description"`
SeeAlso struct {
Text string `xml:",chardata"`
Ref []struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
Module string `xml:"module,attr"`
} `xml:"ref"`
} `xml:"see-also"`
} `xml:"application"`
ManagerEvent []struct {
Text string `xml:",chardata"`
Language string `xml:"language,attr"`
Name string `xml:"name,attr"`
ManagerEventInstance struct {
Text string `xml:",chardata"`
Class string `xml:"class,attr"`
Synopsis string `xml:"synopsis"`
Syntax struct {
Text string `xml:",chardata"`
ChannelSnapshot []struct {
Text string `xml:",chardata"`
Prefix string `xml:"prefix,attr"`
} `xml:"channel_snapshot"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Multiple string `xml:"multiple,attr"`
Para []struct {
Text string `xml:",chardata"`
Variable string `xml:"variable"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Include struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
} `xml:"para"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Filename string `xml:"filename"`
Replaceable string `xml:"replaceable"`
} `xml:"para"`
} `xml:"note"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para []struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Filename string `xml:"filename"`
Literal []string `xml:"literal"`
Replaceable string `xml:"replaceable"`
} `xml:"para"`
} `xml:"note"`
} `xml:"enum"`
} `xml:"enumlist"`
} `xml:"parameter"`
Include []struct {
Text string `xml:",chardata"`
Xpointer string `xml:"xpointer,attr"`
} `xml:"include"`
BridgeSnapshot []struct {
Text string `xml:",chardata"`
Prefix string `xml:"prefix,attr"`
} `xml:"bridge_snapshot"`
} `xml:"syntax"`
SeeAlso struct {
Text string `xml:",chardata"`
Ref []struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
} `xml:"ref"`
} `xml:"see-also"`
Description struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable string `xml:"replaceable"`
Filename string `xml:"filename"`
} `xml:"para"`
Note struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
Filename string `xml:"filename"`
} `xml:"para"`
} `xml:"note"`
} `xml:"description"`
} `xml:"managerEventInstance"`
} `xml:"managerEvent"`
Agi []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Language string `xml:"language,attr"`
Synopsis string `xml:"synopsis"`
Syntax struct {
Text string `xml:",chardata"`
Parameter []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Required string `xml:"required,attr"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
Filename string `xml:"filename"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Parameter struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Literal string `xml:"literal,attr"`
Required string `xml:"required,attr"`
} `xml:"parameter"`
} `xml:"enum"`
} `xml:"enumlist"`
} `xml:"parameter"`
} `xml:"syntax"`
Description struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
Literal []string `xml:"literal"`
Replaceable []string `xml:"replaceable"`
} `xml:"para"`
Enumlist struct {
Text string `xml:",chardata"`
Enum []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para string `xml:"para"`
} `xml:"enum"`
} `xml:"enumlist"`
Variablelist struct {
Text string `xml:",chardata"`
Variable []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Para struct {
Text string `xml:",chardata"`
Literal string `xml:"literal"`
} `xml:"para"`
Value []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
} `xml:"value"`
} `xml:"variable"`
} `xml:"variablelist"`
} `xml:"description"`
SeeAlso struct {
Text string `xml:",chardata"`
Ref []struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
} `xml:"ref"`
} `xml:"see-also"`
} `xml:"agi"`
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/parse.go 0000664 0000000 0000000 00000000610 14650613361 0026331 0 ustar 00root root 0000000 0000000 package xmlgen
type Type struct {
Name string
Doc string
Fields []*Field
}
type Field struct {
Name string
Doc string
Default string
Required bool
Type *TypeInfo
StructTag string
Annotations interface{}
}
type Annotation interface {
Name() string
}
type TypeInfo struct {
Type string
}
func (ti *TypeInfo) String() string {
return ti.Type
}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/ 0000775 0000000 0000000 00000000000 14650613361 0026506 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/agi/ 0000775 0000000 0000000 00000000000 14650613361 0027246 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/agi/command.tmpl 0000664 0000000 0000000 00000003313 14650613361 0031562 0 ustar 00root root 0000000 0000000 {{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.AGICommand*/}}
{{- define "agi/command"}}
// {{.StructName}}Command {{.Synopsis}}
{{- with .Description}}
// {{end}}
{{- with .Description}}{{template "comment" .}} {{end}}
type {{.StructName}}Command struct {
{{- range $_,$v:=.Syntax.Params}}
{{- with $v.Description}} {{template "comment" (printf "%v %v" $v.Name .)}} {{end}}
{{$v.Name}} {{with not $v.Required}}*{{end}}{{$v.Type}} {{with $v.Default}} // default to {{$v.Default}} {{end}}
{{- end}}
{{with .Syntax.Missing}} // has missing params {{- end}}
}
func(cmd {{.StructName}}Command)Command() (string, error) {
s := []interface{}{cmd.CommandString(),{{- range $_,$v:=.Syntax.Params}} cmd.{{.Name}}, {{- end}}}
return joinCommand(s), nil
}
func(cmd {{.StructName}}Command)CommandString()string {
return "{{.Name | upper}}"
}
{{$s:=.}}
{{- range $_,$v:=.Syntax.Params}}
{{- if not $v.Required}}
func (cmd {{$s.StructName}}Command)Set{{$v.Name}}(v {{$v.Type}}) {{$s.StructName}}Command {
cmd.{{$v.Name}} = &v
return cmd
}
{{- end}}
{{- end}}
func (c *Client) {{$s.StructName}}(
{{- range $_,$v:=.Syntax.Params -}}
{{- if $v.Required}} {{$v.Name | untitle}} {{$v.Type}}, {{- end -}}
{{- end -}}
) Response {
return c.Handler.Command({{$s.StructName}}Command{
{{- range $_,$v:=.Syntax.Params}}
{{- if $v.Required}}
{{$v.Name}}: {{$v.Name | untitle}},
{{- end}}
{{- end}}
})
}
{{- end}}
{{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.SyntaxParamDoc*/}}
{{- define "agi/command/field"}}
{{- with .Description}} {{template "comment" (printf "%v %v" $.Name .)}} {{end}}
{{$.Name}} {{with not $.Required}}*{{end}}{{$.Type}} {{with $.Default}} // default to {{$.Default}} {{end}}
{{- end}}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/agi/commands.tmpl 0000664 0000000 0000000 00000000357 14650613361 0031752 0 ustar 00root root 0000000 0000000 {{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.Model*/}}
{{- define "agi/commands"}}
// Code generated by xmlgen. DO NOT EDIT.
package agimodels
{{range $_,$v := $.AGICommands}}
{{template "agi/command" $v}}
{{end}}
{{- end}}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/ami/ 0000775 0000000 0000000 00000000000 14650613361 0027254 5 ustar 00root root 0000000 0000000 golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/ami/action.tmpl 0000664 0000000 0000000 00000003277 14650613361 0031440 0 ustar 00root root 0000000 0000000 {{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.ManagerAction*/}}
{{- define "ami/action"}}
{{with .Synopsis}} {{template "comment" (printf "%v %v" $.StructName .)}} {{end}}
type {{.StructName}} struct {
{{- template "ami/fields" .}}
}
func({{.StructName}})ActionTypeName() string{
return "{{.Name}}"
}
func(a {{.StructName}})GetActionID() string{
return a.ActionID
}
func(a*{{.StructName}})SetActionID(actionID string) {
a.ActionID = actionID
}
{{- if eq (len .Responses) 1}}
func(cli*Client){{.Name}}(req {{.StructName}},opts ...RequestOption)(res *{{(index .Responses 0).StructName}}, err error) {
req := &{{.StructName}}{
{{- range $_,$v:=.Syntax.Params}}
{{- if $v.Required}}
{{$v.Name}}: {{$v.Name | untitle}},
{{- end}}
{{- end}}
}
res = &{{(index .Responses 0).StructName}}{}
return res, cli.Action(req,res)
}
{{- end}}
{{- if eq (len .Responses) 0}}
func(cli*Client){{.Name}}({{- range $_,$v:=.Syntax.Params -}}
{{- if $v.Required}} {{$v.Name | ParamName}} {{$v.Type}}, {{- end -}}
{{- end -}} opts ...RequestOption)(res *Response, err error) {
req := &{{.StructName}}{
{{- range $_,$v:=.Syntax.Params}}
{{- if $v.Required}}
{{$v.Name}}: {{$v.Name | ParamName}},
{{- end}}
{{- end}}
}
res = &Response{}
return res, cli.Action(req,res,opts...)
}
{{- end}}
{{- end}}
{{- define "comment"}}
{{regexReplaceAllLiteral "(?m)^" (. | trim) "// "}}
{{- end}}
{{- define "ami/fields" -}}
{{- range $_,$v:=.Syntax.Params -}}
{{- with $v.Description}} {{template "comment" (printf "%v %v" $v.Name .)}} {{end}}
{{$v.Name}} {{$v.Type}} {{with $v.Default}} // default to {{$v.Default}} {{end}}
{{- end}}
{{with .Syntax.Missing}} // has missing params {{- end}}
{{- end}}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/ami/actions.tmpl 0000664 0000000 0000000 00000000351 14650613361 0031611 0 ustar 00root root 0000000 0000000 {{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.Model */}}
{{- define "ami/actions"}}
// Code generated by xmlgen. DO NOT EDIT.
package amimodels
{{range $_,$v := $.Actions}}
{{template "ami/action" $v}}
{{end}}
{{- end}}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/ami/event.tmpl 0000664 0000000 0000000 00000000501 14650613361 0031267 0 ustar 00root root 0000000 0000000 {{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.ManagerEvent*/}}
{{- define "ami/event"}}
{{with .Synopsis}} {{template "comment" (printf "%v %v" $.StructName .)}} {{end}}
type {{.StructName}} struct {
{{- template "ami/fields" .}}
}
func({{.StructName}})EventTypeName() string{
return "{{.Name}}"
}
{{- end}}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/ami/events.tmpl 0000664 0000000 0000000 00000000346 14650613361 0031461 0 ustar 00root root 0000000 0000000 {{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.Model */}}
{{- define "ami/events"}}
// Code generated by xmlgen. DO NOT EDIT.
package amimodels
{{range $_,$v := $.Events}}
{{template "ami/event" $v}}
{{end}}
{{- end}}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/template/field.tmpl 0000664 0000000 0000000 00000000270 14650613361 0030466 0 ustar 00root root 0000000 0000000 {{/* gotype: github.com/wenerme/astgo/pkg/tools/xmlgen.Field */}}
{{- define "field"}}
{{- with .Doc}}
{{template "comment" . | nindent 2}}
{{- end}}
{{.Name}} {{.Type}}
{{- end}}
golang-github-wenerme-astgo-0.0~git20230926.1b5bc38/pkg/tools/xmlgen/tmpl.go 0000664 0000000 0000000 00000012401 14650613361 0026174 0 ustar 00root root 0000000 0000000 package xmlgen
import (
"bytes"
"context"
"embed"
"fmt"
"go/format"
"log"
"os"
"path/filepath"
"strings"
"text/template"
"github.com/Masterminds/goutils"
"github.com/Masterminds/sprig"
"github.com/pkg/errors"
"golang.org/x/tools/imports"
)
//go:embed template/*.tmpl template/**/*.tmpl
var templateFS embed.FS
func MustParseTemplates() *template.Template {
//ext := pick(sprig.TxtFuncMap(), "ternary", "title")
tpl := template.Must(
template.New("gqlgen").
//Funcs(gen.Funcs).
//Funcs(ext).
Funcs(sprig.TxtFuncMap()).
Funcs(map[string]interface{}{
"ParamName": ParamName,
}).
//Funcs(Funcs).
ParseFS(templateFS, "template/*.tmpl", "template/**/*.tmpl"),
)
//return &gen.Template{
// Template: tpl,
// FuncMap: gen.Funcs,
//}
return tpl
}
func NewAMIGenerator() *Generator {
return &Generator{
Template: MustParseTemplates(),
Formatter: GoFormatter,
Templates: []TemplateGenerate{
&GenerateTemplate{
Name: "ami/actions",
FormatName: "actions.go",
},
&GenerateTemplate{
Name: "ami/events",
FormatName: "events.go",
},
},
}
}
func NewAGIGenerator() *Generator {
return &Generator{
Template: MustParseTemplates(),
Formatter: GoFormatter,
Templates: []TemplateGenerate{
//&GenerateTemplate{
// Name: "agi/commands",
// FormatName: "commands.go",
//},
&GenerateTemplate{
Name: "ami/actions",
FormatName: "ami/amimodels/actions.go",
},
&GenerateTemplate{
Name: "ami/events",
FormatName: "ami/amimodels/events.go",
},
},
}
}
type Generator struct {
Files []File
Template *template.Template
Templates []TemplateGenerate
Debug bool
Formatter func(file *File) error
Loader func() error
}
type File struct {
Name string
Content []byte
}
type WriteConfig struct {
Target string
DryRun bool
}
func (ge *Generator) Write(s WriteConfig) error {
for _, v := range ge.Files {
o := filepath.Join(s.Target, v.Name)
// log.Println("write ", v.Name, " to ", o)
if !s.DryRun {
if err := os.WriteFile(o, v.Content, 0644); err != nil {
return err
}
}
if s.DryRun || ge.Debug {
log.Println(o, "\n", strings.TrimSpace(string(v.Content)))
}
}
return nil
}
func (ge *Generator) Generate(ctx context.Context, source interface{}) (err error) {
if err = ge.init(); err != nil {
return
}
var all []File
for _, tmpl := range ge.Templates {
var files []File
files, err = tmpl.Generate(ctx, ge, source)
if err != nil {
return err
}
if ge.Formatter != nil {
for i := range files {
f := files[i]
file := &files[i]
if err = ge.Formatter(file); err != nil {
if ge.Debug {
log.Println(f.Name, err.Error(), "\n", lineNumber(string(f.Content)))
}
return errors.Wrapf(err, "format %v", file.Name)
}
}
}
all = append(all, files...)
}
ge.Files = append(ge.Files, all...)
return
}
func (ge *Generator) init() error {
if ge.Debug {
log.Println("generating")
}
if ge.Loader != nil {
if ge.Debug {
log.Println("generator loading")
}
if err := ge.Loader(); err != nil {
return err
}
}
return nil
}
type TemplateGenerate interface {
Generate(ctx context.Context, ge *Generator, source interface{}) ([]File, error)
}
type GenerateTemplate struct {
Name string // template name.
DeriveSource func(ctx context.Context, rootSource interface{}) interface{}
Skip func(ctx context.Context, source interface{}) bool // skip condition (storage constraints or gated by a feature-flag).
Format func(ctx context.Context, source interface{}) string // file name format.
FormatName string // for single
}
func (tmpl *GenerateTemplate) Generate(ctx context.Context, ge *Generator, source interface{}) (files []File, err error) {
if tmpl.DeriveSource != nil {
source = tmpl.DeriveSource(ctx, source)
}
all, ok := source.([]interface{})
if !ok {
all = []interface{}{source}
}
for _, source := range all {
f, err := tmpl.one(ctx, ge, source)
if err != nil {
return nil, err
}
if f.Name != "" {
files = append(files, f)
}
}
return
}
func (tmpl *GenerateTemplate) one(ctx context.Context, ge *Generator, source interface{}) (file File, err error) {
if tmpl.Skip != nil {
if tmpl.Skip(ctx, source) {
return
}
}
b := bytes.NewBuffer(nil)
if err = ge.Template.ExecuteTemplate(b, tmpl.Name, source); err != nil {
return file, fmt.Errorf("execute template %q: %w", tmpl.Name, err)
}
fn := tmpl.FormatName
if tmpl.Format != nil {
fn = tmpl.Format(ctx, source)
}
file.Name = fn
file.Content = b.Bytes()
if ge.Debug {
log.Printf("generate %s with %T to %s", tmpl.Name, source, fn)
}
return
}
func GoFormatter(f *File) (err error) {
f.Content, err = format.Source(f.Content)
if err == nil {
f.Content, err = imports.Process(f.Name, f.Content, nil)
}
return
}
func ReportFile(f *File) {
log.Println(f.Name, "\n", lineNumber(string(f.Content)))
}
func lineNumber(s string) string {
lines := strings.Split(s, "\n")
c := strings.Builder{}
for i, v := range lines {
c.WriteString(fmt.Sprintf("%v: ", i))
c.WriteString(v)
c.WriteRune('\n')
}
return c.String()
}
func ParamName(s string) string {
s = goutils.Uncapitalize(s)
switch s {
case "interface":
s = "iface"
}
return s
}