ADC自动转接功能Lua实现
一、背景介绍:
虽然使用Mod_fifo和mod_callcenter可以做呼叫中心的应用,但在实现应用中,这两个模块很难客制化需求,再此我用Lua实现了5路客服(1000-1004),一个呼叫中心号码:9958 的ADC实施方案,谨在此记录。
二、流程图:

三、具体设定:
1 . /usr/local/freeswitch/conf/autoload_confilgs/modules.conf.xml 中加在 mod_lua模块,默认是加载的;
2. 在/usr/local/freeswitch/conf/var.xml 中添加5个全局变量,标识客服号码通话状态,内容如下:
<!-- yjCallCenter Sets: 0 allow the call, 1 busy -->
<X-PRE-PROCESS cmd="set" data="yj1000=0"/>
<X-PRE-PROCESS cmd="set" data="yj1001=0"/>
<X-PRE-PROCESS cmd="set" data="yj1002=0"/>
<X-PRE-PROCESS cmd="set" data="yj1003=0"/>
<X-PRE-PROCESS cmd="set" data="yj1004=0"/>
3. 在/usr/local/freeswitch/conf/dialplan/default 目录下添加 9958_callcenter.xml ,内容如下:
<extension name="yj_callcenter">
<condition field="destination_number" expression="^(9958)$">
<action application="lua" data="yjcall.lua"/>
</condition>
</extension>
4. 在/usr/local/freeswitch/scripts 目录下添加yjcall.lua,内容如下:
print("\n*******logo_fox's CallCenter******\n")
api=freeswitch.API();
local yj1000= freeswitch.getGlobalVariable("yj1000");
local yj1001= freeswitch.getGlobalVariable("yj1001");
local yj1002= freeswitch.getGlobalVariable("yj1002");
local yj1003= freeswitch.getGlobalVariable("yj1003");
local yj1004= freeswitch.getGlobalVariable("yj1004");
function yjCheck(command,lineNum,info)
local yjdata=api:executeString(command);
local i1,j1=string.find(yjdata,"100"..lineNum);
if(info=="LineStatusCheck") then
if(i1~=nil and i1>0) then
api:executeString("global_setvar yj100"..lineNum.."=1");
else
api:executeString("global_setvar yj100"..lineNum.."=0");
end
end
if(info=="RegistionCheck") then
if(i1~=nil and i1>0) then
return 1;
else
return 0;
end
end
end
local L1000=yjCheck("sofia status profile internal reg",0,"RegistionCheck");
local L1001=yjCheck("sofia status profile internal reg",1,"RegistionCheck");
local L1002=yjCheck("sofia status profile internal reg",2,"RegistionCheck");
local L1003=yjCheck("sofia status profile internal reg",3,"RegistionCheck");
local L1004=yjCheck("sofia status profile internal reg",4,"RegistionCheck");
for i=0,4,1 do
yjCheck("show calls",i,"LineStatusCheck");
end
yj1000= freeswitch.getGlobalVariable("yj1000");
yj1001= freeswitch.getGlobalVariable("yj1001");
yj1002= freeswitch.getGlobalVariable("yj1002");
yj1003= freeswitch.getGlobalVariable("yj1003");
yj1004= freeswitch.getGlobalVariable("yj1004");
if(yj1000=="0" and L1000==1) then
print("------Customer 1000 is at your service------");
api:executeString("global_setvar yj1000=1");
session:transfer("1000","xml","default");
return;
end
if(yj1001=="0" and L1001==1) then
print("------Customer 1001 is at your service------");
api:executeString("global_setvar yj1001=1");
session:transfer("1001","xml","default");
return;
end
if(yj1002=="0" and L1002==1) then
print("------Customer 1002 is at your service------");
api:executeString("global_setvar yj1002=1");
session:transfer("1002","xml","default");
return;
end
if(yj1003=="0" and L1003==1) then
print("------Customer 1003 is at your service------");
api:executeString("global_setvar yj1003=1");
session:transfer("1003","xml","default");
return;
end
if(yj1004=="0" and L1004==1) then
print("------Customer 1004 is at your service------");
api:executeString("global_setvar yj1004=1");
session:transfer("1004","xml","default");
return;
end
print("---------No available line, please wait dial!!----------");
session:hangup();
到此,ADC功能已经设定完毕,呼叫9958即可实现5路客服的服务。
ADC自动转接功能Lua实现的更多相关文章
- 基于JQuery实现的文本框自动填充功能
1. 实现的方法 /* * js实现的文本框的自动完成功能 */ function doAutoComplete(textid,dataid,url){ $("#" + texti ...
- redis技巧--自动完成功能实现
自动完成功能一般都伴随搜索框出现,就是用户在输入时帮助其自动补全. 比如对成语进行补全,现有如下成语:一心一意,一心二用,一帆风顺. 两种实现方式: 实现方式一: 为每个成语的每个前缀都使用一个集合类 ...
- eclipse自动提示功能没了的解决办法(转载)
eclipse自动提示功能没了的解决办法 标签: eclipse联想 2012-08-09 14:32 24687人阅读 评论(7) 收藏 举报 分类: Android(38) 版权声明:本文为博 ...
- xcode6 beta 中智能提示(自动完成)功能有时不显示的问题
xcode6 beta 中智能提示(自动完成)功能有时不显示的问题 周银辉 xcode6 beta 中智能提示(自动完成)功能有时不显示,这让人很郁闷啊,网上老外的视频中看人家用的好好的. ...
- 修改eclipse的自动完成功能
修改eclipse的自动完成功能 周银辉 用eclipse时还是比较习惯Visual Studio那样的敲一个字母就弹出自动完成框,而不是总要等到敲.号,其实可以设置的: 在preferences ...
- 禁用datagridview中的自动排序功能
把datagridview中的自动排序功能禁用自己收集的两种方法,看看吧①DataGridView中的Columns属性里面可以设置.进入"EditColumns"窗口后,在相应的 ...
- 解决 PhpStorm 对 用单例模式实例化PHP类时,代码自动提示功能失效 的问题
大部分PHP框架中,为了防止一个类被重复实例化,往往采用“单例模式”实例化类.我们的项目框架是这样做的: 先写好一个基类 /framework/Base.class.php,内容如下: <?ph ...
- 在MyEclipse显示struts2源码和doc文档及自动完成功能
分类: struts2 2010-01-07 16:34 1498人阅读 评论(1) 收藏 举报 myeclipsestruts文档xmlfileurl 在MyEclipse显示struts2源码和d ...
- Eclipse配置PHP及自动提示功能
Eclipse是一个开发工具,具有强大的插件功能,虽然用于Java理所当然,但为PHP所用,也为尝不可.虽然我一直用的是notepad,但发现开发工具也可以省去一些不必要的记忆. 言归正传,下面就来实 ...
随机推荐
- 洛谷P5206 数树
题意: task0,给定两棵树T1,T2,取它们公共边(两端点相同)加入一张新的图,记新图连通块个数为x,求yx. task1,给定T1,求所有T2的task0之和. task2,求所有T1的task ...
- 【POJ1187】陨石的秘密
题目大意: 定义一个串:只含有 '( )','[ ]','{ }',3种(6个)字符. 定义 SS 串: 空串是SS表达式. 若A是SS表达式,且A串中不含有中括号和大括号,则(A)是SS表达式. 若 ...
- C# WinForm文章收集
DataGridView 使用方法集锦 https://blog.csdn.net/zhaoyu_m69/article/details/70307934 关于DataGridView的一些操作(很全 ...
- C#.Net 持久化对象为XML文件
</pre><pre code_snippet_id="613717" snippet_file_name="blog_20150307_1_57950 ...
- jmeter oracle 多机 jdbc url配置
jmeter oracle 多机 jdbc url配置: jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HO ...
- 网络编程基础【day10】:IO多路复用
这些名词比较绕口,理解涵义就好.一个epoll场景:一个酒吧服务员(一个线程),前面趴了一群醉汉,突然一个吼一声“倒酒”(事件),你小跑过去给他倒一杯,然后随他去吧,突然又一个要倒酒,你又过去倒上,就 ...
- vue props的理解
vue用了这么久,今天发现父子组件还是傻傻的分不清,不过还好,今天终于搞懂了 vue中到底什么是父组件,什么是子组件 vue之props父子组件之间的谈话 简单的理解就是:使用的地方是父组件,定义的地 ...
- golang数组声明
格式 初始化数组 {}中的元素数不能大于[]中的数字,并且长度在初始化后不能改变,定义数组时需指定长度 ... var arrName [num]type = [num]type{value, val ...
- UVALive - 7147 (数学)
题目链接 题意 n只队伍,两两之间会进行比赛,赢平输都有相应得分,所有比赛结束后,前m名可以晋级.问最大的不能晋级分数为多少,以及最小的能晋级的分数. 分析 智商题...按照要求来贪心1.没有晋级的队 ...
- jQuery-easyui和validate表单验证实例
jQuery EasyUI 表单 - 表单验证插件validatebox 使用时需要向页面引入两个css文件如下: <link rel="stylesheet" href=& ...