Compare the specified Shift8 version string $version with the current version of Shift8. Function taken from Zend Framework
static
boolean
compareVersion
(string $version)
-
string
$version: A version string (e.g. "0.7.1").
Returns the version of the Shift8 library
static
string
getVersion
()
Class constructor.
All variables are optional and can be passed to the Login() call
-
string
$ajam: The remote ajam interface.
-
string
$manager: The username of the manager to login
-
string
$secret: The password of the manager
-
Shift8_Event_Listener
$eventListener: Adds an event listener to this instance of the Shift8 with name 'default'
-
Shift8_Debug_Listener
$debugListener: Adds a debug listener to this instance of the Shift8 with name 'default'
Adds a new command to the queue of commands to be executed on the remote asterisk server.
integer
addCommandToQueue
(string $command, array $arguments)
-
string
$command
-
array
$arguments
Adds a new event listener to the library. The listener is defined by the name specified. If the name passed already exists on the system, the listener will not be added.
Allows you to write your own events into the queue log
boolean
addQueueLog
(string $queue, integer $unique_id, string $interface, string $event, string $message)
-
string
$queue: The queue to write the event for
-
integer
$unique_id: The unique id for the queue log
-
string
$interface: The interface for the log
-
string
$event: The actual event that needs to be recorded
-
string
$message: The message to log in the queue log
Add a new command to execute by the Async AGI application
boolean
AGI
(string $channel, string $command, string $command_id)
-
string
$channel: The channel to execute the command at
-
string
$command: The command to execute
-
string
$command_id: The command id
Allow command to be queued.
boolean
allowCommandToBeQueued
(string $command)
-
string
$command: The command to be allowed
Attended transfer
boolean
attendedTransfer
(string $channel, string $exten, string $context, integer $priority)
-
string
$channel
-
string
$exten
-
string
$context
-
integer
$priority
Bridge channels together
boolean
bridge
(string $channelA, string $channelB, [string|boolean $tone = false])
-
string
$channelA: The first channel to bridge
-
string
$channelB: The second channel to bridge
-
string|boolean
$tone: Play a tone to the bridged channels. Not required
Generate Challenge for MD5 Auth
Shift8_Event[]
challenge
()
Change monitoring filename of a channel. Has no effect if the channel is not monitored
boolean
changeMonitor
(string $channel, string $file)
-
string
$channel: Used to specify the channel to record
-
string
$file: Is the new name of the file created in the monitor spool directory
Changes the paused status of an interface.
boolean
changeQueuePaused
( $interface, integer $paused, string $inteface)
-
string
$inteface: The interface to change the status
-
integer
$paused: The paused value. 1 for Paused, 0 for Unpaused
-
$interface
A 'CreateConfig' action will create an empty file in the configuration directory.
This action is intended to be used before an UpdateConfig action.
boolean
createConfigurationFile
(string $filename)
-
string
$filename: The filename to create
Removes database key/value
boolean
DBDel
(string $family, string $key)
-
string
$family
-
string
$key
Removes database keytree/values
boolean
DBDelTree
(string $family, [string|boolean $key = false])
-
string
$family
-
string|boolean
$key
Gets a database value
Shift8_Event[]
DBGet
(string $family, string $key)
-
string
$family
-
string
$key
Adds / updates a database value
boolean
DBPut
(string $family, string $key, [string|boolean $value = false])
-
string
$family
-
string
$key
-
string|boolean
$value
Disallow a command from being queued
boolean
disallowCommandToBeQueued
(string $command)
-
string
$command: The command to disallow
Enable/Disable sending of events to this manager client.
boolean
events
(string $eventMask)
-
string
$eventMask: The event mask to apply to this manager client
Run a CLI command
Shift8_Event[]
executeCommand
(string $command)
-
string
$command: Asterisk CLI command to run
List currently defined channels and some information about them.
Shift8_Event[]
getActiveChannels
()
Lists agents and their status
Shift8_Event[]
getAgents
()
Get the value of a global or local channel variable
Shift8_Event[]
getChannelVariable
(string $variable, [string $channel = false])
-
string
$variable: Variable name
-
string
$channel: Channel to read variable from
A 'GetConfig' action will dump the contents of a configuration file by category and contents or optionally by specified category only
Shift8_Event[]
getConfig
(string $filename, [string $category = false])
-
string
$filename: Configuration filename (e.g. foo.conf)
-
string
$category: Category in configuration file
A 'GetConfigJSON' 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.
Shift8_Event[]
getConfigJson
(string $filename)
-
string
$filename: Configuration filename (e.g. foo.conf)
Retrieves the asterisk cookie.
This can be used to set the cookie value to a PHP session so as to establish a permanent connection between a web application and the Asterisk AJAM interface. Don't forget to close the session since php sessions are locking
string
getCookie
()
Show PBX core settings information
Shift8_Event[]
getCoreSettings
()
Show PBX core status information
Shift8_Event[]
getCoreStatusVariables
()
Show dialplan extensions
Shift8_Event[]
getDialplan
()
Report the extension state for given extension. If the extension has a hint, will use devicestate to check the status of the device connected to the extension.
Shift8_Event[]
getExtensionState
(string $exten, string $context)
-
string
$exten: Extension to check state on
-
string
$context: Context for extension
Retrieve the IAX Net stats
Shift8_Event[]
getIAXNetStats
()
Retrieves the IAX Peers from the remote asterisk server
Shift8_Event[]
getIAXPeerList
()
Retrieves the IAX Peers from the remote asterisk server
Shift8_Event[]
getIAXPeers
()
Returns the last error that has occurred in the communication with the remote asterisk
string
getLastError
()
Checks a voicemail account for new messages.
integer
getMailboxCount
(string $mailbox)
-
string
$mailbox: Full mailbox ID <mailbox>@<vm-context>
Checks a voicemail account for status
Shift8_Event[]
getMailboxStatus
(string $mailbox)
-
string
$mailbox: Full mailbox ID <mailbox>@<vm-context>
List parked calls
Shift8_Event[]
getParkedCalls
()
Retrieve the result from a queued command
Shift8_Event[]
getQueuedCommandResponse
(integer $queue_id)
Returns the active queue processor.
Get a queue rule
Shift8_Event[]
getQueueRule
(string $rule)
-
string
$rule: The queue rule to get
Get the queues from the remote asterisk server
Shift8_Event[]
getQueues
()
Retrieves the status from the Queues mechanism. It can retrieve either the status for all the Queues or the status for a specific queue/queue member
Shift8_Event[]
getQueueStatus
([string $queue = false], [string $member = false])
-
string
$queue: The queue to retrieve status for. (Optional)
-
string
$member: The member to retrieve status for. (Optional)
Retrieves the Queue summary for a specific queue if one has been defined, or for the entire system
Shift8_Event[]
getQueueSummary
([string $queue = false])
-
string
$queue: The queue to get the summary for. If not specified the summary for all the queues is returned
Get a SIP Peer from the remote asterisk as specified by $peer
-
string
$peer: The peer to get information for
Retrieve the SIP Peers from the remote asterisk server
Shift8_Event[]
getSipPeers
()
Retrieves the SIP Registry from the remote Asterisk server
Shift8_Event[]
getSipRegistry
()
Lists channel status along with requested channel vars
Shift8_Event[]
getStatus
([string $channel = false], [string $variables = false])
-
string
$channel: Name of the channel to query for status
-
string
$variables: Comma ',' separated list of variables to include
List All Voicemail User Information
Shift8_Event[]
getVoicemailUsers
()
Hangup a channel
boolean
hangup
(string $channel)
-
string
$channel: The channel name to be hungup
Checks if Asterisk module is loaded
boolean
isModuleLoaded
(string $module)
-
string
$module: Asterisk module name (not including extension)
A 'ListCategories' action will dump the categories in a given file.
Shift8_Event[]
listCategories
(string $filename)
-
string
$filename: The filename to dump the categories from
Returns the action name and synopsis for every action that is available to the use
Shift8_Event[]
listCommands
()
Loads, unloads or reloads an Asterisk module in a running system.
If no module is specified for a reload loadtype, all modules are reloaded
boolean
loadModule
([boolean|string $module = false], [string $loadType = 'reload'])
-
boolean|string
$module: Asterisk module name (not including extension) or subsystem identifier: cdr, enum, dnsmgr, extconfig, manager, rtp, http
-
string
$loadType: load | unload | reload The operation to be done on module
Logins to the remote asterisk server All arguments are optional and can be defined per instance on the class instanciation
boolean
login
([string $ajam = false], [string $manager = false], [string $secret = false])
-
string
$ajam: The remote ajam interface.
-
string
$manager: The username of the manager to login
-
string
$secret: The password of the manager
Logs off from the remote asterisk server
boolean
logoff
()
The 'Monitor' action may be used to record the audio on a specified channel.
boolean
monitor
(string $channel, [string $file = false], [string $format = false], [boolean $mix = false])
-
string
$channel: Used to specify the channel to record
-
string
$file: Is the name of the file created in the monitor spool directory. Defaults to the same name as the channel (with slashes replaced with dashes)
-
string
$format: Is the audio recording format. Defaults to wav
-
boolean
$mix: Boolean parameter as to whether to mix the input and output channels together after the recording is finished
Send debug messages to all Debug Listeners
boolean
notifyDebugListeners
(mixed $message)
Notify all event listeners when a event has occurred.
Generates an outgoing call to a Extension/Context/Priority or Application/Data
boolean
originate
(string $channel, [string $exten = false], [string $context = false], [string $priority = false], [string $application = false], [string $data = false], [string $timeout = 30000], [string $callerID = false], [string $variable = false], [string $account = false], [string $async = true], [string $codecs = false])
-
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')
-
string
$timeout: How long to wait for call to be answered (in ms. Default: 30000)
-
string
$callerID: Caller ID to be set on the outgoing channel
-
string
$variable: Channel variable to set, multiple Variable: headers are allowed
-
string
$account: Account code
-
string
$async: Set to 'true' for fast origination
-
string
$codecs: The codecs to use
Park a channel
boolean
park
(string $channelA, string $channelB, [integer|boolean $timeout = false])
-
string
$channelA
-
string
$channelB
-
integer|boolean
$timeout
The 'PauseMonitor' action may be used to temporarily stop the recording of a channel
boolean
pauseMonitor
(string $channel)
-
string
$channel: The channel to pause monitor
Performs an agent pause on the interface
boolean
pauseQueueInterface
(string $interface)
-
string
$interface: The interface to pause
Pings the remote asterisk server. Keeps the remote connection alive
boolean
ping
()
Plays a dtmf digit on the specified channel
boolean
playDTMF
(string $dtmf, string $channel)
-
string
$dtmf: The dtmf digit to play
-
string
$channel: Channel name to send digit to
Processes the commands actively in the Shift8 queue
boolean
processCommandQueue
()
Handles the processing of the return events by the asterisk server creating PHP objects for each one of them
Shift8_Event[]
processEvents
(SimpleXMLElement $events)
Handles all the proxying of requests to the remote asterisk server.
SimpleXMLElement
proxy
(string $url, array $parameters)
-
string
$url
-
array
$parameters
Adds a new interface in the Queue
boolean
queueAddInterface
(string $queue, string $interface, [string $member = false], [int $penalty = 0], [boolean $paused = false])
-
string
$queue: The queue to add the interface to
-
string
$interface: The interface to add to the queue
-
string
$member: The member name for this interface
-
int
$penalty: The penalty for this agent
-
boolean
$paused: Whether the agent will be paused on login
Remove an interface from the Queue
boolean
queueRemoveInterface
(string $queue, string $interface)
-
string
$queue: The queue to remove the interface from
-
string
$interface: The interface to remove from the queue
Redirect (transfer) a call
boolean
redirect
(string $channel, [string $extraChannel = false], string $exten, string $context, integer $priority)
-
string
$channel: Channel to redirect
-
string
$extraChannel: Second call leg to transfer (optional)
-
string
$exten: Extension to transfer to
-
string
$context: Context to transfer to
-
integer
$priority: Priority to transfer to
Send a reload event. Works the same as sending a ModuleLoad event (reload) without specifying any modules
boolean
reload
()
Removes a debug listener
boolean
removeDebugListener
(string $name)
Removes an event listener from the library.
boolean
removeEventListener
(string $name)
Send a message to a Jabber Channel
boolean
sendMessageToJabberChannel
(string $jabber, string $screenName, string $message)
-
string
$jabber: Client or transport Asterisk uses to connect to JABBER
-
string
$screenName: User Name to message.
-
string
$message: Message to be sent to the buddy
Sends A Text Message while in a call
boolean
sendText
(string $channel, string $message)
-
string
$channel: Channel to send message to
-
string
$message: Message to send
Send an event to manager sessions
boolean
sendUserEvent
(string $userEvent)
-
string
$userEvent: Event string to send
Sends a SIP Notify message to a peer
boolean
sentSIPNotify
(string $channel)
-
string
$channel: The channel to sent the notify
Hangup a channel after a certain time.
boolean
setAbsoluteTimeout
(string $channel, integer $timeout)
-
string
$channel: Channel name to hangup
-
integer
$timeout: Maximum duration of the call (sec)
Get the value of a global or local channel variable
Shift8_Event[]
setChannelVariable
(string $variable, string $value, [string $channel = false])
-
string
$variable: Variable name
-
string
$value: Value
-
string
$channel: Channel to read variable from
Sets the cookie to be used for the connection with the remote asterisk server.
void
setCookie
(string $cookie)
-
string
$cookie: The cookie from an already established connection to a remote asterisk server
Sets the last error message
void
setLastError
(SimpleXMLElement $message)
-
SimpleXMLElement
$message: The last message occurred
Sets the Queue Penalty for a member
boolean
setQueueMemberPenalty
(string $member, string $queue, integer $penalty)
-
string
$member: The queue member to set the penalty
-
string
$queue: The queue this member
-
integer
$penalty: The penalty to set
Set the active queue processor.
The processor is responsible for inserting, retrieving and updating the Shift8 Command Queue.
Stops monitoring a channel. Has no effect if the channel is not monitored
boolean
stopMonitor
(string $channel)
-
string
$channel: The channel to stop monitoring
Synonymous for redirect().
void
transfer
( $channel, [ $extraChannel = false], $exten, $context, $priority)
-
$channel
-
$extraChannel
-
$exten
-
$context
-
$priority
Unpauses monitoring of a channel on which monitoring had previously been paused with PauseMonitor.
boolean
unpauseMonitor
(string $channel)
-
string
$channel: The channel to unpause monitor
Performs an agent un-pause on the interface
boolean
unpauseQueueInterface
(string $interface)
-
string
$interface: The interface to unpause
Send a WaitEvent command to remote asterisk and wait for any incoming events
Shift8_Event[]
waitEvent
()