PHP Class PAGI\Client\Impl\ClientImpl

PHP Version 5
Author: Marcelo Gornstein ([email protected])
Inheritance: extends PAGI\Client\AbstractClient
Exibir arquivo Open project: marcelog/pagi Class Usage Examples

Public Methods

Method Description
getInstance ( array $options = [] ) : ClientImpl Returns a client instance for this call.

Protected Methods

Method Description
__construct ( array $options = [] ) : void Constructor.
close ( ) : void Closes the connection to agi.
open ( ) : void Opens connection to agi. Will also read initial channel variables given by asterisk when launching the agi.
read ( ) : string Reads input from asterisk.
send ( string $text ) : Result Sends a command to asterisk. Returns an array with: [0] => AGI Result (3 digits) [1] => Command result [2] => Result data.

Method Details

__construct() protected method

Note: The client accepts an array with options. The available options are stdin => Optional. If set, should contain an already open stream from where the client will read data (useful to make it interact with fastagi servers or even text files to mock stuff when testing). If not set, stdin will be used by the client. stdout => Optional. Same as stdin but for the output of the client.
protected __construct ( array $options = [] ) : void
$options array Optional properties.
return void

close() protected method

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

getInstance() public static method

Returns a client instance for this call.
public static getInstance ( array $options = [] ) : ClientImpl
$options array Optional properties.
return ClientImpl

open() protected method

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

read() protected method

Reads input from asterisk.
protected read ( ) : string
return string

send() protected method

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