PHP 클래스 PAMI\Client\Impl\ClientImpl

PHP Version 5
저자: Marcelo Gornstein ([email protected])
상속: implements PAMI\Client\IClient
파일 보기 프로젝트 열기: marcelog/pami 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( array $options ) Constructor.
close ( ) : void Closes the connection to ami.
open ( ) : void Opens a tcp connection to ami.
process ( ) Main processing loop. Also called from send(), you should call this in your own application in order to continue reading events and responses from ami.
registerEventListener ( mixed $listener, Closure | null $predicate = null ) : string Registers the given listener so it can receive events. Returns the generated id for this new listener. You can pass in a an IEventListener, a Closure, and an array containing the object and name of the method to invoke. Can specify an optional predicate to invoke before calling the callback.
send ( PAMI\Message\OutgoingMessage $message ) : PAMI\Message\Response\ResponseMessage Sends a message to ami.
setLogger ( Psr\Log\LoggerInterface $logger ) : void Sets the logger implementation.
unregisterEventListener ( string $listenerId ) : void Unregisters an event listener.

보호된 메소드들

메소드 설명
dispatch ( PAMI\Message\IncomingMessage $message ) : void Dispatchs the incoming message to a handler.
findResponse ( PAMI\Message\IncomingMessage $message ) : PAMI\Message\Response\ResponseMessage Tries to find an associated response for the given message.
getMessages ( ) : string[] Reads a complete message over the stream until EOM.
getRelated ( PAMI\Message\OutgoingMessage $message ) : PAMI\Message\IncomingMessage Returns a message (response) related to the given message. This uses the ActionID tag (key).

비공개 메소드들

메소드 설명
messageToEvent ( string $msg ) : PAMI\Message\Event\EventMessage Returns a EventMessage from a raw string that came from asterisk.
messageToResponse ( string $msg ) : PAMI\Message\Response\ResponseMessage Returns a ResponseMessage from a raw string that came from asterisk.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( array $options )
$options array Options for ami client.

close() 공개 메소드

Closes the connection to ami.
public close ( ) : void
리턴 void

dispatch() 보호된 메소드

Dispatchs the incoming message to a handler.
protected dispatch ( PAMI\Message\IncomingMessage $message ) : void
$message PAMI\Message\IncomingMessage Message to dispatch.
리턴 void

findResponse() 보호된 메소드

Tries to find an associated response for the given message.
protected findResponse ( PAMI\Message\IncomingMessage $message ) : PAMI\Message\Response\ResponseMessage
$message PAMI\Message\IncomingMessage Message sent by asterisk.
리턴 PAMI\Message\Response\ResponseMessage

getMessages() 보호된 메소드

Reads a complete message over the stream until EOM.
protected getMessages ( ) : string[]
리턴 string[]

getRelated() 보호된 메소드

Returns a message (response) related to the given message. This uses the ActionID tag (key).
protected getRelated ( PAMI\Message\OutgoingMessage $message ) : PAMI\Message\IncomingMessage
$message PAMI\Message\OutgoingMessage
리턴 PAMI\Message\IncomingMessage

open() 공개 메소드

Opens a tcp connection to ami.
public open ( ) : void
리턴 void

process() 공개 메소드

Main processing loop. Also called from send(), you should call this in your own application in order to continue reading events and responses from ami.
public process ( )

registerEventListener() 공개 메소드

Registers the given listener so it can receive events. Returns the generated id for this new listener. You can pass in a an IEventListener, a Closure, and an array containing the object and name of the method to invoke. Can specify an optional predicate to invoke before calling the callback.
public registerEventListener ( mixed $listener, Closure | null $predicate = null ) : string
$listener mixed
$predicate Closure | null
리턴 string

send() 공개 메소드

Sends a message to ami.
또한 보기: ClientImpl::send()
public send ( PAMI\Message\OutgoingMessage $message ) : PAMI\Message\Response\ResponseMessage
$message PAMI\Message\OutgoingMessage Message to send.
리턴 PAMI\Message\Response\ResponseMessage

setLogger() 공개 메소드

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

unregisterEventListener() 공개 메소드

Unregisters an event listener.
public unregisterEventListener ( string $listenerId ) : void
$listenerId string The id returned by registerEventListener.
리턴 void