Страница 1 из 1

AMI получение события о входящем звонке

Добавлено: 27 сен 2021, 22:59
vadosik
Отлавливаю события по AMI от Asterisk.
Есть 2 условия фильтрации событий:
1. ChannelStateDesc = Up
2. Context = from-queue

Звоню - Поднимаю трубку - Прилетают события, но они дублируются

Код: Выделить всё

[0] {
[0]   event: 'Newstate',
[0]   privilege: 'call,all',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235'
[0] }
[0] {
[0]   event: 'Newstate',
[0]   privilege: 'call,all',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235'
[0] }
[0] {
[0]   event: 'BridgeEnter',
[0]   privilege: 'call,all',
[0]   bridgeuniqueid: '9ba8b041-cc67-4d42-abac-32ef4f048753',
[0]   bridgetype: 'basic',
[0]   bridgetechnology: 'simple_bridge',
[0]   bridgecreator: '<unknown>',
[0]   bridgename: '<unknown>',
[0]   bridgenumchannels: '1',
[0]   bridgevideosourcemode: 'none',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235'
[0] }
[0] {
[0]   event: 'BridgeEnter',
[0]   privilege: 'call,all',
[0]   bridgeuniqueid: '9ba8b041-cc67-4d42-abac-32ef4f048753',
[0]   bridgetype: 'basic',
[0]   bridgetechnology: 'simple_bridge',
[0]   bridgecreator: '<unknown>',
[0]   bridgename: '<unknown>',
[0]   bridgenumchannels: '1',
[0]   bridgevideosourcemode: 'none',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235'
[0] }
[0] {
[0]   event: 'HangupRequest',
[0]   privilege: 'call,all',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235',
[0]   cause: '16'
[0] }
[0] {
[0]   event: 'HangupRequest',
[0]   privilege: 'call,all',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235',
[0]   cause: '16'
[0] }
[0] {
[0]   event: 'BridgeLeave',
[0]   privilege: 'call,all',
[0]   bridgeuniqueid: '9ba8b041-cc67-4d42-abac-32ef4f048753',
[0]   bridgetype: 'basic',
[0]   bridgetechnology: 'simple_bridge',
[0]   bridgecreator: '<unknown>',
[0]   bridgename: '<unknown>',
[0]   bridgenumchannels: '1',
[0]   bridgevideosourcemode: 'none',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235'
[0] }
[0] {
[0]   event: 'BridgeLeave',
[0]   privilege: 'call,all',
[0]   bridgeuniqueid: '9ba8b041-cc67-4d42-abac-32ef4f048753',
[0]   bridgetype: 'basic',
[0]   bridgetechnology: 'simple_bridge',
[0]   bridgecreator: '<unknown>',
[0]   bridgename: '<unknown>',
[0]   bridgenumchannels: '1',
[0]   bridgevideosourcemode: 'none',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235'
[0] }
[0] {
[0]   event: 'Hangup',
[0]   privilege: 'call,all',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235',
[0]   cause: '16',
[0]   'cause-txt': 'Normal Clearing'
[0] }
[0] {
[0]   event: 'Hangup',
[0]   privilege: 'call,all',
[0]   channel: 'Local/201@from-queue-0000003b;1',
[0]   channelstate: '6',
[0]   channelstatedesc: 'Up',
[0]   calleridnum: '201',
[0]   calleridname: '201',
[0]   connectedlinenum: '202',
[0]   connectedlinename: '202',
[0]   language: 'ru',
[0]   accountcode: '',
[0]   context: 'from-queue',
[0]   exten: '1',
[0]   priority: '1',
[0]   uniqueid: '1632771747.236',
[0]   linkedid: '1632771747.235',
[0]   cause: '16',
[0]   'cause-txt': 'Normal Clearing'
[0] }
Вопрос: Из-за чего такие дубли? Или может я не те события ловлю, суть в том что мне нужно событие поднятия трубки оператором.

Asterisk 13. FreePBX 15.

Re: AMI получение события о входящем звонке

Добавлено: 02 окт 2021, 20:24
Garnish
1. Попробуйте подключиться телнетом непосреlственно к астеру и посмотрите будет ли дубляж. Если его нет - смотрите в свой код. Если есть - смотрите в настройки manager.conf
2. Если оператор в очереди, можете смотреть на AgentConnect
3. Если ami не принципиален/не получается настроить, то можно использовать ключ "M" в Dial/Queue

Re: AMI получение события о входящем звонке

Добавлено: 04 окт 2021, 14:25
Repz
Ловить события нужно начинать по event, остальное потом.
В ами по одному событию.Дублируется из за ПО, два раза output прописан, нужно код смотреть.

Re: AMI получение события о входящем звонке

Добавлено: 25 окт 2021, 18:07
AndyBack
В АМИ и без того полно дублирований. Нужна стейт-машина, которая будет разбираться что нужно, а что нет.