forked from clue/reactphp-ami
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpeers.php
More file actions
28 lines (19 loc) · 751 Bytes
/
Copy pathpeers.php
File metadata and controls
28 lines (19 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
use Clue\React\Ami\ActionSender;
use Clue\React\Ami\Client;
use Clue\React\Ami\Factory;
use Clue\React\Ami\Protocol\Collection;
require __DIR__ . '/../vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$factory = new Factory($loop);
$target = isset($argv[1]) ? $argv[1] : 'name:password@localhost';
$factory->createClient($target)->then(function (Client $client) use ($loop) {
echo 'Successfully connected' . PHP_EOL;
$collector = new ActionSender($client);
$collector->sipPeers()->then(function (Collection $collection) {
var_dump('result', $collection);
$peers = $collection->getEntryEvents();
echo 'found ' . count($peers) . ' peers' . PHP_EOL;
});
}, 'var_dump');
$loop->run();