承接 ryzhov/asterisk-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ryzhov/asterisk-bundle

Composer 安装命令:

composer require ryzhov/asterisk-bundle

包简介

AsteriskBundle for symfony framework

README 文档

README

The AsteriskBundle provides integration of the Asterisk PAMI library into the Symfony2 framework.

License

This bundle is released under the MIT license

Installation

Require the bundle and its dependencies with composer:

$ composer require ryzhov/asterisk-bundle

Register the bundle:

// app/AppKernel.php

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

Usage

Add the asterisk section in your configuration file:

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.

Register async event handler with tag asterisk.ami_event_handler will handle only specified events.

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:

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

$ 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

统计信息

  • 总下载量: 160
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固