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 ()
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 51)

Config variables

  • access: public
integer $port (line 74)

Port on the server we are connected to

  • access: public
string $server (line 66)

Server we are connected to

  • access: public
mixed $socket = NULL (line 58)

Socket

  • access: public
Methods
Constructor AGI_AsteriskManager (line 98)

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

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

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

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

Execute Command

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

Connect to Asterisk

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

Disconnect

void disconnect ()
Events (line 324)

Enable/Disable sending of events to this manager

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

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

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

Hangup Channel

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

List IAX Peers

void IAXPeers ()
ListCommands (line 387)

List available manager commands

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

Logoff Manager

void Logoff ()
MailboxCount (line 418)

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

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

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

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

List parked calls

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

Ping

void Ping ()
QueueAdd (line 535)

Queue Add

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

Queue Remove

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

Queues

void Queues ()
QueueStatus (line 570)

Queue Status

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

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

Send a request

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

Set the CDR UserField

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

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

Channel Status

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

Stop monitoring a channel

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

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

Dial over Zap channel while offhook

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

Toggle Zap channel Do Not Disturb status OFF

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

Toggle Zap channel Do Not Disturb status ON

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

Hangup Zap Channel

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

Zap Show Channels

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

Transfer Zap Channel

void ZapTransfer (string $zapchannel)
  • string $zapchannel

Documentation generated on Wed, 20 Jul 2005 15:21:21 +0000 by phpDocumentor 1.2.3