PHP Interface PAGI\Client\IClient

PHP Version 5
Author: Marcelo Gornstein ([email protected])
Afficher le fichier Open project: marcelog/pagi Interface Usage Examples

Méthodes publiques

Méthode Description
amd ( string[] $options ) : AmdResult Runs the AMD() application. For a complete list of options see: https://wiki.asterisk.org/wiki/display/AST/Application_AMD
answer ( ) : void Answers the current channel. Uses agi command "ANSWER".
channelStatus ( string $channel = '' ) : integer Retrieves channel status. Uses agi command "CHANNEL STATUS"
consoleLog ( string $msg ) : void Logs to asterisk console. Uses agi command "VERBOSE".
createNode ( string $name ) : Node Convenient method to create a node.
createNodeController ( string $name ) : NodeController Creates a new node controller.
databaseDel ( string $family, string $key ) : void Deletes an entry in the Asterisk database for a given family and key.
databaseDeltree ( string $family, string $key = false ) : void Deletes a family or specific keytree withing a family in the Asterisk database.
databaseGet ( string $family, string $key ) : string Retrieves an entry in the Asterisk database for a given family and key.
databasePut ( string $family, string $key, string $value ) : void Adds or updates an entry in the Asterisk database for a given family, key, and value.
dial ( string $channel, array $options = [] ) : DialResult Tries to dial the given channel.
exec ( string $application, array $options = [] ) : ExecResult Executes an application. Uses agi command "EXEC".
faxReceive ( string $tiffFile ) : FaxResult Receives a fax.
faxSend ( string $tiffFile ) : FaxResult Sends a fax.
getAsteriskLogger ( ) : PAGI\Logger\Asterisk\IAsteriskLogger Returns an asterisk logger facade.
getCDR ( ) : PAGI\CDR\ICDR Returns a cdr facade.
getCallerId ( ) : ICallerID Returns a caller id facade.
getChannelVariables ( ) : PAGI\ChannelVariables\IChannelVariables Returns an instance of ChannelVariables to access agi variables.
getData ( string $file, integer $maxTime, string $maxDigits ) : PlayResult Reads input from user. Uses agi command "GET DATA".
getFullVariable ( string $name, string $channel = false ) : string Returns a variable value. Uses agi command "GET FULL VARIABLE". False if variable is not set.
getOption ( string $file, string $escapeDigits, integer $maxTime ) : PlayResult Reads input from user. Uses agi command "GET OPTION".
getVariable ( string $name ) : string Returns a variable value. Uses agi command "GET VARIABLE". False if variable is not set.
hangup ( ) : void Hangups the current channel. Uses agi command "HANGUP".
indicateBusy ( integer $timeout ) : ExecResult Indicates busy and waits for hangup. Does not play a busy tone.
indicateCongestion ( integer $timeout ) : ExecResult Indicates congestion and waits for hangup. Does not play a busy tone.
indicateProgress ( ) : ExecResult Indicates progress of a call, starting early audio.
log ( string $msg, string $priority = 'NOTICE' ) : void Logs to asterisk logger. Uses application LOG.
playBusyTone ( ) : ExecResult Plays "Busy" tone, defined in indications.conf
playCongestionTone ( ) : ExecResult Plays "Congestion" tone, defined in indications.conf
playCustomTones ( array $frequencies ) : ExecResult Plays a customized frequency tone.
playDialTone ( ) : ExecResult Plays "Dial" tone, defined in indications.conf
playTone ( string $tone ) : ExecResult Plays a tone defined in indications.conf.
record ( string $file, string $format, string $escapeDigits, integer $maxRecordTime, integer $silence = false ) : PAGI\Client\Result\RecordResult Record to a file until are received as dtmf.
sayAlpha ( string $what, string $escapeDigits = '' ) : PlayResult Say a given character string, returning early if any of the given DTMF digits are received on the channel. Uses agi command "SAY PHONETIC".
sayDate ( integer $time, string $escapeDigits = '' ) : PlayResult Say a given date, returning early if any of the given DTMF digits are received on the channel. Uses agi command "SAY DATE".
sayDateTime ( integer $time, string $format, string $escapeDigits = '' ) : PlayResult Say a given date and time, returning early if any of the given DTMF digits are received on the channel. Uses agi command "SAY DATETIME".
sayDigits ( string $digits, string $escapeDigits = '' ) : PlayResult Says digits. Uses agi command "SAY DIGITS".
sayNumber ( string $digits, string $escapeDigits = '' ) : PlayResult Says a number. Uses agi command "SAY NUMBER".
sayPhonetic ( string $what, string $escapeDigits = '' ) : PlayResult Say a given character string with phonetics, returning early if any of the given DTMF digits are received on the channel.
sayTime ( integer $time, string $escapeDigits = '' ) : PlayResult Says time. Uses agi command "SAY TIME".
sendImage ( string $filename ) : void Sends the given image on a channel. Uses agi command "SEND IMAGE".
sendText ( string $text ) : void Sends the given text on a channel. Uses agi command "SEND TEXT".
setAutoHangup ( integer $time ) : void Cause the channel to automatically hangup at
setCallerId ( string $name, string $number ) : void Changes the callerid of the current channel. Uses agi command "SET CALLERID"
setContext ( string $context ) : void Changes the context for continuation upon exiting the application.
setExtension ( string $extension ) : void Changes the extension for continuation upon exiting the application.
setLogger ( Psr\Log\LoggerInterface $logger ) : void Sets the logger implementation.
setMusic ( boolean $enable, string $class = false ) : void Enables/Disables the music on hold generator. Uses agi command "SET MUSIC".
setPriority ( string $priority ) : void Changes the priority for continuation upon exiting the application.
setVariable ( string $name, string $value ) : void Sets a variable. Uses agi command "SET VARIABLE".
sipHeaderAdd ( string $name, string $value ) : ExecResult Adds a SIP header to the first invite message in a dial command.
sipHeaderRemove ( string $name ) : ExecResult Removes a header previously added with sipHeaderAdd.
stopPlayingTones ( ) : ExecResult Stop playing current played tones.
streamFile ( string $file, string $escapeDigits = '' ) : PlayResult Plays a file, can be interrupted by escapeDigits.
waitDigit ( integer $timeout ) : DigitReadResult Waits up to milliseconds for channel to receive a DTMF digit.

Method Details

amd() public méthode

Runs the AMD() application. For a complete list of options see: https://wiki.asterisk.org/wiki/display/AST/Application_AMD
public amd ( string[] $options ) : AmdResult
$options string[]
Résultat PAGI\Client\Result\AmdResult

answer() public méthode

Answers the current channel. Uses agi command "ANSWER".
public answer ( ) : void
Résultat void

channelStatus() public méthode

Retrieves channel status. Uses agi command "CHANNEL STATUS"
public channelStatus ( string $channel = '' ) : integer
$channel string Optional, channel name.
Résultat integer

consoleLog() public méthode

Logs to asterisk console. Uses agi command "VERBOSE".
public consoleLog ( string $msg ) : void
$msg string Message to log.
Résultat void

createNode() public méthode

Convenient method to create a node.
public createNode ( string $name ) : Node
$name string
Résultat PAGI\Node\Node

createNodeController() public méthode

Creates a new node controller.
public createNodeController ( string $name ) : NodeController
$name string
Résultat PAGI\Node\NodeController

databaseDel() public méthode

Uses agi command "DATABASE DEL".
public databaseDel ( string $family, string $key ) : void
$family string Family for key.
$key string Key name.
Résultat void

databaseDeltree() public méthode

Uses agi command "DATABASE DELTREE".
public databaseDeltree ( string $family, string $key = false ) : void
$family string Family for key.
$key string Optional key name.
Résultat void

databaseGet() public méthode

Uses agi command "DATABASE GET".
public databaseGet ( string $family, string $key ) : string
$family string Family for key.
$key string Key name.
Résultat string

databasePut() public méthode

Uses agi command "DATABASE PUT".
public databasePut ( string $family, string $key, string $value ) : void
$family string Family for key.
$key string Key name.
$value string Value to set.
Résultat void

dial() public méthode

Tries to dial the given channel.
public dial ( string $channel, array $options = [] ) : DialResult
$channel string What to dial.
$options array Dial app options
Résultat PAGI\Client\Result\DialResult

exec() public méthode

Executes an application. Uses agi command "EXEC".
public exec ( string $application, array $options = [] ) : ExecResult
$application string Application name.
$options array Application arguments.
Résultat PAGI\Client\Result\ExecResult

faxReceive() public méthode

Receives a fax.
public faxReceive ( string $tiffFile ) : FaxResult
$tiffFile string Absolute path to a .tiff file.
Résultat PAGI\Client\Result\FaxResult

faxSend() public méthode

Sends a fax.
public faxSend ( string $tiffFile ) : FaxResult
$tiffFile string Absolute path to a .tiff file.
Résultat PAGI\Client\Result\FaxResult

getAsteriskLogger() public méthode

Returns an asterisk logger facade.
public getAsteriskLogger ( ) : PAGI\Logger\Asterisk\IAsteriskLogger
Résultat PAGI\Logger\Asterisk\IAsteriskLogger

getCDR() public méthode

Returns a cdr facade.
public getCDR ( ) : PAGI\CDR\ICDR
Résultat PAGI\CDR\ICDR

getCallerId() public méthode

Returns a caller id facade.
public getCallerId ( ) : ICallerID
Résultat ICallerID

getChannelVariables() public méthode

Returns an instance of ChannelVariables to access agi variables.
public getChannelVariables ( ) : PAGI\ChannelVariables\IChannelVariables
Résultat PAGI\ChannelVariables\IChannelVariables

getData() public méthode

Reads input from user. Uses agi command "GET DATA".
public getData ( string $file, integer $maxTime, string $maxDigits ) : PlayResult
$file string File to play.
$maxTime integer Maximum time between digits before timeout.
$maxDigits string Maximum number of digits expected.
Résultat PAGI\Client\Result\PlayResult

getFullVariable() public méthode

Returns a variable value. Uses agi command "GET FULL VARIABLE". False if variable is not set.
public getFullVariable ( string $name, string $channel = false ) : string
$name string Variable name.
$channel string Optional channel name.
Résultat string

getOption() public méthode

Reads input from user. Uses agi command "GET OPTION".
public getOption ( string $file, string $escapeDigits, integer $maxTime ) : PlayResult
$file string File to play.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
$maxTime integer Maximum time between digits before timeout.
Résultat PAGI\Client\Result\PlayResult

getVariable() public méthode

Returns a variable value. Uses agi command "GET VARIABLE". False if variable is not set.
public getVariable ( string $name ) : string
$name string Variable name.
Résultat string

hangup() public méthode

Hangups the current channel. Uses agi command "HANGUP".
public hangup ( ) : void
Résultat void

indicateBusy() public méthode

Indicates busy and waits for hangup. Does not play a busy tone.
public indicateBusy ( integer $timeout ) : ExecResult
$timeout integer Time in seconds to wait for hangup
Résultat PAGI\Client\Result\ExecResult

indicateCongestion() public méthode

Indicates congestion and waits for hangup. Does not play a busy tone.
public indicateCongestion ( integer $timeout ) : ExecResult
$timeout integer Time in seconds to wait for hangup
Résultat PAGI\Client\Result\ExecResult

indicateProgress() public méthode

Indicates progress of a call, starting early audio.
public indicateProgress ( ) : ExecResult
Résultat PAGI\Client\Result\ExecResult

log() public méthode

Logs to asterisk logger. Uses application LOG.
public log ( string $msg, string $priority = 'NOTICE' ) : void
$msg string Message to log.
$priority string One of ERROR, WARNING, NOTICE, DEBUG, VERBOSE, DTMF
Résultat void

playBusyTone() public méthode

Plays "Busy" tone, defined in indications.conf
public playBusyTone ( ) : ExecResult
Résultat PAGI\Client\Result\ExecResult

playCongestionTone() public méthode

Plays "Congestion" tone, defined in indications.conf
public playCongestionTone ( ) : ExecResult
Résultat PAGI\Client\Result\ExecResult

playCustomTones() public méthode

Plays a customized frequency tone.
public playCustomTones ( array $frequencies ) : ExecResult
$frequencies array Frequencies for the tone: 425/50,0/50 or !950/330,!1400/330,!1800/330,0 etc.
Résultat PAGI\Client\Result\ExecResult

playDialTone() public méthode

Plays "Dial" tone, defined in indications.conf
public playDialTone ( ) : ExecResult
Résultat PAGI\Client\Result\ExecResult

playTone() public méthode

Plays a tone defined in indications.conf.
public playTone ( string $tone ) : ExecResult
$tone string Tone to play
Résultat PAGI\Client\Result\ExecResult

record() public méthode

Uses agi command "RECORD FILE".
public record ( string $file, string $format, string $escapeDigits, integer $maxRecordTime, integer $silence = false ) : PAGI\Client\Result\RecordResult
$file string Target file, without the .wav (or extension chosen).
$format string Format (wav, mp3, etc).
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
$maxRecordTime integer Maximum record time (optional).
$silence integer Maximum time of silence allowed (optional)
Résultat PAGI\Client\Result\RecordResult

sayAlpha() public méthode

Say a given character string, returning early if any of the given DTMF digits are received on the channel. Uses agi command "SAY PHONETIC".
public sayAlpha ( string $what, string $escapeDigits = '' ) : PlayResult
$what string What to say.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

sayDate() public méthode

Say a given date, returning early if any of the given DTMF digits are received on the channel. Uses agi command "SAY DATE".
public sayDate ( integer $time, string $escapeDigits = '' ) : PlayResult
$time integer Unix timestamp.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

sayDateTime() public méthode

Say a given date and time, returning early if any of the given DTMF digits are received on the channel. Uses agi command "SAY DATETIME".
public sayDateTime ( integer $time, string $format, string $escapeDigits = '' ) : PlayResult
$time integer Unix timestamp.
$format string Format the time should be said in.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

sayDigits() public méthode

Says digits. Uses agi command "SAY DIGITS".
public sayDigits ( string $digits, string $escapeDigits = '' ) : PlayResult
$digits string Number to say.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

sayNumber() public méthode

Says a number. Uses agi command "SAY NUMBER".
public sayNumber ( string $digits, string $escapeDigits = '' ) : PlayResult
$digits string Number to say.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

sayPhonetic() public méthode

Uses agi command "SAY PHONETIC".
public sayPhonetic ( string $what, string $escapeDigits = '' ) : PlayResult
$what string What to say.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

sayTime() public méthode

Says time. Uses agi command "SAY TIME".
public sayTime ( integer $time, string $escapeDigits = '' ) : PlayResult
$time integer Unix timestamp.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

sendImage() public méthode

Sends the given image on a channel. Uses agi command "SEND IMAGE".
public sendImage ( string $filename ) : void
$filename string Image absolute path to send.
Résultat void

sendText() public méthode

Sends the given text on a channel. Uses agi command "SEND TEXT".
public sendText ( string $text ) : void
$text string Text to send.
Résultat void

setAutoHangup() public méthode

Of course it can be hungup before then as well. Setting to 0 will cause the autohangup feature to be disabled on this channel. Uses agi command "SET AUTOHANGUP".
public setAutoHangup ( integer $time ) : void
$time integer Time to hangup channel.
Résultat void

setCallerId() public méthode

Changes the callerid of the current channel. Uses agi command "SET CALLERID"
public setCallerId ( string $name, string $number ) : void
$name string CallerId name.
$number string CallerId number.
Résultat void

setContext() public méthode

Uses agi command "SET CONTEXT".
public setContext ( string $context ) : void
$context string New context.
Résultat void

setExtension() public méthode

Uses agi command "SET EXTENSION".
public setExtension ( string $extension ) : void
$extension string New extension.
Résultat void

setLogger() public méthode

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

setMusic() public méthode

Enables/Disables the music on hold generator. Uses agi command "SET MUSIC".
public setMusic ( boolean $enable, string $class = false ) : void
$enable boolean True to enable, false to disable.
$class string If is not specified then the default music on hold class will be used.
Résultat void

setPriority() public méthode

Uses agi command "SET PRIORITY".
public setPriority ( string $priority ) : void
$priority string New priority.
Résultat void

setVariable() public méthode

Sets a variable. Uses agi command "SET VARIABLE".
public setVariable ( string $name, string $value ) : void
$name string Variable name.
$value string Variable value.
Résultat void

sipHeaderAdd() public méthode

Adds a SIP header to the first invite message in a dial command.
public sipHeaderAdd ( string $name, string $value ) : ExecResult
$name string
$value string
Résultat PAGI\Client\Result\ExecResult

sipHeaderRemove() public méthode

Removes a header previously added with sipHeaderAdd.
public sipHeaderRemove ( string $name ) : ExecResult
$name string
Résultat PAGI\Client\Result\ExecResult

stopPlayingTones() public méthode

Stop playing current played tones.
public stopPlayingTones ( ) : ExecResult
Résultat PAGI\Client\Result\ExecResult

streamFile() public méthode

Uses agi command "STREAM FILE"
public streamFile ( string $file, string $escapeDigits = '' ) : PlayResult
$file string File to play, without .wav extension.
$escapeDigits string Optional sequence of digits that can be used to skip the sound.
Résultat PAGI\Client\Result\PlayResult

waitDigit() public méthode

Uses agi command "WAIT FOR DIGIT".
public waitDigit ( integer $timeout ) : DigitReadResult
$timeout integer Milliseconds to wait. -1 to block indefinitely.
Résultat PAGI\Client\Result\DigitReadResult