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