Permalink
Browse files

added new event listeners to the example and readme

  • Loading branch information...
1 parent 5ebf74f commit 23e5204c2650ea314b5bef177222acec77c8013f @marcelog committed Feb 5, 2012
Showing with 33 additions and 0 deletions.
  1. +25 −0 README
  2. +8 −0 docs/examples/quickstart/example.php
View
@@ -44,6 +44,31 @@ Asterisk versions supported
PAMI is tested in asterisk 1.6 versions, just because this is the version
I use in my boxes. If you need support for other versions, please contact me.
--------------------------------------------------------------------------------
+QuickStart
+==========
+$options = array(
+ 'log4php.properties' => RESOURCES_DIR . DIRECTORY_SEPARATOR . 'log4php.properties',
+ 'host' => '2.3.4.5',
+ 'scheme' => 'tcp://',
+ 'port' => 9999,
+ 'username' => 'asd',
+ 'secret' => 'asd',
+ 'connect_timeout' => 10,
+ 'read_timeout' => 10
+);
+$client = new \PAMI\Client\Impl\ClientImpl($options);
+
+// Registering a closure
+$client->registerEventListener(function ($event) {
+});
+
+// Register a specific method of an object for event listening
+$client->registerEventListener(array($listener, 'handle'));
+
+// Register an IEventListener:
+$client->registerEventListener($listener);
+
+--------------------------------------------------------------------------------
Example
=======
Please see docs/examples/quickstart/example.php for a very basic example.
@@ -159,6 +159,14 @@ public function handle(EventMessage $event)
'scheme' => 'tcp://' // try tls://
);
$a = new ClientImpl($options);
+ // Registering a closure
+ //$client->registerEventListener(function ($event) {
+ //});
+
+ // Register a specific method of an object for event listening
+ //$client->registerEventListener(array($listener, 'handle'));
+
+ // Register an IEventListener:
$a->registerEventListener(new A());
$a->open();
/*

0 comments on commit 23e5204

Please sign in to comment.