Method | Description | |
---|---|---|
__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. |
Method | Description | |
---|---|---|
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). |
Method | Description | |
---|---|---|
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. |
public __construct ( array $options ) | ||
$options | array | Options for ami client. |
protected findResponse ( PAMI\Message\IncomingMessage $message ) : PAMI\Message\Response\ResponseMessage | ||
$message | PAMI\Message\IncomingMessage | Message sent by asterisk. |
return | PAMI\Message\Response\ResponseMessage |
protected getMessages ( ) : string[] | ||
return | string[] |
protected getRelated ( PAMI\Message\OutgoingMessage $message ) : PAMI\Message\IncomingMessage | ||
$message | PAMI\Message\OutgoingMessage | |
return | PAMI\Message\IncomingMessage |
public process ( ) |
public send ( PAMI\Message\OutgoingMessage $message ) : PAMI\Message\Response\ResponseMessage | ||
$message | PAMI\Message\OutgoingMessage | Message to send. |
return | PAMI\Message\Response\ResponseMessage |
public unregisterEventListener ( string $listenerId ) : void | ||
$listenerId | string | The id returned by registerEventListener. |
return | void |