PHP Class PHPDaemon\Clients\Asterisk\Connection

Inheritance: extends PHPDaemon\Network\ClientConnection
Datei anzeigen Open project: kakserpom/phpdaemon

Public Properties

Property Type Description
$EOL EOL
$assertions array Assertion: if more events may follow as response this is a main part or full an action complete event indicating that all data has been sent
$callbacks Stack of callbacks called when response received
$cnt For composite response on action
$instate Input state
$onChallenge Callback. Called when received response on challenge action
$packets Received packets
$secret The password defined in manager interface of server
$state Connection's state
$username The username to access the interface

Public Methods

Method Description
action ( string $action, callable $cb, array $params = null, array $assertion = null ) : void For almost any actions in Action: ListCommands Privilege: depends on $action
coreShowChannels ( callable $cb ) : void Action: CoreShowChannels Synopsis: List currently active channels Privilege: system,reporting,all Description: List currently defined channels and some information about them.
extensionState ( array $params, callable $cb ) : void Action: ExtensionState Synopsis: Get an extension's state.
getConfig ( string $filename, callable $cb ) : void Action: GetConfig Synopsis: Retrieve configuration Privilege: system,config,all Description: A 'GetConfig' action will dump the contents of a configuration file by category and contents or optionally by specified category only.
getConfigJSON ( string $filename, callable $cb ) : void Action: GetConfigJSON Synopsis: Retrieve configuration Privilege: system,config,all Description: 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.
getIaxPeers ( callable $cb ) : void Action: IAXpeerlist Synopsis: List IAX Peers Privilege: system,reporting,all
getSipPeers ( callable $cb ) : void Action: SIPpeers Synopsis: List SIP peers (text format) Privilege: system,reporting,all Description: Lists SIP peers in text format with details on current status.
gracefulShutdown ( ) : boolean Called when the worker is going to shutdown
logoff ( callable $cb = null ) : void Action: Logoff Synopsis: Logoff Manager Privilege: Description: Logoff this manager session Variables: NONE
onConnected ( $cb ) : void Execute the given callback when/if the connection is handshaked
onEvent ( callable $cb ) : void Called when event occured
onFinish ( ) : void Called when session finishes
onRead ( ) : void Called when new data received
onReady ( ) : void Called when the connection is handshaked (at low-level), and peer is ready to recv. data
originate ( array $params, callable $cb ) : void Action: Originate Synopsis: Originate a call Privilege: call,all Description: first the Channel is rung. Then, when that answers, the Extension is dialled within the Context to initiate the other end of the call.
ping ( callable $cb ) : void Action: Ping Description: A 'Ping' action will ellicit a 'Pong' response. Used to keep the manager connection open.
redirect ( array $params, callable $cb ) : void Action: Redirect Synopsis: Redirect (transfer) a call Privilege: call,all Description: Redirect (transfer) a call.
setVar ( string $channel, string $variable, string $value, callable $cb ) : void Action: Setvar Synopsis: Set Channel Variable Privilege: call,all Description: Set a global or local channel variable.
status ( callable $cb, string $channel = null ) : void Action: Status Synopsis: Lists channel status Privilege: system,call,reporting,all Description: Lists channel status along with requested channel vars.

Protected Methods

Method Description
auth ( ) : void Send authentication packet
challenge ( callable $cb ) : void Action: Challenge Synopsis: Generate Challenge for MD5 Auth Privilege:
command ( string $packet, callable $cb, array $assertion = null ) Sends arbitrary command
implodeParams ( array $params ) : string Generate AMI packet string from associative array provided
login ( ) : void Action: Login Synopsis: Login Manager Privilege:

Method Details

action() public method

For almost any actions in Action: ListCommands Privilege: depends on $action
public action ( string $action, callable $cb, array $params = null, array $assertion = null ) : void
$action string Action
$cb callable Callback called when response received
$params array Parameters
$assertion array If more events may follow as response this is a main part or full an action complete event indicating that all data has been sent
return void

auth() protected method

Send authentication packet
protected auth ( ) : void
return void

challenge() protected method

Action: Challenge Synopsis: Generate Challenge for MD5 Auth Privilege:
protected challenge ( callable $cb ) : void
$cb callable
return void

command() protected method

Sends arbitrary command
protected command ( string $packet, callable $cb, array $assertion = null )
$packet string A packet for sending by the connected client to Asterisk
$cb callable Callback called when response received
$assertion array If more events may follow as response this is a main part or full an action complete event indicating that all data has been sent

coreShowChannels() public method

Variables: ActionID: Optional Action id for message matching.
public coreShowChannels ( callable $cb ) : void
$cb callable
return void

extensionState() public method

Description: function can be used to retrieve the state from any hinted extension. Variables: (Names marked with * are required) *Exten: Extension to get state Context: Context for exten ActionID: Optional Action id for message matching.
public extensionState ( array $params, callable $cb ) : void
$params array
$cb callable Callback called when response received
return void

getConfig() public method

Variables: (Names marked with * are required) *Filename: Configuration filename (e.g. foo.conf) Category: Category in configuration file
public getConfig ( string $filename, callable $cb ) : void
$filename string Filename
$cb callable Callback called when response received
return void

getConfigJSON() public method

Variables: Filename: Configuration filename (e.g. foo.conf)
public getConfigJSON ( string $filename, callable $cb ) : void
$filename string Filename
$cb callable Callback called when response received
return void

getIaxPeers() public method

Action: IAXpeerlist Synopsis: List IAX Peers Privilege: system,reporting,all
public getIaxPeers ( callable $cb ) : void
$cb callable Callback called when response received
return void

getSipPeers() public method

Peerlist will follow as separate events, followed by a final event called PeerlistComplete. Variables: ActionID: Action ID for this transaction. Will be returned.
public getSipPeers ( callable $cb ) : void
$cb callable Callback called when response received
return void

gracefulShutdown() public method

Called when the worker is going to shutdown
public gracefulShutdown ( ) : boolean
return boolean Ready to shutdown?

implodeParams() protected method

Generate AMI packet string from associative array provided
protected implodeParams ( array $params ) : string
$params array
return string

login() protected method

Action: Login Synopsis: Login Manager Privilege:
protected login ( ) : void
return void

logoff() public method

Action: Logoff Synopsis: Logoff Manager Privilege: Description: Logoff this manager session Variables: NONE
public logoff ( callable $cb = null ) : void
$cb callable Optional callback called when response received
return void

onConnected() public method

Execute the given callback when/if the connection is handshaked
public onConnected ( $cb ) : void
return void

onEvent() public method

Called when event occured
Deprecation: Replaced with ->bind('event', ...)
public onEvent ( callable $cb ) : void
$cb callable Callback
return void

onFinish() public method

Called when session finishes
public onFinish ( ) : void
return void

onRead() public method

Called when new data received
public onRead ( ) : void
return void

onReady() public method

Called when the connection is handshaked (at low-level), and peer is ready to recv. data
public onReady ( ) : void
return void

originate() public method

Variables: (Names marked with * are required) *Channel: Channel on which to originate the call (The same as you specify in the Dial application command) *Context: Context to use on connect (must use Exten & Priority with it) *Exten: Extension to use on connect (must use Context & Priority with it) *Priority: Priority to use on connect (must use Context & Exten with it) Timeout: Timeout (in milliseconds) for the originating connection to happen(defaults to 30000 milliseconds) *CallerID: CallerID to use for the call Variable: Channels variables to set (max 32). Variables will be set for both channels (local and connected). Account: Account code for the call Application: Application to use on connect (use Data for parameters) Data : Data if Application parameter is used ActionID: Optional Action id for message matching.
public originate ( array $params, callable $cb ) : void
$params array
$cb callable Callback called when response received
return void

ping() public method

Variables: NONE
public ping ( callable $cb ) : void
$cb callable Callback called when response received
return void

redirect() public method

Variables: (Names marked with * are required) *Channel: Channel to redirect ExtraChannel: Second call leg to transfer (optional) *Exten: Extension to transfer to *Context: Context to transfer to *Priority: Priority to transfer to ActionID: Optional Action id for message matching.
public redirect ( array $params, callable $cb ) : void
$params array
$cb callable Callback called when response received
return void

setVar() public method

Variables: (Names marked with * are required) Channel: Channel to set variable for *Variable: Variable name *Value: Value
public setVar ( string $channel, string $variable, string $value, callable $cb ) : void
$channel string
$variable string
$value string
$cb callable
return void

status() public method

Variables: (Names marked with * are required) Channel: Name of the channel to query for status Variables: Comma ',' separated list of variables to include ActionID: Optional ID for this transaction Will return the status information of each channel along with the value for the specified channel variables.
public status ( callable $cb, string $channel = null ) : void
$cb callable
$channel string
return void

Property Details

$EOL public_oe property

EOL
public $EOL

$assertions public_oe property

Assertion: if more events may follow as response this is a main part or full an action complete event indicating that all data has been sent
public array $assertions
return array

$callbacks public_oe property

Stack of callbacks called when response received
public $callbacks

$cnt public_oe property

For composite response on action
public $cnt

$instate public_oe property

Input state
public $instate

$onChallenge public_oe property

Callback. Called when received response on challenge action
public $onChallenge

$packets public_oe property

Received packets
public $packets

$secret public_oe property

The password defined in manager interface of server
public $secret

$state public_oe property

Connection's state
public $state

$username public_oe property

The username to access the interface
public $username