Docs For Class AGI_AsteriskManager

## AGI_AsteriskManager

Description

Asterisk Manager class

- link: http://www.voip-info.org/wiki-Asterisk+config+manager.conf
- link: http://www.voip-info.org/wiki-Asterisk+manager+API
- example: Get information about a sip peer

Located in /phpagi-asmanager.php (line 42)

Variable Summary
array $config
array $event_handlers
AGI $pagi
integer $port
string $server
mixed $socket
boolean $_logged_in
Method Summary
AGI_AsteriskManager AGI_AsteriskManager ([string $config = NULL], [array $optconfig = array()])
void AbsoluteTimeout (string $channel, integer $timeout)
boolean add_event_handler (string $event, string $callback)
void ChangeMonitor (string $channel, string $file)
void Command (string $command, [string $actionid = NULL])
boolean connect ([string $server = NULL], [string $username = NULL], [string $secret = NULL])
void disconnect ()
void Events (string $eventmask)
void ExtensionState (string $exten, string $context, [string $actionid = NULL])
void GetVar (string $channel, string $variable, [string $actionid = NULL])
void Hangup (string $channel)
void IAXPeers ()
void ListCommands ([string $actionid = NULL])
void log ( $message, [ $level = 1])
void Logoff ()
void MailboxCount (string $mailbox, [string $actionid = NULL])
void MailboxStatus (string $mailbox, [string $actionid = NULL])
void Monitor (string $channel, [string $file = NULL], [string $format = NULL], [boolean $mix = NULL])
void Originate (string $channel, [string $exten = NULL], [string $context = NULL], [string $priority = NULL], [string $application = NULL], [string $data = NULL], [integer $timeout = NULL], [string $callerid = NULL], [string $variable = NULL], [string $account = NULL], [boolean $async = NULL], [string $actionid = NULL])
void ParkedCalls ([string $actionid = NULL])
void Ping ()
mixed process_event (array $parameters)
void QueueAdd (string $queue, string $interface, [integer $penalty = 0])
void QueueRemove (string $queue, string $interface)
void Queues ()
void QueueStatus ([string $actionid = NULL])
void Redirect (string $channel, string $extrachannel, string $exten, string $context, string $priority)
array send_request (string $action, [array $parameters = array()])
void SetCDRUserField (string $userfield, string $channel, [string $append = NULL])
void SetVar (string $channel, string $variable, string $value)
void Status (string $channel, [string $actionid = NULL])
void StopMonitor (string $channel)
array wait_response ([boolean $allow_timeout = false])
void ZapDialOffhook (string $zapchannel, string $number)
void ZapDNDoff (string $zapchannel)
void ZapDNDon (string $zapchannel)
void ZapHangup (string $zapchannel)
void ZapShowChannels ([string $actionid = NULL])
void ZapTransfer (string $zapchannel)
Variables
array $config (line 50)

Config variables

- access: public

array $event_handlers (line 89)

Event Handlers

- access: private

AGI $pagi (line 81)

Parent AGI

- access: private

integer $port (line 73)

Port on the server we are connected to

- access: public

string $server (line 65)

Server we are connected to

- access: public

mixed $socket = NULL (line 57)

Socket

- access: public

boolean $_logged_in = FALSE (line 97)

Whether we're successfully logged in

- access: private

Methods
Constructor AGI_AsteriskManager (line 105)

Constructor

AGI_AsteriskManager AGI_AsteriskManager ([string $config = NULL], [array $optconfig = array()])

- string $config: is the name of the config file to parse or a parent agi from which to read the config
- array $optconfig: is an array of configuration vars and vals, stuffed into $this->config['asmanager']

AbsoluteTimeout (line 295)

Set Absolute Timeout

Hangup a channel after a certain time.

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+AbsoluteTimeout

void AbsoluteTimeout (string $channel, integer $timeout)

- string $channel: Channel name to hangup
- integer $timeout: Maximum duration of the call (sec)

add_event_handler (line 785)

Add event handler

Known Events include ( http://www.voip-info.org/wiki-asterisk+manager+events ) Link - Fired when two voice channels are linked together and voice data exchange commences. Unlink - Fired when a link between two voice channels is discontinued, for example, just before call completion. Newexten - Hangup - Newchannel - Newstate - Reload - Fired when the "RELOAD" console command is executed. Shutdown - ExtensionStatus - Rename - Newcallerid - Alarm - AlarmClear - Agentcallbacklogoff - Agentcallbacklogin - Agentlogoff - MeetmeJoin - MessageWaiting - join - leave - AgentCalled - ParkedCall - Fired after ParkedCalls Cdr - ParkedCallsComplete - QueueParams - QueueMember - QueueStatusEnd - Status - StatusComplete - ZapShowChannels - Fired after ZapShowChannels ZapShowChannelsComplete -

- return: sucess

boolean add_event_handler (string $event, string $callback)

- string $event: type or * for default handler
- string $callback: function

ChangeMonitor (line 307)

Change monitoring filename of a channel

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ChangeMonitor

void ChangeMonitor (string $channel, string $file)

- string $channel: the channel to record.
- string $file: the new name of the file created in the monitor spool directory.

Command (line 321)

Execute Command

- link: http://www.voip-info.org/wiki-Asterisk+CLI
- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Command
- example: Get information about a sip peer

void Command (string $command, [string $actionid = NULL])

- string $command
- string $actionid: message matching variable

connect (line 215)

Connect to Asterisk

- return: true on success
- example: Get information about a sip peer

boolean connect ([string $server = NULL], [string $username = NULL], [string $secret = NULL])

- string $server
- string $username
- string $secret

disconnect (line 275)

Disconnect

- example: Get information about a sip peer

void disconnect ()
Events (line 334)

Enable/Disable sending of events to this manager

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Events

void Events (string $eventmask)

- string $eventmask: is either 'on', 'off', or 'system,call,log'

ExtensionState (line 347)

Check Extension Status

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ExtensionState

void ExtensionState (string $exten, string $context, [string $actionid = NULL])

- string $exten: Extension to check state on
- string $context: Context for extension
- string $actionid: message matching variable

GetVar (line 363)

Gets a Channel Variable

- link: http://www.voip-info.org/wiki-Asterisk+variables
- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+GetVar

void GetVar (string $channel, string $variable, [string $actionid = NULL])

- string $channel: Channel to read variable from
- string $variable
- string $actionid: message matching variable

Hangup (line 376)

Hangup Channel

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Hangup

void Hangup (string $channel)

- string $channel: The channel name to be hungup

IAXPeers (line 386)

List IAX Peers

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+IAXpeers

void IAXPeers ()
ListCommands (line 397)

List available manager commands

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ListCommands

void ListCommands ([string $actionid = NULL])

- string $actionid: message matching variable

log (line 737)
void log ( $message, [ $level = 1])

- $message
- $level

Logoff (line 410)

Logoff Manager

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Logoff

void Logoff ()
MailboxCount (line 428)

Check Mailbox Message Count

Returns number of new and old messages. Message: Mailbox Message Count Mailbox: <mailboxid> NewMessages: <count> OldMessages: <count>

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxCount

void MailboxCount (string $mailbox, [string $actionid = NULL])

- string $mailbox: Full mailbox ID <mailbox>@<vm-context>
- string $actionid: message matching variable

MailboxStatus (line 447)

Check Mailbox

Returns number of messages. Message: Mailbox Status Mailbox: <mailboxid> Waiting: <count>

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxStatus

void MailboxStatus (string $mailbox, [string $actionid = NULL])

- string $mailbox: Full mailbox ID <mailbox>@<vm-context>
- string $actionid: message matching variable

Monitor (line 463)

Monitor a channel

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Monitor

void Monitor (string $channel, [string $file = NULL], [string $format = NULL], [boolean $mix = NULL])

- string $channel
- string $file
- string $format
- boolean $mix

Originate (line 489)

Originate Call

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Originate

void Originate (string $channel, [string $exten = NULL], [string $context = NULL], [string $priority = NULL], [string $application = NULL], [string $data = NULL], [integer $timeout = NULL], [string $callerid = NULL], [string $variable = NULL], [string $account = NULL], [boolean $async = NULL], [string $actionid = NULL])

- string $channel: Channel name to call
- string $exten: Extension to use (requires 'Context' and 'Priority')
- string $context: Context to use (requires 'Exten' and 'Priority')
- string $priority: Priority to use (requires 'Exten' and 'Context')
- string $application: Application to use
- string $data: Data to use (requires 'Application')
- integer $timeout: How long to wait for call to be answered (in ms)
- string $callerid: Caller ID to be set on the outgoing channel
- string $variable: Channel variable to set (VAR1=value1|VAR2=value2)
- string $account: Account code
- boolean $async: true fast origination
- string $actionid: message matching variable

ParkedCalls (line 519)

List parked calls

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ParkedCalls

void ParkedCalls ([string $actionid = NULL])

- string $actionid: message matching variable

Ping (line 532)

Ping

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Ping

void Ping ()
process_event (line 804)

Process event

- return: result of event handler or false if no handler was found
- access: private

mixed process_event (array $parameters)

- array $parameters

QueueAdd (line 545)

Queue Add

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueAdd

void QueueAdd (string $queue, string $interface, [integer $penalty = 0])

- string $queue
- string $interface
- integer $penalty

QueueRemove (line 559)

Queue Remove

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueRemove

void QueueRemove (string $queue, string $interface)

- string $queue
- string $interface

Queues (line 569)

Queues

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Queues

void Queues ()
QueueStatus (line 580)

Queue Status

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueStatus

void QueueStatus ([string $actionid = NULL])

- string $actionid: message matching variable

Redirect (line 598)

Redirect

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Redirect

void Redirect (string $channel, string $extrachannel, string $exten, string $context, string $priority)

- string $channel
- string $extrachannel
- string $exten
- string $context
- string $priority

send_request (line 131)

Send a request

- return: of parameters

array send_request (string $action, [array $parameters = array()])

- string $action
- array $parameters

SetCDRUserField (line 612)

Set the CDR UserField

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetCDRUserField

void SetCDRUserField (string $userfield, string $channel, [string $append = NULL])

- string $userfield
- string $channel
- string $append

SetVar (line 627)

Set Channel Variable

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetVar

void SetVar (string $channel, string $variable, string $value)

- string $channel: Channel to set variable for
- string $variable: name
- string $value

Status (line 639)

Channel Status

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Status

void Status (string $channel, [string $actionid = NULL])

- string $channel
- string $actionid: message matching variable

StopMonitor (line 652)

Stop monitoring a channel

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+StopMonitor

void StopMonitor (string $channel)

- string $channel

wait_response (line 150)

Wait for a response

If a request was just sent, this will return the response. Otherwise, it will loop forever, handling events.

- return: of parameters, empty on timeout

array wait_response ([boolean $allow_timeout = false])

- boolean $allow_timeout: if the socket times out, return an empty array

ZapDialOffhook (line 664)

Dial over Zap channel while offhook

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDialOffhook

void ZapDialOffhook (string $zapchannel, string $number)

- string $zapchannel
- string $number

ZapDNDoff (line 675)

Toggle Zap channel Do Not Disturb status OFF

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDoff

void ZapDNDoff (string $zapchannel)

- string $zapchannel

ZapDNDon (line 686)

Toggle Zap channel Do Not Disturb status ON

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDon

void ZapDNDon (string $zapchannel)

- string $zapchannel

ZapHangup (line 697)

Hangup Zap Channel

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapHangup

void ZapHangup (string $zapchannel)

- string $zapchannel

ZapShowChannels (line 719)

Zap Show Channels

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapShowChannels

void ZapShowChannels ([string $actionid = NULL])

- string $actionid: message matching variable

ZapTransfer (line 708)

Transfer Zap Channel

- link: http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapTransfer

void ZapTransfer (string $zapchannel)

- string $zapchannel

Documentation generated on Thu, 30 Sep 2010 02:21:47 -0700 by phpDocumentor 1.4.2