PHP Class PAGI\Client\AbstractClient

PHP Version 5
Author: Marcelo Gornstein ([email protected])
Inheritance: implements PAGI\Client\IClient
Show file Open project: marcelog/pagi Class Usage Examples

Protected Properties

Property Type Description
$arguments string[] Initial arguments given by the user in the dialplan.
$cdrInstance
$channelVariablesInstance
$clidInstance
$logger Logger PSR-3 logger.
$variables string[] Initial channel variables given by asterisk at start.

Public Methods

Method Description
amd ( $options = [] ) (non-PHPdoc)
answer ( ) (non-PHPdoc)
channelStatus ( $channel = '' ) (non-PHPdoc)
consoleLog ( $msg, $level = 1 ) (non-PHPdoc)
createNode ( $name ) (non-PHPdoc)
createNodeController ( $name ) (non-PHPdoc)
databaseDel ( $family, $key ) (non-PHPdoc)
databaseDeltree ( $family, $key = false ) (non-PHPdoc)
databaseGet ( $family, $key ) (non-PHPdoc)
databasePut ( $family, $key, $value ) (non-PHPdoc)
dial ( $channel, array $options = [] ) (non-PHPdoc)
exec ( $application, array $options = [] ) (non-PHPdoc)
faxReceive ( $tiffFile ) (non-PHPdoc)
faxSend ( $tiffFile ) (non-PHPdoc)
getAsteriskLogger ( ) (non-PHPdoc)
getCDR ( ) (non-PHPdoc)
getCallerId ( ) (non-PHPdoc)
getChannelVariables ( ) (non-PHPdoc)
getData ( $file, $maxTime, $maxDigits ) (non-PHPdoc)
getFullVariable ( $name, $channel = false ) (non-PHPdoc)
getOption ( $file, $escapeDigits, $maxTime ) (non-PHPdoc)
getVariable ( $name ) (non-PHPdoc)
hangup ( $channel = false ) (non-PHPdoc)
indicateBusy ( $timeout ) (non-PHPdoc)
indicateCongestion ( $timeout ) (non-PHPdoc)
indicateProgress ( ) (non-PHPdoc)
log ( $msg, $priority = 'NOTICE' ) (non-PHPdoc)
playBusyTone ( ) (non-PHPdoc)
playCongestionTone ( ) (non-PHPdoc)
playCustomTones ( array $frequencies ) (non-PHPdoc)
playDialTone ( ) (non-PHPdoc)
playTone ( $tone ) (non-PHPdoc)
record ( $file, $format, $escapeDigits, $maxRecordTime, $silence = false ) (non-PHPdoc)
sayAlpha ( $what, $escapeDigits = '' ) (non-PHPdoc)
sayDate ( $time, $escapeDigits = '' ) (non-PHPdoc)
sayDateTime ( $time, $format, $escapeDigits = '' ) (non-PHPdoc)
sayDigits ( $digits, $escapeDigits = '' ) (non-PHPdoc)
sayNumber ( $digits, $escapeDigits = '' ) (non-PHPdoc)
sayPhonetic ( $what, $escapeDigits = '' ) (non-PHPdoc)
sayTime ( $time, $escapeDigits = '' ) (non-PHPdoc)
sendImage ( $filename ) (non-PHPdoc)
sendText ( $text ) (non-PHPdoc)
setAutoHangup ( $time ) (non-PHPdoc)
setCallerId ( $name, $number ) (non-PHPdoc)
setContext ( $context ) (non-PHPdoc)
setExtension ( $extension ) (non-PHPdoc)
setLogger ( Psr\Log\LoggerInterface $logger ) : void Sets the logger implementation.
setMusic ( $enable, $class = false ) (non-PHPdoc)
setPriority ( $priority ) (non-PHPdoc)
setVariable ( $name, $value ) (non-PHPdoc)
sipHeaderAdd ( $name, $value ) (non-PHPdoc)
sipHeaderRemove ( $name ) (non-PHPdoc)
stopPlayingTones ( ) (non-PHPdoc)
streamFile ( $file, $escapeDigits = '' ) (non-PHPdoc)
waitDigit ( $timeout ) (non-PHPdoc)

Protected Methods

Method Description
close ( ) : void Closes the connection to agi.
getResultFromResultString ( unknown_type $text ) : Result Returns a result object given a string (the agi result after executing a command).
isEndOfEnvironmentVariables ( string $line ) : boolean Returns true if the current line marks the end of the environment variables.
open ( ) : void Opens connection to agi. Will also read initial channel variables given by asterisk when launching the agi.
readEnvironmentVariable ( string $line ) : void Will read and save an environment variable as either a variable or an argument.
send ( string $text ) : Result Sends a command to asterisk. Returns an array with: [0] => AGI Result (3 digits) [1] => Command result [2] => Result data.

Private Methods

Method Description
playAndRead ( $cmd )

Method Details

amd() public method

(non-PHPdoc)
public amd ( $options = [] )

answer() public method

(non-PHPdoc)
public answer ( )

channelStatus() public method

(non-PHPdoc)
public channelStatus ( $channel = '' )

close() abstract protected method

Closes the connection to agi.
abstract protected close ( ) : void
return void

consoleLog() public method

(non-PHPdoc)
public consoleLog ( $msg, $level = 1 )

createNode() public method

(non-PHPdoc)
See also: IClient::createNode()
public createNode ( $name )

createNodeController() public method

(non-PHPdoc)
public createNodeController ( $name )

databaseDel() public method

(non-PHPdoc)
public databaseDel ( $family, $key )

databaseDeltree() public method

(non-PHPdoc)
public databaseDeltree ( $family, $key = false )

databaseGet() public method

(non-PHPdoc)
public databaseGet ( $family, $key )

databasePut() public method

(non-PHPdoc)
public databasePut ( $family, $key, $value )

dial() public method

(non-PHPdoc)
public dial ( $channel, array $options = [] )
$options array

exec() public method

(non-PHPdoc)
public exec ( $application, array $options = [] )
$options array

faxReceive() public method

(non-PHPdoc)
public faxReceive ( $tiffFile )

faxSend() public method

(non-PHPdoc)
public faxSend ( $tiffFile )

getAsteriskLogger() public method

(non-PHPdoc)
public getAsteriskLogger ( )

getCDR() public method

(non-PHPdoc)
public getCDR ( )

getCallerId() public method

(non-PHPdoc)
public getCallerId ( )

getChannelVariables() public method

(non-PHPdoc)
public getChannelVariables ( )

getData() public method

(non-PHPdoc)
public getData ( $file, $maxTime, $maxDigits )

getFullVariable() public method

(non-PHPdoc)
public getFullVariable ( $name, $channel = false )

getOption() public method

(non-PHPdoc)
public getOption ( $file, $escapeDigits, $maxTime )

getResultFromResultString() protected method

Returns a result object given a string (the agi result after executing a command).
protected getResultFromResultString ( unknown_type $text ) : Result
$text unknown_type
return PAGI\Client\Result\Result

getVariable() public method

(non-PHPdoc)
public getVariable ( $name )

hangup() public method

(non-PHPdoc)
public hangup ( $channel = false )

indicateBusy() public method

(non-PHPdoc)
See also: IClient::indicateBusy()
public indicateBusy ( $timeout )

indicateCongestion() public method

(non-PHPdoc)
See also: IClient::indicateCongestion()
public indicateCongestion ( $timeout )

indicateProgress() public method

(non-PHPdoc)
See also: IClient::indicateProgress()
public indicateProgress ( )

isEndOfEnvironmentVariables() protected method

Returns true if the current line marks the end of the environment variables.
protected isEndOfEnvironmentVariables ( string $line ) : boolean
$line string
return boolean

log() public method

(non-PHPdoc)
public log ( $msg, $priority = 'NOTICE' )

open() abstract protected method

Opens connection to agi. Will also read initial channel variables given by asterisk when launching the agi.
abstract protected open ( ) : void
return void

playBusyTone() public method

(non-PHPdoc)
See also: IClient::playBusyTone()
public playBusyTone ( )

playCongestionTone() public method

(non-PHPdoc)
See also: IClient::playCongestionTone()
public playCongestionTone ( )

playCustomTones() public method

(non-PHPdoc)
See also: IClient::playCustomTones()
public playCustomTones ( array $frequencies )
$frequencies array

playDialTone() public method

(non-PHPdoc)
See also: IClient::playDialTone()
public playDialTone ( )

playTone() public method

(non-PHPdoc)
See also: IClient::playTone()
public playTone ( $tone )

readEnvironmentVariable() protected method

Will read and save an environment variable as either a variable or an argument.
protected readEnvironmentVariable ( string $line ) : void
$line string
return void

record() public method

(non-PHPdoc)
public record ( $file, $format, $escapeDigits, $maxRecordTime, $silence = false )

sayAlpha() public method

(non-PHPdoc)
public sayAlpha ( $what, $escapeDigits = '' )

sayDate() public method

(non-PHPdoc)
public sayDate ( $time, $escapeDigits = '' )

sayDateTime() public method

(non-PHPdoc)
public sayDateTime ( $time, $format, $escapeDigits = '' )

sayDigits() public method

(non-PHPdoc)
public sayDigits ( $digits, $escapeDigits = '' )

sayNumber() public method

(non-PHPdoc)
public sayNumber ( $digits, $escapeDigits = '' )

sayPhonetic() public method

(non-PHPdoc)
public sayPhonetic ( $what, $escapeDigits = '' )

sayTime() public method

(non-PHPdoc)
public sayTime ( $time, $escapeDigits = '' )

send() abstract protected method

Sends a command to asterisk. Returns an array with: [0] => AGI Result (3 digits) [1] => Command result [2] => Result data.
abstract protected send ( string $text ) : Result
$text string Command
return PAGI\Client\Result\Result

sendImage() public method

(non-PHPdoc)
public sendImage ( $filename )

sendText() public method

(non-PHPdoc)
public sendText ( $text )

setAutoHangup() public method

(non-PHPdoc)
public setAutoHangup ( $time )

setCallerId() public method

(non-PHPdoc)
public setCallerId ( $name, $number )

setContext() public method

(non-PHPdoc)
public setContext ( $context )

setExtension() public method

(non-PHPdoc)
public setExtension ( $extension )

setLogger() public method

Sets the logger implementation.
public setLogger ( Psr\Log\LoggerInterface $logger ) : void
$logger Psr\Log\LoggerInterface The PSR3-Logger
return void

setMusic() public method

(non-PHPdoc)
public setMusic ( $enable, $class = false )

setPriority() public method

(non-PHPdoc)
public setPriority ( $priority )

setVariable() public method

(non-PHPdoc)
public setVariable ( $name, $value )

sipHeaderAdd() public method

(non-PHPdoc)
See also: IClient::sipHeaderAdd()
public sipHeaderAdd ( $name, $value )

sipHeaderRemove() public method

(non-PHPdoc)
See also: IClient::sipHeaderRemove()
public sipHeaderRemove ( $name )

stopPlayingTones() public method

(non-PHPdoc)
See also: IClient::stopPlayingTones()
public stopPlayingTones ( )

streamFile() public method

(non-PHPdoc)
public streamFile ( $file, $escapeDigits = '' )

waitDigit() public method

(non-PHPdoc)
public waitDigit ( $timeout )

Property Details

$arguments protected property

Initial arguments given by the user in the dialplan.
protected string[] $arguments
return string[]

$cdrInstance protected property

protected $cdrInstance

$channelVariablesInstance protected property

protected $channelVariablesInstance

$clidInstance protected property

protected $clidInstance

$logger protected property

PSR-3 logger.
protected Logger $logger
return Logger

$variables protected property

Initial channel variables given by asterisk at start.
protected string[] $variables
return string[]