PHP Интерфейс PAGI\Client\IClient

PHP Version 5
Автор: Marcelo Gornstein ([email protected])
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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.

Описание методов

amd() публичный Метод

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[]
Результат PAGI\Client\Result\AmdResult

answer() публичный Метод

Answers the current channel. Uses agi command "ANSWER".
public answer ( ) : void
Результат void

channelStatus() публичный Метод

Retrieves channel status. Uses agi command "CHANNEL STATUS"
public channelStatus ( string $channel = '' ) : integer
$channel string Optional, channel name.
Результат integer

consoleLog() публичный Метод

Logs to asterisk console. Uses agi command "VERBOSE".
public consoleLog ( string $msg ) : void
$msg string Message to log.
Результат void

createNode() публичный Метод

Convenient method to create a node.
public createNode ( string $name ) : Node
$name string
Результат PAGI\Node\Node

createNodeController() публичный Метод

Creates a new node controller.
public createNodeController ( string $name ) : NodeController
$name string
Результат PAGI\Node\NodeController

databaseDel() публичный Метод

Uses agi command "DATABASE DEL".
public databaseDel ( string $family, string $key ) : void
$family string Family for key.
$key string Key name.
Результат void

databaseDeltree() публичный Метод

Uses agi command "DATABASE DELTREE".
public databaseDeltree ( string $family, string $key = false ) : void
$family string Family for key.
$key string Optional key name.
Результат void

databaseGet() публичный Метод

Uses agi command "DATABASE GET".
public databaseGet ( string $family, string $key ) : string
$family string Family for key.
$key string Key name.
Результат string

databasePut() публичный Метод

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.
Результат void

dial() публичный Метод

Tries to dial the given channel.
public dial ( string $channel, array $options = [] ) : DialResult
$channel string What to dial.
$options array Dial app options
Результат PAGI\Client\Result\DialResult

exec() публичный Метод

Executes an application. Uses agi command "EXEC".
public exec ( string $application, array $options = [] ) : ExecResult
$application string Application name.
$options array Application arguments.
Результат PAGI\Client\Result\ExecResult

faxReceive() публичный Метод

Receives a fax.
public faxReceive ( string $tiffFile ) : FaxResult
$tiffFile string Absolute path to a .tiff file.
Результат PAGI\Client\Result\FaxResult

faxSend() публичный Метод

Sends a fax.
public faxSend ( string $tiffFile ) : FaxResult
$tiffFile string Absolute path to a .tiff file.
Результат PAGI\Client\Result\FaxResult

getAsteriskLogger() публичный Метод

Returns an asterisk logger facade.
public getAsteriskLogger ( ) : PAGI\Logger\Asterisk\IAsteriskLogger
Результат PAGI\Logger\Asterisk\IAsteriskLogger

getCDR() публичный Метод

Returns a cdr facade.
public getCDR ( ) : PAGI\CDR\ICDR
Результат PAGI\CDR\ICDR

getCallerId() публичный Метод

Returns a caller id facade.
public getCallerId ( ) : ICallerID
Результат ICallerID

getChannelVariables() публичный Метод

Returns an instance of ChannelVariables to access agi variables.
public getChannelVariables ( ) : PAGI\ChannelVariables\IChannelVariables
Результат PAGI\ChannelVariables\IChannelVariables

getData() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

getFullVariable() публичный Метод

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.
Результат string

getOption() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

getVariable() публичный Метод

Returns a variable value. Uses agi command "GET VARIABLE". False if variable is not set.
public getVariable ( string $name ) : string
$name string Variable name.
Результат string

hangup() публичный Метод

Hangups the current channel. Uses agi command "HANGUP".
public hangup ( ) : void
Результат void

indicateBusy() публичный Метод

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
Результат PAGI\Client\Result\ExecResult

indicateCongestion() публичный Метод

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
Результат PAGI\Client\Result\ExecResult

indicateProgress() публичный Метод

Indicates progress of a call, starting early audio.
public indicateProgress ( ) : ExecResult
Результат PAGI\Client\Result\ExecResult

log() публичный Метод

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
Результат void

playBusyTone() публичный Метод

Plays "Busy" tone, defined in indications.conf
public playBusyTone ( ) : ExecResult
Результат PAGI\Client\Result\ExecResult

playCongestionTone() публичный Метод

Plays "Congestion" tone, defined in indications.conf
public playCongestionTone ( ) : ExecResult
Результат PAGI\Client\Result\ExecResult

playCustomTones() публичный Метод

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.
Результат PAGI\Client\Result\ExecResult

playDialTone() публичный Метод

Plays "Dial" tone, defined in indications.conf
public playDialTone ( ) : ExecResult
Результат PAGI\Client\Result\ExecResult

playTone() публичный Метод

Plays a tone defined in indications.conf.
public playTone ( string $tone ) : ExecResult
$tone string Tone to play
Результат PAGI\Client\Result\ExecResult

record() публичный Метод

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)
Результат PAGI\Client\Result\RecordResult

sayAlpha() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

sayDate() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

sayDateTime() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

sayDigits() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

sayNumber() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

sayPhonetic() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

sayTime() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

sendImage() публичный Метод

Sends the given image on a channel. Uses agi command "SEND IMAGE".
public sendImage ( string $filename ) : void
$filename string Image absolute path to send.
Результат void

sendText() публичный Метод

Sends the given text on a channel. Uses agi command "SEND TEXT".
public sendText ( string $text ) : void
$text string Text to send.
Результат void

setAutoHangup() публичный Метод

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.
Результат void

setCallerId() публичный Метод

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.
Результат void

setContext() публичный Метод

Uses agi command "SET CONTEXT".
public setContext ( string $context ) : void
$context string New context.
Результат void

setExtension() публичный Метод

Uses agi command "SET EXTENSION".
public setExtension ( string $extension ) : void
$extension string New extension.
Результат void

setLogger() публичный Метод

Sets the logger implementation.
public setLogger ( Psr\Log\LoggerInterface $logger ) : void
$logger Psr\Log\LoggerInterface The PSR3-Logger
Результат void

setMusic() публичный Метод

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.
Результат void

setPriority() публичный Метод

Uses agi command "SET PRIORITY".
public setPriority ( string $priority ) : void
$priority string New priority.
Результат void

setVariable() публичный Метод

Sets a variable. Uses agi command "SET VARIABLE".
public setVariable ( string $name, string $value ) : void
$name string Variable name.
$value string Variable value.
Результат void

sipHeaderAdd() публичный Метод

Adds a SIP header to the first invite message in a dial command.
public sipHeaderAdd ( string $name, string $value ) : ExecResult
$name string
$value string
Результат PAGI\Client\Result\ExecResult

sipHeaderRemove() публичный Метод

Removes a header previously added with sipHeaderAdd.
public sipHeaderRemove ( string $name ) : ExecResult
$name string
Результат PAGI\Client\Result\ExecResult

stopPlayingTones() публичный Метод

Stop playing current played tones.
public stopPlayingTones ( ) : ExecResult
Результат PAGI\Client\Result\ExecResult

streamFile() публичный Метод

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.
Результат PAGI\Client\Result\PlayResult

waitDigit() публичный Метод

Uses agi command "WAIT FOR DIGIT".
public waitDigit ( integer $timeout ) : DigitReadResult
$timeout integer Milliseconds to wait. -1 to block indefinitely.
Результат PAGI\Client\Result\DigitReadResult