Пожалуйста, войдите здесь. Часто задаваемые вопросы О нас
Задайте Ваш вопрос

История изменений [назад]

нажмите, чтобы скрыть/показать версии 1
изначальная версия
редактировать

спросил 2019-03-29 16:34:09 +0400

wellus Gravatar wellus

FreePBX как получить Callerid из связанного канала

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(CALLERID(num)=?)
exten => _X.,n,Set(CALLERID(name)=?)
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n,Hangup

Через АМИ шлю Originate

Action: Originate
ActionID: 842
Exten: 84951112233
Channel: Local/001@ext-callback-to-queue/n
Context: from-internal-test
Priority: 1
Timeout: 180000
Async: true
Callerid: "MissedCall" <84951112233>
Variable: sipaddheader=call-info:\;answer-after=0

exten => _X.,n,Goto(ext-did-0001,s,1) - кидает в очередь с агентами

как мне в [from-internal-test] поймать callerid ответившего агента?

FreePBX как получить Callerid из связанного канала

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(CALLERID(num)=?)
exten => _X.,n,Set(CALLERID(name)=?)
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n,Hangup

Через АМИ шлю Originate

Action: Originate
ActionID: 842
Exten: 84951112233
Channel: Local/001@ext-callback-to-queue/n
Context: from-internal-test
Priority: 1
Timeout: 180000
Async: true
Callerid: "MissedCall" <84951112233>
Variable: sipaddheader=call-info:\;answer-after=0

exten => _X.,n,Goto(ext-did-0001,s,1) - кидает в очередь с агентами

как мне в [from-internal-test] поймать callerid ответившего агента?

Вот лог звонка: Сначала отрабатывает Channel: Local/001@ext-callback-to-queue/n

-- Called 001@ext-callback-to-queue/n
-- Executing [001@ext-callback-to-queue:1] Set("Local/001@ext-callback-to-queue-0000047e;2", "__NODEST=001") in new stack
-- Executing [001@ext-callback-to-queue:2] Goto("Local/001@ext-callback-to-queue-0000047e;2", "ext-did-0001,s,1") in new stack
-- Goto (ext-did-0001,s,1)

...

и когда какой-нибудь агент в очереди берет трубку исполняется эта часть

Exten: 84951112233
Context: from-internal-test
-- Local/101@from-queue-0000047f;1 answered Local/001@ext-callback-to-queue-0000047e;2
-- Stopped music on hold on Local/001@ext-callback-to-queue-0000047e;2
-- Local/001@ext-callback-to-queue-0000047e;1 answered
-- Executing [84951112233@from-internal-test:1] Wait("Local/001@ext-callback-to-queue-0000047e;1", "1") in new stack
-- Channel Local/101@from-queue-0000047f;1 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel Local/001@ext-callback-to-queue-0000047e;2 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel SIP/101-00000323 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
   > 0x7fe148050ac0 -- Strict RTP switching to RTP target address 192.168.9.104:10970 as source
-- Channel Local/101@from-queue-0000047f;2 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
-- Executing [84951112233@from-internal-test:2] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(num)=101") in new stack
-- Executing [84951112233@from-internal-test:3] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(name)="101 Agent"") in new stack
-- Executing [84951112233@from-internal-test:4] Playback("Local/001@ext-callback-to-queue-0000047e;1", "/var/lib/asterisk/sounds/ru/demo-thanks,skip") in new stack
-- <Local/001@ext-callback-to-queue-0000047e;1> Playing '/var/lib/asterisk/sounds/ru/demo-thanks.g729' (language 'en')
   > 0x7fe148050ac0 -- Strict RTP learning complete - Locking on source address 192.168.9.104:10970
-- Executing [234448@from-internal-test:5] Goto("Local/001@ext-callback-to-queue-0000047e;1", "from-internal,84951112233,1") in new stack
-- Goto (from-internal,84951112233,1)

FreePBX как получить Callerid из связанного канала

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(CALLERID(num)=?)
exten => _X.,n,Set(CALLERID(name)=?)
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n,Hangup

Через АМИ шлю Originate

Action: Originate
ActionID: 842
Exten: 84951112233
Channel: Local/001@ext-callback-to-queue/n
Context: from-internal-test
Priority: 1
Timeout: 180000
Async: true
Callerid: "MissedCall" <84951112233>
Variable: sipaddheader=call-info:\;answer-after=0

exten => _X.,n,Goto(ext-did-0001,s,1) - кидает в очередь с агентами

как мне в [from-internal-test] поймать callerid ответившего агента?

Вот лог звонка: Сначала отрабатывает Channel: Local/001@ext-callback-to-queue/n

-- Called 001@ext-callback-to-queue/n
-- Executing [001@ext-callback-to-queue:1] Set("Local/001@ext-callback-to-queue-0000047e;2", "__NODEST=001") in new stack
-- Executing [001@ext-callback-to-queue:2] Goto("Local/001@ext-callback-to-queue-0000047e;2", "ext-did-0001,s,1") in new stack
-- Goto (ext-did-0001,s,1)

...

и когда какой-нибудь агент в очереди берет трубку исполняется эта часть

Exten: 84951112233
Context: from-internal-test
-- Local/101@from-queue-0000047f;1 answered Local/001@ext-callback-to-queue-0000047e;2
-- Stopped music on hold on Local/001@ext-callback-to-queue-0000047e;2
-- Local/001@ext-callback-to-queue-0000047e;1 answered
-- Executing [84951112233@from-internal-test:1] Wait("Local/001@ext-callback-to-queue-0000047e;1", "1") in new stack
-- Channel Local/101@from-queue-0000047f;1 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel Local/001@ext-callback-to-queue-0000047e;2 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel SIP/101-00000323 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
   > 0x7fe148050ac0 -- Strict RTP switching to RTP target address 192.168.9.104:10970 as source
-- Channel Local/101@from-queue-0000047f;2 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
-- Executing [84951112233@from-internal-test:2] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(num)=101") in new stack
-- Executing [84951112233@from-internal-test:3] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(name)="101 Agent"") in new stack
-- Executing [84951112233@from-internal-test:4] Playback("Local/001@ext-callback-to-queue-0000047e;1", "/var/lib/asterisk/sounds/ru/demo-thanks,skip") in new stack
-- <Local/001@ext-callback-to-queue-0000047e;1> Playing '/var/lib/asterisk/sounds/ru/demo-thanks.g729' (language 'en')
   > 0x7fe148050ac0 -- Strict RTP learning complete - Locking on source address 192.168.9.104:10970
-- Executing [234448@from-internal-test:5] Goto("Local/001@ext-callback-to-queue-0000047e;1", "from-internal,84951112233,1") in new stack
-- Goto (from-internal,84951112233,1)

Пока-что я нашел такой выход из ситуации:

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Set(GLOBAL(FOO${CALLERID(num)})=${CHANNEL})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(chanLog=${IMPORT(${FOO${EXTEN}},CHANNEL(callid)):1:-1})
exten => _X.,n,Set(chanId=${SHELL(cat /var/log/asterisk/full | grep ${chanLog} | grep answered | grep SIP | awk '{print $5}')})
exten => _X.,n,NoOp(${chanId:4:3})
exten => _X.,n,Set(CALLERID(num)=${chanId:4:3})
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n,Hangup

FreePBX как получить Callerid из связанного канала

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(CALLERID(num)=?)
exten => _X.,n,Set(CALLERID(name)=?)
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n,Hangup

Через АМИ шлю Originate

Action: Originate
ActionID: 842
Exten: 84951112233
Channel: Local/001@ext-callback-to-queue/n
Context: from-internal-test
Priority: 1
Timeout: 180000
Async: true
Callerid: "MissedCall" <84951112233>
Variable: sipaddheader=call-info:\;answer-after=0

exten => _X.,n,Goto(ext-did-0001,s,1) - кидает в очередь с агентами

как мне в [from-internal-test] поймать callerid ответившего агента?

Вот лог звонка: Сначала отрабатывает Channel: Local/001@ext-callback-to-queue/n

-- Called 001@ext-callback-to-queue/n
-- Executing [001@ext-callback-to-queue:1] Set("Local/001@ext-callback-to-queue-0000047e;2", "__NODEST=001") in new stack
-- Executing [001@ext-callback-to-queue:2] Goto("Local/001@ext-callback-to-queue-0000047e;2", "ext-did-0001,s,1") in new stack
-- Goto (ext-did-0001,s,1)

...

и когда какой-нибудь агент в очереди берет трубку исполняется эта часть

Exten: 84951112233
Context: from-internal-test
-- Local/101@from-queue-0000047f;1 answered Local/001@ext-callback-to-queue-0000047e;2
-- Stopped music on hold on Local/001@ext-callback-to-queue-0000047e;2
-- Local/001@ext-callback-to-queue-0000047e;1 answered
-- Executing [84951112233@from-internal-test:1] Wait("Local/001@ext-callback-to-queue-0000047e;1", "1") in new stack
-- Channel Local/101@from-queue-0000047f;1 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel Local/001@ext-callback-to-queue-0000047e;2 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel SIP/101-00000323 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
   > 0x7fe148050ac0 -- Strict RTP switching to RTP target address 192.168.9.104:10970 as source
-- Channel Local/101@from-queue-0000047f;2 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
-- Executing [84951112233@from-internal-test:2] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(num)=101") in new stack
-- Executing [84951112233@from-internal-test:3] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(name)="101 Agent"") in new stack
-- Executing [84951112233@from-internal-test:4] Playback("Local/001@ext-callback-to-queue-0000047e;1", "/var/lib/asterisk/sounds/ru/demo-thanks,skip") in new stack
-- <Local/001@ext-callback-to-queue-0000047e;1> Playing '/var/lib/asterisk/sounds/ru/demo-thanks.g729' (language 'en')
   > 0x7fe148050ac0 -- Strict RTP learning complete - Locking on source address 192.168.9.104:10970
-- Executing [234448@from-internal-test:5] Goto("Local/001@ext-callback-to-queue-0000047e;1", "from-internal,84951112233,1") in new stack
-- Goto (from-internal,84951112233,1)

Пока-что я нашел такой выход из ситуации:Вариант 2:

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Set(GLOBAL(FOO${CALLERID(num)})=${CHANNEL})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(chanLog=${IMPORT(${FOO${EXTEN}},CHANNEL(callid)):1:-1})
exten => _X.,n,Set(chanId=${SHELL(cat /var/log/asterisk/full | grep ${chanLog} | grep answered | grep SIP | awk '{print $5}')})
exten => _X.,n,NoOp(${chanId:4:3})
exten => _X.,n,Set(CALLERID(num)=${chanId:4:3})
_X.,n,Set(aCALLID=${IMPORT(${FOO${EXTEN}},CHANNEL(callid))})
exten => _X.,n,Set(channels=${CHANNELS()})
exten => _X.,n,While($["${SET(channel=${SHIFT(channels, )})}" != ""])
exten => _X.,n,NoOp(var is ${channel} and ${IMPORT(${channel},CHANNEL(callid))})
exten => _X.,n,GotoIf($["${channel:0:5}" != "Local"]?next:none)
exten => _X.,n(next),Set(bCALLID=${IMPORT(${channel},CHANNEL(callid))})
exten => _X.,n,GotoIf($["${aCALLID}" = "${bCALLID}"]?dial)
exten => _X.,n(none),EndWhile
exten => _X.,n,Goto(end)
exten => _X.,n(dial),Set(CALLERID(num)=${IMPORT(${channel},CALLERID(num))})
exten => _X.,n,Set(CALLERID(name)=${IMPORT(${channel},CALLERID(name))})
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n,Hangup
_X.,n(end),Hangup

FreePBX как получить Callerid из связанного канала

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(CALLERID(num)=?)
exten => _X.,n,Set(CALLERID(name)=?)
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n,Hangup

Через АМИ шлю Originate

Action: Originate
ActionID: 842
Exten: 84951112233
Channel: Local/001@ext-callback-to-queue/n
Context: from-internal-test
Priority: 1
Timeout: 180000
Async: true
Callerid: "MissedCall" <84951112233>
Variable: sipaddheader=call-info:\;answer-after=0

exten => _X.,n,Goto(ext-did-0001,s,1) - кидает в очередь с агентами

как мне в [from-internal-test] поймать callerid ответившего агента?

Вот лог звонка: Сначала отрабатывает Channel: Local/001@ext-callback-to-queue/n

-- Called 001@ext-callback-to-queue/n
-- Executing [001@ext-callback-to-queue:1] Set("Local/001@ext-callback-to-queue-0000047e;2", "__NODEST=001") in new stack
-- Executing [001@ext-callback-to-queue:2] Goto("Local/001@ext-callback-to-queue-0000047e;2", "ext-did-0001,s,1") in new stack
-- Goto (ext-did-0001,s,1)

...

и когда какой-нибудь агент в очереди берет трубку исполняется эта часть

Exten: 84951112233
Context: from-internal-test
-- Local/101@from-queue-0000047f;1 answered Local/001@ext-callback-to-queue-0000047e;2
-- Stopped music on hold on Local/001@ext-callback-to-queue-0000047e;2
-- Local/001@ext-callback-to-queue-0000047e;1 answered
-- Executing [84951112233@from-internal-test:1] Wait("Local/001@ext-callback-to-queue-0000047e;1", "1") in new stack
-- Channel Local/101@from-queue-0000047f;1 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel Local/001@ext-callback-to-queue-0000047e;2 joined 'simple_bridge' basic-bridge <a224cca6-3e47-4503-bac3-ce6ffcd9e8b9>
-- Channel SIP/101-00000323 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
   > 0x7fe148050ac0 -- Strict RTP switching to RTP target address 192.168.9.104:10970 as source
-- Channel Local/101@from-queue-0000047f;2 joined 'simple_bridge' basic-bridge <46df93a3-7085-4ad1-b825-ef0290698d30>
-- Executing [84951112233@from-internal-test:2] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(num)=101") in new stack
-- Executing [84951112233@from-internal-test:3] Set("Local/001@ext-callback-to-queue-0000047e;1", "CALLERID(name)="101 Agent"") in new stack
-- Executing [84951112233@from-internal-test:4] Playback("Local/001@ext-callback-to-queue-0000047e;1", "/var/lib/asterisk/sounds/ru/demo-thanks,skip") in new stack
-- <Local/001@ext-callback-to-queue-0000047e;1> Playing '/var/lib/asterisk/sounds/ru/demo-thanks.g729' (language 'en')
   > 0x7fe148050ac0 -- Strict RTP learning complete - Locking on source address 192.168.9.104:10970
-- Executing [234448@from-internal-test:5] Goto("Local/001@ext-callback-to-queue-0000047e;1", "from-internal,84951112233,1") in new stack
-- Goto (from-internal,84951112233,1)

Вариант 2:

[ext-callback-to-queue]
exten => _X.,1,Set(__NODEST=${EXTEN})
exten => _X.,n,Set(GLOBAL(FOO${CALLERID(num)})=${CHANNEL})
exten => _X.,n,Goto(ext-did-0001,s,1)
exten => _X.,Hangup

[from-internal-test]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(aCALLID=${IMPORT(${FOO${EXTEN}},CHANNEL(callid))})
exten => _X.,n,Set(channels=${CHANNELS()})
exten => _X.,n,While($["${SET(channel=${SHIFT(channels, )})}" != ""])
exten => _X.,n,NoOp(var is ${channel} and ${IMPORT(${channel},CHANNEL(callid))})
exten => _X.,n,GotoIf($["${channel:0:5}" != "Local"]?next:none)
exten => _X.,n(next),Set(bCALLID=${IMPORT(${channel},CHANNEL(callid))})
exten => _X.,n,GotoIf($["${aCALLID}" = "${bCALLID}"]?dial)
exten => _X.,n(none),EndWhile
exten => _X.,n,Goto(end)
exten => _X.,n(dial),Set(CALLERID(num)=${IMPORT(${channel},CALLERID(num))})
exten => _X.,n,Set(CALLERID(name)=${IMPORT(${channel},CALLERID(name))})
exten => _X.,n,Playback(/var/lib/asterisk/sounds/ru/demo-thanks,skip)
exten => _X.,n,Goto(from-internal,${EXTEN},1)
exten => _X.,n(end),Hangup

Проект компании "АТС Дизайн"
Asterisk® и Digium® являются зарегистрированными торговыми марками компании Digium, Inc., США.
IP АТС Asterisk распространяется под лицензией GNU GPL.