File | Date | Author | Commit |
---|---|---|---|
src | 2015-06-26 |
![]() |
[248bdb] Added configs for functional tests |
.gitignore | 2015-01-25 |
![]() |
[031aaa] package updates |
LICENSE | 2015-01-16 |
![]() |
[5163d3] Initial commit |
README.md | 2015-06-26 |
![]() |
[0d82aa] Doc update |
TODO.md | 2015-03-09 |
![]() |
[03a8e8] TODO |
composer.json | 2015-06-26 |
![]() |
[b35faa] Composer update |
phpunit.xml | 2015-06-26 |
![]() |
[892849] Added phpunit configuration |
phpunit_bootstrap.php | 2015-06-26 |
![]() |
[892849] Added phpunit configuration |
Framework for creating Asterisk 12/13 ARI applications. (https://wiki.asterisk.org/wiki/display/AST/Getting+Started+with+ARI)
1.X to 2.X
Client class has been replaced with Phparia class with renamed methods
getStasisApplication() => getStasisApplicationName()
getStasisClient() => getWsClient()
getStasisLoop() => getEventLoop()
Just add the package "wormling/phparia":
{
"require": {
"wormling/phparia": "dev-master"
}
}
$ariAddress = 'ws://localhost:8088/ari/events?api_key=username:password&app=stasis_app_name';
$logger = new \Zend\Log\Logger();
$logWriter = new \Zend\Log\Writer\Stream("php://output");
$logger->addWriter($logWriter);
//$filter = new \Zend\Log\Filter\SuppressFilter(true);
$filter = new \Zend\Log\Filter\Priority(\Zend\Log\Logger::NOTICE);
$logWriter->addFilter($filter);
$this->client = new \phparia\Client\Phparia($logger);
$this->client->connect($ariAddress);
$this->client->onStasisStart(function(StasisStart $event) {
$channel = $event->getChannel();
$bridge = $this->client->bridges()->createBridge(uniqid(), 'dtmf_events, mixing', 'bridgename');
$this->client->bridges()->addChannel($bridge->getId(), $channel->getId(), null);
...
});
$this->client->run();
$ariAddress = 'ws://localhost:8088/ari/events?api_key=username:password&app=stasis_app_name';
$amiAddress = 'username:password@localhost:5038';
$logger = new \Zend\Log\Logger();
$logWriter = new \Zend\Log\Writer\Stream("php://output");
$logger->addWriter($logWriter);
//$filter = new \Zend\Log\Filter\SuppressFilter(true);
$filter = new \Zend\Log\Filter\Priority(\Zend\Log\Logger::NOTICE);
$logWriter->addFilter($filter);
$this->client = new \phparia\Client\Phparia($logger);
$this->client->connect($ariAddress, $amiAddress);
$this->client->onStasisStart(function(StasisStart $event) {
$channel = $event->getChannel();
$bridge = $this->client->bridges()->createBridge(uniqid(), 'dtmf_events, mixing', 'bridgename');
$this->client->bridges()->addChannel($bridge->getId(), $channel->getId(), null);
$this->client->getWsClient()->on('SomeAMIEventName', function($event) {
...
});
...
});
$this->client->run();
You will find wrappers for (https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ARI) in the Client folder.
You will find wrappers for (https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+REST+Data+Models) in the Resources and Events folders.
(https://github.com/wormling/phparia/tree/master/src/wormling/phparia/Examples)
(https://github.com/wormling/phparia/tree/master/src/wormling/phparia/Tests/Functional)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)