2017 © Pedro Peláez
 

symfony-bundle asterisk-bundle

AsteriskBundle for symfony framework

image

ryzhov/asterisk-bundle

AsteriskBundle for symfony framework

  • Thursday, February 16, 2017
  • by anryzhov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 100 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

AsteriskBundle

The AsteriskBundle provides integration of the Asterisk PAMI library into the Symfony2 framework., (*1)

License

This bundle is released under the MIT license, (*2)

Installation

Require the bundle and its dependencies with composer:, (*3)

$ composer require ryzhov/asterisk-bundle

Register the bundle:, (*4)

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        new Ryzhov\Bundle\AsteriskBundle(),
    );
}

Usage

Add the asterisk section in your configuration file:, (*5)

asterisk:
    connections:
        default:
            host: "%asterisk_host%"
            port: "%asterisk_ami_port%"
            username: "%asterisk_ami_username%"
            secret: "%asterisk_ami_secret%"
            connect_timeout: 5
            read_timeout: 5

    clients:
        main:
            connection: default
            logger_channel: ami

Here we configure the connection parameter and the AMI client that our application will have. In this example your service container will contain the service asterisk.main_client and asterisk.ami_connection.default connection parameters. AMI client service interface reference here Asterisk PAMI., (*6)

Register async event handler with tag asterisk.ami_event_handler will handle only specified events., (*7)


parameters: events: - "PAMI\\Message\\Event\\DeviceStateChangeEvent" - "PAMI\\Message\\Event\\PeerStatusEvent" services: service.event_handler: class: AppBundle\Service\EventHandler calls: - [setLogger, ["@logger"]] tags: - { name: monolog.logger, channel: event } - { name: asterisk.ami_event_handler, client: asterisk.main_client, events: "%events%" }

Event handler example:, (*8)


namespace AppBundle\Service; use PAMI\Listener\IEventListener; use PAMI\Message\Event\EventMessage; class EventHandler implements IEventListener { . . . public function handle(EventMessage $event) { $this->logger->debug(sprintf('class: "%s" handle', get_class($event))); } }

This is example of code ryzhov/example-asterisk-ami, (*9)

$ composer create-project ryzhov/example-asterisk-ami
-- configure ami socket parameters here --
asterisk_host (localhost): 127.0.0.1
asterisk_ami_port (5038): 
asterisk_ami_username (ami):
asterisk_ami_secret (pass4ami):
--

$ cd example-asterisk-ami
$ php bin/console event-handler

The Versions

16/02 2017

dev-master

9999999-dev https://github.com/ryzhov/asterisk-bundle

AsteriskBundle for symfony framework

  Sources   Download

MIT

The Requires

 

by Aleksandr N. Ryzhov

voip sip client event asterisk ami telephony

11/02 2017

v1.0

1.0.0.0 https://github.com/ryzhov/asterisk-bundle

AsteriskBundle for symfony framework

  Sources   Download

MIT

The Requires

 

by Aleksandr N. Ryzhov

voip sip client event asterisk ami telephony