Class AGI_AsteriskManager

Description
Variable Summary
 array $config
 integer $port
 string $server
 mixed $socket
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 (mixed $message, [mixed $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)
 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 StopMontor (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
Methods
Constructor AGI_AsteriskManager (line 97)

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 284)

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 (line 774)

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 296)

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.
Command (line 310)

Execute Command

void Command (string $command, [string $actionid = NULL])
  • string $command
  • string $actionid: message matching variable
connect (line 207)

Connect to Asterisk

boolean connect ([string $server = NULL], [string $username = NULL], [string $secret = NULL])
  • string $server
  • string $username
  • string $secret
disconnect (line 265)

Disconnect

void disconnect ()
Events (line 323)

Enable/Disable sending of events to this manager

void Events (string $eventmask)
  • string $eventmask: is either 'on', 'off', or 'system,call,log'
ExtensionState (line 336)

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
GetVar (line 352)

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 (line 365)

Hangup Channel

void Hangup (string $channel)
  • string $channel: The channel name to be hungup
IAXPeers (line 375)

List IAX Peers

void IAXPeers ()
ListCommands (line 386)

List available manager commands

void ListCommands ([string $actionid = NULL])
  • string $actionid: message matching variable
log (line 726)
void log (mixed $message, [mixed $level = 1])
Logoff (line 399)

Logoff Manager

void Logoff ()
MailboxCount (line 417)

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
MailboxStatus (line 436)

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 (line 452)

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 (line 478)

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
ParkedCalls (line 508)

List parked calls

void ParkedCalls ([string $actionid = NULL])
  • string $actionid: message matching variable
process_event (line 793)

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 534)

Queue Add

void QueueAdd (string $queue, string $interface, integer $penalty)
  • string $queue
  • string $interface
  • integer $penalty
QueueRemove (line 548)

Queue Remove

void QueueRemove (string $queue, string $interface)
  • string $queue
  • string $interface
Queues (line 558)

Queues

void Queues ()
QueueStatus (line 569)

Queue Status

void QueueStatus ([string $actionid = NULL])
  • string $actionid: message matching variable
Redirect (line 587)

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 123)

Send a request

  • return: of parameters
array send_request (string $action, [array $parameters = array()])
  • string $action
  • array $parameters
SetCDRUserField (line 601)

Set the CDR UserField

void SetCDRUserField (string $userfield, string $channel, [string $append = NULL])
  • string $userfield
  • string $channel
  • string $append
SetVar (line 616)

Set Channel Variable

void SetVar (string $channel, string $variable, string $value)
  • string $channel: Channel to set variable for
  • string $variable: name
  • string $value
Status (line 628)

Channel Status

void Status (string $channel, [string $actionid = NULL])
  • string $channel
  • string $actionid: message matching variable
StopMontor (line 641)

Stop monitoring a channel

void StopMontor (string $channel)
  • string $channel
wait_response (line 142)

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 653)

Dial over Zap channel while offhook

void ZapDialOffhook (string $zapchannel, string $number)
  • string $zapchannel
  • string $number
ZapDNDoff (line 664)

Toggle Zap channel Do Not Disturb status OFF

void ZapDNDoff (string $zapchannel)
  • string $zapchannel
ZapDNDon (line 675)

Toggle Zap channel Do Not Disturb status ON

void ZapDNDon (string $zapchannel)
  • string $zapchannel
ZapHangup (line 686)

Hangup Zap Channel

void ZapHangup (string $zapchannel)
  • string $zapchannel
ZapShowChannels (line 708)

Zap Show Channels

void ZapShowChannels ([string $actionid = NULL])
  • string $actionid: message matching variable
ZapTransfer (line 697)

Transfer Zap Channel

void ZapTransfer (string $zapchannel)
  • string $zapchannel

Documentation generated on Wed, 16 Nov 2005 12:49:01 -0700 by phpDocumentor 1.3.0RC3