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']
Set Absolute Timeout
Hangup a channel after a certain time.
void
AbsoluteTimeout
(string $channel, integer $timeout)
-
string
$channel: Channel name to hangup
-
integer
$timeout: Maximum duration of the call (sec)
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 -
boolean
add_event_handler
(string $event, string $callback)
-
string
$event: type or * for default handler
-
string
$callback: function
Change monitoring filename of a channel
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.
Execute Command
void
Command
(string $command, [string $actionid = NULL])
-
string
$command
-
string
$actionid: message matching variable
Connect to Asterisk
boolean
connect
([string $server = NULL], [string $username = NULL], [string $secret = NULL])
-
string
$server
-
string
$username
-
string
$secret
Disconnect
void
disconnect
()
Enable/Disable sending of events to this manager
void
Events
(string $eventmask)
-
string
$eventmask: is either 'on', 'off', or 'system,call,log'
Check Extension Status
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
Gets a Channel Variable
void
GetVar
(string $channel, string $variable, [string $actionid = NULL])
-
string
$channel: Channel to read variable from
-
string
$variable
-
string
$actionid: message matching variable
Hangup Channel
void
Hangup
(string $channel)
-
string
$channel: The channel name to be hungup
List IAX Peers
void
IAXPeers
()
List available manager commands
void
ListCommands
([string $actionid = NULL])
-
string
$actionid: message matching variable
void
log
(mixed $message, [mixed $level = 1])
Logoff Manager
void
Logoff
()
Check Mailbox Message Count
Returns number of new and old messages. Message: Mailbox Message Count Mailbox: <mailboxid> NewMessages: <count> OldMessages: <count>
void
MailboxCount
(string $mailbox, [string $actionid = NULL])
-
string
$mailbox: Full mailbox ID <mailbox>@<vm-context>
-
string
$actionid: message matching variable
Check Mailbox
Returns number of messages. Message: Mailbox Status Mailbox: <mailboxid> Waiting: <count>
void
MailboxStatus
(string $mailbox, [string $actionid = NULL])
-
string
$mailbox: Full mailbox ID <mailbox>@<vm-context>
-
string
$actionid: message matching variable
Monitor a channel
void
Monitor
(string $channel, [string $file = NULL], [string $format = NULL], [boolean $mix = NULL])
-
string
$channel
-
string
$file
-
string
$format
-
boolean
$mix
Originate Call
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
List parked calls
void
ParkedCalls
([string $actionid = NULL])
-
string
$actionid: message matching variable
Queue Add
void
QueueAdd
(string $queue, string $interface, integer $penalty)
-
string
$queue
-
string
$interface
-
integer
$penalty
Queue Remove
void
QueueRemove
(string $queue, string $interface)
-
string
$queue
-
string
$interface
Queue Status
void
QueueStatus
([string $actionid = NULL])
-
string
$actionid: message matching variable
Redirect
void
Redirect
(string $channel, string $extrachannel, string $exten, string $context, string $priority)
-
string
$channel
-
string
$extrachannel
-
string
$exten
-
string
$context
-
string
$priority
Send a request
array
send_request
(string $action, [array $parameters = array()])
-
string
$action
-
array
$parameters
Set the CDR UserField
void
SetCDRUserField
(string $userfield, string $channel, [string $append = NULL])
-
string
$userfield
-
string
$channel
-
string
$append
Set Channel Variable
void
SetVar
(string $channel, string $variable, string $value)
-
string
$channel: Channel to set variable for
-
string
$variable: name
-
string
$value
Channel Status
void
Status
(string $channel, [string $actionid = NULL])
-
string
$channel
-
string
$actionid: message matching variable
Stop monitoring a channel
void
StopMontor
(string $channel)
Wait for a response
If a request was just sent, this will return the response. Otherwise, it will loop forever, handling events.
array
wait_response
([boolean $allow_timeout = false])
-
boolean
$allow_timeout: if the socket times out, return an empty array
Dial over Zap channel while offhook
void
ZapDialOffhook
(string $zapchannel, string $number)
-
string
$zapchannel
-
string
$number
Toggle Zap channel Do Not Disturb status OFF
void
ZapDNDoff
(string $zapchannel)
Toggle Zap channel Do Not Disturb status ON
void
ZapDNDon
(string $zapchannel)
Hangup Zap Channel
void
ZapHangup
(string $zapchannel)
Zap Show Channels
void
ZapShowChannels
([string $actionid = NULL])
-
string
$actionid: message matching variable
Transfer Zap Channel
void
ZapTransfer
(string $zapchannel)