1. Go to this page and download the library: Download thomasvargiu/pami-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thomasvargiu / pami-module example snippets
return [
'pami_module' => [
'connection' => [
'default' => [
'host' => '', // IP or hostname of asterisk server
'port' => 5038, // (optional) Asterisk AMI port (default: 5038)
'username' => '', // Username for asterisk AMI
'secret' => '', // Password for asterisk AMI
'scheme' => 'tcp://', // (optional) Connection scheme (default: tcp://)
'connect_timeout' => 10000, // (optional) Connection timeout in ms (default: 10000)
'read_timeout' => 10000 // (optional) Read timeout in ms (default: 10000)
]
],
'client' => [
'default' => []
]
]
]
use PamiModule\Service\Client;
use PAMI\Client\Impl\ClientImpl;
// Getting the PamiModule client
/** @var Client $client */
$client = $serviceLocator->get('pami.client.default');
use PamiModule\Service\Client;
use PamiModule\Event\PamiEvent;
/* @var Client $client */
$client = $serviceLocator->get('pami.client.default');
$client->getEventManager()->attach('event.Bridge', function(PamiEvent $event) {
// Getting the client
/* @var Client $client */
$client = $event->getTarget();
// Getting the original Event
/* @var \PAMI\Message\Event\BridgeEvent $pamiEvent */
$pamiEvent = $event->getEvent();
});