ami

package
Version: v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2014 License: LGPL-3.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AGI

func AGI(socket *Socket, actionID, channel, agiCommand, agiCommandID string) (map[string]string, error)

AGI

Add an AGI command to execute by Async AGI.

func AOCMessage

func AOCMessage(socket *Socket, actionID string, aocData AOCData) (map[string]string, error)

AOCMessage

Generate an Advice of Charge message on a channel.

func AbsoluteTimeout

func AbsoluteTimeout(socket *Socket, actionID, channel string, timeout int) (map[string]string, error)

AbsoluteTimeout

Set absolute timeout.
Hangup a channel after a certain time. Acknowledges set time with Timeout Set message.

func AgentLogoff

func AgentLogoff(socket *Socket, actionID, agent string, soft bool) (map[string]string, error)

AgentLogoff

Sets an agent as no longer logged in.

func Agents

func Agents(socket *Socket, actionID string) ([]map[string]string, error)

Agents

Lists agents and their status.

func Atxfer

func Atxfer(socket *Socket, actionID, channel, exten, context, priority string) (map[string]string, error)

Atxfer

Attended transfer.

func Bridge

func Bridge(socket *Socket, actionID, channel1, channel2 string, tone bool) (map[string]string, error)

Bridge

Bridge two channels already in the PBX.

func Challenge

func Challenge(socket *Socket, actionID string) (map[string]string, error)

Challenge

Generate a challenge for MD5 authentication.

func ChangeMonitor

func ChangeMonitor(socket *Socket, actionID, channel, file string) (map[string]string, error)

ChangeMonitor

Change monitoring filename of a channel.
This action may be used to change the file started by a previous 'Monitor' action.

func Command

func Command(socket *Socket, actionID, cmd string) (map[string]string, error)

Command

Execute Asterisk CLI Command.

func Connect

func Connect(socket *Socket) (bool, error)

func CoreSettings

func CoreSettings(socket *Socket, actionID string) (map[string]string, error)

CoreSettings

Show PBX core settings (version etc).

func CoreShowChannels

func CoreShowChannels(socket *Socket, actionID string) ([]map[string]string, error)

CoreShowChannels

List currently active channels.

func CoreStatus

func CoreStatus(socket *Socket, actionID string) (map[string]string, error)

CoreStatus

Show PBX core status variables.

func CreateConfig

func CreateConfig(socket *Socket, actionID, filename string) (map[string]string, error)

CreateConfig

Creates an empty file in the configuration directory.
This action will create an empty file in the configuration directory.
This action is intended to be used before an UpdateConfig action.

func DAHDIDNDoff

func DAHDIDNDoff(socket *Socket, actionID, channel string) (map[string]string, error)

DAHDIDNDoff

Toggle DAHDI channel Do Not Disturb status OFF.

func DAHDIDNDon

func DAHDIDNDon(socket *Socket, actionID, channel string) (map[string]string, error)

DAHDIDNDon

Toggle DAHDI channel Do Not Disturb status ON.

func DAHDIDialOffhook

func DAHDIDialOffhook(socket *Socket, actionID, channel, number string) (map[string]string, error)

DAHDIDialOffhook

Dial over DAHDI channel while offhook.
Generate DTMF control frames to the bridged peer.

func DAHDIHangup

func DAHDIHangup(socket *Socket, actionID, channel string) (map[string]string, error)

DAHDIHangup

Hangup DAHDI Channel.

func DAHDIRestart

func DAHDIRestart(socket *Socket, actionID string) (map[string]string, error)

DAHDIRestart

Fully Restart DAHDI channels (terminates calls).

func DAHDIShowChannels

func DAHDIShowChannels(socket *Socket, actionID, channel string) (map[string]string, error)

DAHDIShowChannels

Show status of DAHDI channels.

func DAHDITransfer

func DAHDITransfer(socket *Socket, actionID, channel string) (map[string]string, error)

DAHDITransfer

Transfer DAHDI Channel.

func DBDel

func DBDel(socket *Socket, actionID, family, key string) (map[string]string, error)

DBDel

Delete DB entry.

func DBDelTree

func DBDelTree(socket *Socket, actionID, family, key string) (map[string]string, error)

DBDelTree

Delete DB tree.

func DBGet

func DBGet(socket *Socket, actionID, family, key string) (map[string]string, error)

DBGet

Get DB Entry.

func DBPut

func DBPut(socket *Socket, actionID, family, key, val string) (map[string]string, error)

DBPut

Put DB entry.

func DataGet

func DataGet(socket *Socket, actionID, path, search, filter string) (map[string]string, error)

DataGet

Retrieve the data api tree.

func Events

func Events(socket *Socket, actionID, eventMask string) (map[string]string, error)

Events

Control Event Flow.
Enable/Disable sending of events to this manager client.

func ExtensionState

func ExtensionState(socket *Socket, actionID, exten, context string) (map[string]string, error)

ExtensionState

Check Extension Status.

func GetConfig

func GetConfig(socket *Socket, actionID, filename, category string) (map[string]string, error)

GetConfig

Retrieve configuration.
This action will dump the contents of a configuration file by category and contents or optionally by specified category only.

func GetConfigJSON

func GetConfigJSON(socket *Socket, actionID, filename string) (map[string]string, error)

GetConfigJSON

Retrieve configuration (JSON format).
This action will dump the contents of a configuration file by category and contents in JSON format.
This only makes sense to be used using rawman over the HTTP interface.

func GetEvents

func GetEvents(socket *Socket) (map[string]string, error)

GetEvents

Get events from current socket connection
It is mandatory set 'events' of ami.Login with "system,call,all,user", to received
events

func GetUUID

func GetUUID() (string, error)

func Getvar

func Getvar(socket *Socket, actionID, channel, variable string) (map[string]string, error)

Getvar

Gets a channel variable.

func Hangup

func Hangup(socket *Socket, actionID, channel, cause string) (map[string]string, error)

Hangup

Hangup channel.

func IAXpeerlist

func IAXpeerlist(socket *Socket, actionID string) ([]map[string]string, error)

IAXpeerlist

Show IAX channels network statistics.

func IAXpeers

func IAXpeers(socket *Socket, actionID string) ([]map[string]string, error)

IAXpeers

List IAX peers.

func IAXregistry

func IAXregistry(socket *Socket, actionID string) ([]map[string]string, error)

IAXregistry

Show IAX registrations.

func JabberSend

func JabberSend(socket *Socket, actionID, jabber, jid, message string) (map[string]string, error)

JabberSend

Sends a message to a Jabber Client.

func ListCategories

func ListCategories(socket *Socket, actionID, filename string) (map[string]string, error)

ListCategories

List categories in configuration file.

func ListCommands

func ListCommands(socket *Socket, actionID string) (map[string]string, error)

ListCommands

List available manager commands.
Returns the action name and synopsis for every action that is available to the user

func LocalOptimizeAway

func LocalOptimizeAway(socket *Socket, actionID, channel string) (map[string]string, error)

LocalOptimizeAway

Optimize away a local channel when possible.
A local channel created with "/n" will not automatically optimize away.
Calling this command on the local channel will clear that flag and allow it to optimize away if it's bridged or when it becomes bridged.

func Login

func Login(socket *Socket, user, secret, events, actionID string) (bool, error)

Login

Login Manager.

func Logoff

func Logoff(socket *Socket, actionID string) (bool, error)

Logoff

Logoff the current manager session.

func MailboxCount

func MailboxCount(socket *Socket, actionID, mailbox string) (map[string]string, error)

MailboxCount

Check Mailbox Message Count.

func MailboxStatus

func MailboxStatus(socket *Socket, actionID, mailbox string) (map[string]string, error)

MailboxStatus

Check Mailbox Message Count.

func MeetmeList

func MeetmeList(socket *Socket, actionID, conference string) ([]map[string]string, error)

MeetmeList

Lists all users in a particular MeetMe conference.
MeetmeList will follow as separate events, followed by a final event called MeetmeListComplete.

func MeetmeMute

func MeetmeMute(socket *Socket, actionID, meetme, usernum string) (map[string]string, error)

MeetmeMute

Mute a Meetme user.

func MeetmeUnMute

func MeetmeUnMute(socket *Socket, actionID, meetme, usernum string) (map[string]string, error)

MeetmeUnMute

Unmute a Meetme user.

func MixMonitorMute

func MixMonitorMute(socket *Socket, actionID, channel, direction string, state bool) (map[string]string, error)

MixMonitorMute

Mute / unMute a Mixmonitor recording.
This action may be used to mute a MixMonitor recording.

func ModuleCheck

func ModuleCheck(socket *Socket, actionID, module string) (map[string]string, error)

ModuleCheck

Check if module is loaded.
Checks if Asterisk module is loaded. Will return Success/Failure. For success returns, the module revision number is included.

func ModuleLoad

func ModuleLoad(socket *Socket, actionID, module, loadType string) (map[string]string, error)

ModuleLoad

Module management.
Loads, unloads or reloads an Asterisk module in a running system.

func Monitor

func Monitor(socket *Socket, actionID, channel, file, format string, mix bool) (map[string]string, error)

Monitor

Monitor a channel.
This action may be used to record the audio on a specified channel.

func Originate

func Originate(socket *Socket, actionID string, originate OriginateData) (map[string]string, error)

Originate

Originate a call.
Generates an outgoing call to a Extension/Context/Priority or Application/Data

func Park

func Park(socket *Socket, actionID, channel1, channel2 string, timeout int, parkinglot string) (map[string]string, error)

Park

Park a channel.

func ParkedCalls

func ParkedCalls(socket *Socket, actionID string) ([]map[string]string, error)

ParkedCalls

List parked calls.

func PauseMonitor

func PauseMonitor(socket *Socket, actionID, channel string) (map[string]string, error)

PauseMonitor

Pause monitoring of a channel.
This action may be used to temporarily stop the recording of a channel.

func Ping

func Ping(socket *Socket, actionID string) (bool, error)

Ping

A 'Ping' action will ellicit a 'Pong' response.
Used to keep the manager connection open.

func PlayDTMF

func PlayDTMF(socket *Socket, actionID, channel, digit string) (map[string]string, error)

PlayDTMF

Play DTMF signal on a specific channel.

func QueueAdd

func QueueAdd(socket *Socket, actionID string, queueData QueueData) (map[string]string, error)

QueueAdd

Add interface to queue.

func QueueLog

func QueueLog(socket *Socket, actionID string, queueData QueueData) (map[string]string, error)

QueueLog

Adds custom entry in queue_log.

func QueuePause

func QueuePause(socket *Socket, actionID string, queueData QueueData) (map[string]string, error)

QueuePause

Makes a queue member temporarily unavailable.

func QueuePenalty

func QueuePenalty(socket *Socket, actionID string, queueData QueueData) (map[string]string, error)

QueuePenalty

Set the penalty for a queue member.

func QueueReload

func QueueReload(socket *Socket, actionID string, queueData QueueData) (map[string]string, error)

QueueReload

Reload a queue, queues, or any sub-section of a queue or queues.

func QueueRemove

func QueueRemove(socket *Socket, actionID string, queueData QueueData) (map[string]string, error)

QueueRemove

Remove interface from queue.

func QueueReset

func QueueReset(socket *Socket, actionID, queue string) (map[string]string, error)

QueueReset

Reset queue statistics.

func QueueRule

func QueueRule(socket *Socket, actionID, rule string) (map[string]string, error)

QueueRule

Queue Rules.

func QueueStatus

func QueueStatus(socket *Socket, actionID, queue, member string) (map[string]string, error)

QueueStatus

Show queue status.

func QueueSummary

func QueueSummary(socket *Socket, actionID, queue string) (map[string]string, error)

QueueSummary

Show queue summary.

func Redirect

func Redirect(socket *Socket, actionID, channel, exten, context, priority string) (map[string]string, error)

Redirect

Redirect (transfer) a call.

func Reload

func Reload(socket *Socket, actionID, module string) (map[string]string, error)

Reload

Send a reload event.

func SIPnotify

func SIPnotify(socket *Socket, actionID string, channel string, variable string) (map[string]string, error)

SIPnotify

Send a SIP notify

func SIPpeers

func SIPpeers(socket *Socket, actionID string) ([]map[string]string, error)

SIPPeers

Lists SIP peers in text format with details on current status.
Peerlist will follow as separate events, followed by a final event called PeerlistComplete

func SIPqualifypeer

func SIPqualifypeer(socket *Socket, actionID string, peer string) (map[string]string, error)

SIPqualifypeer

Qualify SIP peers.

func SIPshowpeer

func SIPshowpeer(socket *Socket, actionID string, peer string) (map[string]string, error)

SIPshowpeer

Show one SIP peer with details on current status.

func SIPshowregistry

func SIPshowregistry(socket *Socket, actionID string) (map[string]string, error)

SIPshowregistry

Show SIP registrations (text format).

func SKINNYdevices

func SKINNYdevices(socket *Socket, actionID string) ([]map[string]string, error)
 SKINNYdevices
		List SKINNY devices (text format).
		Lists Skinny devices in text format with details on current status.
		Devicelist will follow as separate events,
		followed by a final event called DevicelistComplete.

func SKINNYlines

func SKINNYlines(socket *Socket, actionID string) ([]map[string]string, error)

SKINNYlines

List SKINNY lines (text format).
Lists Skinny lines in text format with details on current status.
Linelist will follow as separate events,
followed by a final event called LinelistComplete.

func SKINNYshowdevice

func SKINNYshowdevice(socket *Socket, actionID, device string) (map[string]string, error)

SKINNYshowdevice

Show SKINNY device (text format).
Show one SKINNY device with details on current status.

func SKINNYshowline

func SKINNYshowline(socket *Socket, actionID, line string) (map[string]string, error)

SKINNYshowline

Show SKINNY line (text format).
Show one SKINNY line with details on current status.

func SendText

func SendText(socket *Socket, actionID, channel, msg string) (map[string]string, error)

SendText

Send text message to channel.

func Setvar

func Setvar(socket *Socket, actionID, channel, variable, value string) (map[string]string, error)

Setvar

Set a channel variable.
Set a global or local channel variable.
Note:	If a channel name is not provided then the variable is global.

func ShowDialPlan

func ShowDialPlan(socket *Socket, actionID, extension, context string) (map[string]string, error)

ShowDialPlan

Show dialplan contexts and extensions
Be aware that showing the full dialplan may take a lot of capacity

func Status

func Status(socket *Socket, actionID, channel, variables string) (map[string]string, error)

Status

List channel status.
Will return the status information of each channel along with the value for the specified channel variables.

func StopMonitor

func StopMonitor(socket *Socket, actionID, channel string) (map[string]string, error)

StopMonitor

Stop monitoring a channel.
This action may be used to end a previously started 'Monitor' action.

func UnpauseMonitor

func UnpauseMonitor(socket *Socket, actionID, channel string) (map[string]string, error)

UnpauseMonitor

Unpause monitoring of a channel.
This action may be used to re-enable recording of a channel after calling PauseMonitor.

func VersionInfo

func VersionInfo() string

Types

type AOCData

type AOCData struct {
	Channel                   string
	ChannelPrefix             string
	MsgType                   string
	ChargeType                string
	UnitAmount                string
	UnitType                  string
	CurrencyName              string
	CurrencyAmount            string
	CurrencyMultiplier        string
	TotalType                 string
	AocBillingId              string
	ChargingAssociationId     string
	ChargingAssociationNumber string
	ChargingAssociationPlan   string
}

AOCMessage

Generate an Advice of Charge message on a channel.

Channel - Channel name to generate the AOC message on.
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.

MsgType - Defines what type of AOC message to create, AOC-D or AOC-E
	D
	E

ChargeType - Defines what kind of charge this message represents.
	NA
	FREE
	Currency
	Unit

UnitAmount(0) -	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.

UnitType(0) -	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.
CurrencyName - Specifies the currency's name. Note that this value is truncated after 10 characters.
CurrencyAmount - Specifies the charge unit amount as a positive integer. This value is required when ChargeType==Currency.

CurrencyMultiplier - Specifies the currency multiplier. This value is required when ChargeType==Currency.
	OneThousandth
	OneHundredth
	OneTenth
	One
	Ten
	Hundred
	Thousand

TotalType - Defines what kind of AOC-D total is represented.
	Total
	SubTotal

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
	Normal
	ReverseCharge
	CreditCard
	CallFwdUnconditional
	CallFwdBusy
	CallFwdNoReply
	CallDeflection
	CallTransfer

ChargingAssociationId - 	Charging association identifier. This is optional for AOC-E and can be set to any value between -32768 and 32767
ChargingAssociationNumber -	Represents the charging association party number. This value is optional for AOC-E.
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.

type OriginateData

type OriginateData struct {
	Channel     string
	Exten       string
	Context     string
	Priority    int
	Application string
	Data        string
	Timeout     int
	Callerid    string
	Variable    string
	Account     string
	Async       string
	Codecs      string
}

Originate

Originate a call.
Generates an outgoing call to a Extension/Context/Priority or Application/Data

Channel - Channel name to call.
Exten - Extension to use (requires Context and Priority)
Context - Context to use (requires Exten and Priority)
Priority - Priority to use (requires Exten and Context)
Application - Application to execute.
Data - Data to use (requires Application).
Timeout - How long to wait for call to be answered (in ms.).
CallerID - Caller ID to be set on the outgoing channel.
Variable - Channel variable to set, multiple Variable: headers are allowed.
Account - Account code.
Async - Set to true for fast origination.
Codecs - Comma-separated list of codecs to use for this call.

type QueueData

type QueueData struct {
	Queue          string
	Interface      string
	Penalty        string
	Paused         string
	MemberName     string
	StateInterface string
	Event          string
	Uniqueid       string
	Message        string
	Reason         string
	Members        string
	Rules          string
	Parameters     string
}

type Socket

type Socket struct {
	// contains filtered or unexported fields
}

func NewSocket

func NewSocket(address string) (*Socket, error)

func (*Socket) Connect

func (self *Socket) Connect() error

func (*Socket) Connected

func (self *Socket) Connected() bool

func (*Socket) Disconnect

func (self *Socket) Disconnect() error

func (*Socket) Recv

func (self *Socket) Recv() (string, error)

func (*Socket) Send

func (self *Socket) Send(format string, a ...interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL