大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
1.设置呼叫中心拨号计划
<extension name="Call-Center-9999" continue="" uuid="c3500cca-9d04-4e18-a857-9d54c7490038">
<condition field="destination_number" expression="^([^#]+#)(.*)$" break="never">
<action application="set" data="caller_id_name=$2"/>
</condition>
<condition field="destination_number" expression="^(callcenter\+)?9999$">
<action application="answer" data=""/>
<action application="set" data="call_center_queue_uuid=c532409f-4b96-411e-a489-c011e1e9c9dc"/>
<action application="set" data="queue_extension=9999"/>
<action application="set" data="cc_export_vars=call_center_queue_uuid"/>
<action application="set" data="hangup_after_bridge=true"/>
<action application="callcenter" data="9999@${domain_name}"/>
</condition>
</extension>
2.添加坐席,并与呼叫中心建立tiers。
我使用的是fusionpbx添加。
xml方式添加,在callcenter.conf.xml:未测试
<agent
name="a030f2bc-b105-43f2-beef-a4625dda422e"
label="9001@192.168.1.1"
type="callback"
contact="{call_timeout=20,domain_name=192.168.1.1,domain_uuid=40d3fd6f-3e94-41f8-8ea6-49f7e43c73ee,extension_uuid=8210bedf-f9a1-4b2e-9a57-187dbbad6e61,sip_h_caller_destination=${caller_destination}}user/9001@111.44.133.178"
status=""
no-answer-delay-time="30"
max-no-answer="0"
wrap-up-time="10"
reject-delay-time="90"
busy-delay-time="90"
/>
</agents>
<tiers>
<tier
agent="9ea150f5-3213-4683-adbc-bc501d5bf874"
queue="8888@192.200.253.10"
domain_name="192.200.253.10"
level="0"
position="0"
/>
</tiers>
这里需要注意的是agent的状态一定是:Available
这是就可以拨打9999实现坐席9001接听了,但是9001只能接听,无法实现转接功能。
3.使用lua脚本在9001开始应答前,设置特殊拨号键。
在lua.conf.xml 文件中添加:
<hook event="CUSTOM" subclass="callcenter::info" script="aphero/callcenter_event.lua"/>
绑定CUSTOM事件中的callcenter::info呼叫中心子类,执行callcenter_event.lua,文件路径在freeswitch目录中的scripts下面。
4.lua脚本处理:
callcenter_event.lua,用到json,需要json.lua扩展。代码很粗糙!!!!!!!!
local json = require "aphero.json"
local action = event:getHeader("CC-Action")
local agent_session
local api = freeswitch.API()
local agent
freeswitch.consoleLog("NOTICE", "[aphero]callcenter: "..action.."\n")
--if (action == "agent-offering") then
if (action == "bridge-agent-start") then
agent = event:getHeader("CC-Agent")
local Agent_System = event:getHeader("CC-Agent-System")
local Member_UUID = event:getHeader("CC-Member-UUID")
local Member_Session_UUID = event:getHeader("CC-Member-Session-UUID")
local Member_CID_Name = event:getHeader("CC-Member-CID-Name")
local Member_CID_Number = event:getHeader("CC-Member-CID-Number")
freeswitch.consoleLog("NOTICE", "[aphero]CC-Agent:"..agent.."\n")
freeswitch.consoleLog("NOTICE", "[aphero]CC-Agent-System:"..Agent_System.."\n")
freeswitch.consoleLog("NOTICE", "[aphero]CC-Member-UUID:"..Member_UUID.."\n")
freeswitch.consoleLog("NOTICE", "[aphero]CC-Member-Session-UUID:"..Member_Session_UUID.."\n")
freeswitch.consoleLog("NOTICE", "[aphero]CC-Member-CID-Name:"..Member_CID_Name.."\n")
--caller session
-- caller_session=freeswitch.Session(Member_Session_UUID);
-- caller_session:execute("info","ALERT --caller_session--------------------")
-- caller_session:execute("bind_meta_app","4 b s execute_extension::att_xfer XML ${context}")
--agent session
channel_json = api:executeString("show channels like 9001 as json")
freeswitch.consoleLog("ALERT","API:"..channel_json)
docode_table=json.decode(channel_json)
freeswitch.consoleLog("NOTICE", "[aphero]:key:"..docode_table['row_count'])
for key, value in pairs(docode_table['rows']) do
if tostring(value['callstate'])=='RINGING' and tostring(value['callee_num'])=='9001' and tostring(value['direction'])=='outbound' then
freeswitch.consoleLog("NOTICE","agent_channel_uuid:"..tostring(value['uuid']))
agent_session=freeswitch.Session(tostring(value['uuid']));
end
end
agent_session:execute("bind_meta_app","4 a s execute_extension::att_xfer XML 192.168.1.1)
--agent_session:execute("bind_meta_app","2 a s execute_extension::dx XML 192.168.1.1")
freeswitch.consoleLog("NOTICE", "[aphero]#####################setup agent session end###########################")
end
添加成功后,在agent应答前,执行该代码,主要是(“bind_meta_app”,”4 a s execute_extension::att_xfer XML 192.168.1.1)这里,按【*4】执行att_xfer这个拨号计划
att_xfer的拨号计划如下:
<extension name="att_xfer" continue="false" uuid="40cc5795-9c12-4c69-9d36-21b0a3baa790">
<condition field="destination_number" expression="^att_xfer$">
<action application="read" data="2 6 'tone_stream://%(10000,0,350,440)' digits 30000 #"/>
<action application="set" data="origination_cancel_key=#"/>
<action application="att_xfer" data="user/${digits}@${domain_name}"/>
</condition>
</extension>
按【*4】听到拨号音,输入第三方号码+#后,开始呼叫。这时原主叫号码听保持音。
按【#】键可以重新拨号
按【0】键可以实现三方通话
5.log日志
2021-12-11 07:41:39.703154 [DEBUG] mod_callcenter.c:3283 Member 9002 <9002> is answered by an agent in queue 9999@192.168.1.1
2021-12-11 07:41:39.703154 [DEBUG] mod_callcenter.c:3375 Queue has 0 waiting calls.
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]callcenter: bridge-agent-start
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]CC-Agent:a030f2bc-b105-43f2-beef-a4625dda422e
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]CC-Agent-System:single_box
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]CC-Member-UUID:f5914366-7c59-4902-b56c-b4e3bac1a554
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]CC-Member-Session-UUID:4ec33fa7-3956-4381-b76e-a6608aa72367
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]CC-Member-CID-Name:9002
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:651 (sofia/internal-nat/9002@192.168.1.1) State EXECUTE going to sleep
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:585 (sofia/internal-nat/9002@192.168.1.1) Running State Change CS_HIBERNATE (Cur 4 Tot 958)
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:666 (sofia/internal-nat/9002@192.168.1.1) State HIBERNATE
2021-12-11 07:41:39.703154 [DEBUG] mod_sofia.c:191 sofia/internal-nat/9002@192.168.1.1 SOFIA HIBERNATE
2021-12-11 07:41:39.703154 [DEBUG] switch_ivr_bridge.c:1144 (sofia/internal-nat/9002@192.168.1.1) State Change CS_HIBERNATE -> CS_RESET
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:666 (sofia/internal-nat/9002@192.168.1.1) State HIBERNATE going to sleep
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:585 (sofia/internal-nat/9002@192.168.1.1) Running State Change CS_RESET (Cur 4 Tot 958)
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:647 (sofia/internal-nat/9002@192.168.1.1) State RESET
2021-12-11 07:41:39.703154 [DEBUG] mod_sofia.c:172 sofia/internal-nat/9002@192.168.1.1 SOFIA RESET
2021-12-11 07:41:39.703154 [DEBUG] switch_ivr_bridge.c:1129 sofia/internal-nat/9002@192.168.1.1 CUSTOM RESET
2021-12-11 07:41:39.703154 [DEBUG] switch_ivr_bridge.c:1136 (sofia/internal-nat/9002@192.168.1.1) State Change CS_RESET -> CS_SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:647 (sofia/internal-nat/9002@192.168.1.1) State RESET going to sleep
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:585 (sofia/internal-nat/9002@192.168.1.1) Running State Change CS_SOFT_EXECUTE (Cur 4 Tot 958)
2021-12-11 07:41:39.703154 [ALERT] switch_cpp.cpp:1465 API:{
"row_count":1,"rows":[{
"uuid":"03a09783-11d9-4d7e-ab56-b39f56d6a687","direction":"outbound","created":"2021-12-11 07:41:37","created_epoch":"1639208497","name":"sofia/internal-nat/9001@192.168.1.2:59672","state":"CS_CONSUME_MEDIA","cid_name":"9002","cid_num":"9002","ip_addr":"","dest":"9001","application":"","application_data":"","dialplan":"","context":"default","read_codec":"","read_rate":"","read_bit_rate":"","write_codec":"","write_rate":"","write_bit_rate":"","secure":"","hostname":"aphero-RD640","presence_id":"9001@192.168.1.1","presence_data":"","accountcode":"","callstate":"RINGING","callee_name":"Outbound Call","callee_num":"9001","callee_direction":"","call_uuid":"03a09783-11d9-4d7e-ab56-b39f56d6a687","sent_callee_name":"","sent_callee_num":"","initial_cid_name":"9002","initial_cid_num":"9002","initial_ip_addr":"","initial_dest":"9001","initial_dialplan":"","initial_context":"default"}]}
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:657 (sofia/internal-nat/9002@192.168.1.1) State SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] mod_sofia.c:662 SOFIA SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] switch_ivr_bridge.c:1154 sofia/internal-nat/9002@192.168.1.1 CUSTOM SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] switch_ivr_bridge.c:1186 (sofia/internal-nat/9001@192.168.1.2:59672) State Change CS_RESET -> CS_SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:585 (sofia/internal-nat/9001@192.168.1.2:59672) Running State Change CS_SOFT_EXECUTE (Cur 4 Tot 958)
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:657 (sofia/internal-nat/9001@192.168.1.2:59672) State SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] mod_sofia.c:662 SOFIA SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] switch_ivr_bridge.c:1154 sofia/internal-nat/9001@192.168.1.2:59672 CUSTOM SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:401 sofia/internal-nat/9001@192.168.1.2:59672 Standard SOFT_EXECUTE
2021-12-11 07:41:39.703154 [DEBUG] switch_core_state_machine.c:657 (sofia/internal-nat/9001@192.168.1.2:59672) State SOFT_EXECUTE going to sleep
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]:key:1
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 agent_channel_uuid:03a09783-11d9-4d7e-ab56-b39f56d6a687
EXECUTE [depth=0] sofia/internal-nat/9001@192.168.1.2:59672 bind_meta_app(4 a s execute_extension::att_xfer XML 192.168.1.1)
2021-12-11 07:41:39.703154 [INFO] switch_ivr_async.c:4670 Bound A-Leg: *4 execute_extension::att_xfer XML 192.168.1.1
2021-12-11 07:41:39.703154 [NOTICE] switch_cpp.cpp:1465 [aphero]#####################setup agent session end###########################
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/157846.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...