认证说明
api.conf 中若设置了 WEBKEY 将对请求头中的 Authorization 进行验证。
认证方式:
YYYY-MM-DD为当前日期的 年-月-日 格式
$ md5sum(WEBKEY + 'YYYY-MM-DD')
注意:
1.日期为动态,取每一天的日期
2.若不需要认证,在api.conf中直接注释WEBKEY参数(#注释,删除或值空)
配置文件说明
[general]
BINDPORT = 8000 接收指令使用端口
URL = http://192.168.12.185:8090 推送数据的URL地址
WEBKEY = asjdfjklkasdf 认证使用的WEBKEY
mac = 68:69:2e:03:8b:3e 当前设备MAC地址
pop_url = http://www.baidu.com 话务条使用的弹屏URL
[enable]
pausetime = no 是否开启后处理机制
后处理机制:开启后处理机制后,坐席每接听一通电话会自动置忙,默认最长置忙时间为30秒,30秒后会自动置闲,坐席可以通过操作面板手动置闲。在通话日志中会记录每次通话结束后置闲的时长(日志存储时长的字段为pauseTime,单位 秒)。
API接口说明
注:此文档中示例环境为
接收地址为:192.168.12.185
设备地址为:192.168.12.183
API 包括主动/被动两部分.
-
主动, 内部状态/事件向外输出.
-
被动, 修改内部状态, 查询内部配置.
主动推送事件(电话系统作为HTTP客户端)
将电话系统内部分机状态, 拨号开始, 拨号结束 通过 http 方式发送到 客户 http 服务端. (如服务端需要使用 socket, 推荐直接连接 AMI 接口)。
l呼叫开始
```json
{
event:"dialbegein",
timestamp:"1534993059.785012", //主叫通道唯一标识
channel:"DAHDI/i1/18782985586-51", //主叫通道
calleridnum:"18782985586", //主叫号码
destchannel:"SIP/886-00000065", //被叫通道
destcalleridnum:"886", //被叫号码
destuniqueid:"1534993059.630", //被叫通道唯一标识
dialstring:"SIP/886",
uniqueid:"1534993030.626", //呼叫唯一标识
mac:"68:69:2e:05:0f:9a", //设备MAC地址
}
```
l呼叫结束
``` json
{
event:"dialend",
timestamp: "1534993059.785012", //时间戳
channel: "DAHDI/i1/18782985586-51", //主叫通道
calleridnum: "18782985586", //主叫号码
destchannel:"SIP/886-00000065", //被叫通道
destcalleridnum: "886", //被叫号码
uniqueid: "1534993030.626", //呼叫唯一标识
dialstatus:"hangup"
}
```
l挂机
```json
{
event: "hangup"
calleridnum: "808", //主叫号码
calleridname: "808", //主叫名称
connectedlinenum: "809", //被叫号码
connectedlinename: "809", //被叫名称
uniqueid: "1325747409.260", //呼叫唯一标识
}
```
l分机状态
```json
{
event: "extensionstatus",
exten: "808", //分机号码
status: "0", //状态码: 0:待机,1:通话中,2:忙线,4:离线,8:振铃中,16:保持
statustext: "Idle",
}
```
lIVR事件
```json
{
event: 'ivr',
uuid: '1541643689.15', //唯一标识
caller: '810', //主叫号码
called: '',
callType: 'IN',
queueCode: '630', //下一级队列
startTime: '2018-11-08 10:21:29', //当前IVR的开始时间
endTime: '2018-11-08 10:21:32', //当前IVR的结束时间
duration: '3', //当前IVR的持续时间
ivrId: '610', //当前IVR中的IVR的ID
ivrName: 'working time', //当前IVR中的IVR的名称
ivrDtmf: '0', //当前IVR中的DTMF按键
trunkNumber: '123456', //DID号码
mac: '68:69:2e:03:8b:3e ' //设备MAC地址
}
```
l通话日志1
```json
{
event: "cdr",
callerid: ""808" 808>", //名称 号码>
source: "808", //主叫号码
destination: "809", //被叫号码
starttime: "2012-01-05 15:10:09", //呼叫开始时间
answertime: "2012-01-05 15:10:10", //呼叫应答时间
endtime: "2012-01-05 15:10:11", //呼叫结束时间
disposition: "ANSWERED", //通话状态
duration: "2", //呼叫时长
billableseconds: "1", //通话时长
calltype: "", //呼叫类型(outbound:呼出,inbound:呼入,空为内部呼叫)
recordfile: "", //录音文件
uniqueid: "1325747409.260" //唯一标识
}
```
l通话日志2
```json
{ event: 'cc_cdr',
uuid: '1541415929.807', //唯一标识
caller: '85322361', //主叫号码
called: '100', //被叫号码
queueCode: '630', //队列号码
agentCode: '100', //坐席分机
callType: 'incoming', //呼叫类型
cdrState: 'queue', //结束时所在位置:bridged接通;feedback评价;queue队列;ivr自动话务员
hangupSide: 'caller', //结束挂断方
hangupCause: 'ANALOG ANALOG_EVENT_ONHOOK',
startTime: '2018-11-05 19:05:31', //通话开始时间
endTime: '2018-11-05 19:05:39', //通话结束时间
duration: '8', //通话持续时长
queueTime: '7', //队列中等待时间
feedbackTime: '0', //满意度评价使用的时间
ivrTime: '', //IVR中经历的时间
ringTime: '7', //振铃时长
holdTime: 0, //保持时长
pauseTime: 0, //后处理时长
talkingTime: '0', //通话时长
voicemailState: '0', //是否有语音留言
ivrId: '', //呼入经过的IVR的ID
ivrName: '', //呼入经过的IVR的名称
ivrDtmf: '0', //呼入经过的DTMF按键
fwType: '',
score: '0', //满意度评价数字
trunkNumber: '', //DID号码
forwardNumber: '',
filePath: '', //录音文件
missCause: 'MEMBER_CANCEL', //来电丢失原因;NO_ASSIGN客服人数不够; NO_AGENT_ANSWER 电话不接听; NO_AGENT_LOGIN无人登陆;MEMBER_CANCEL排队10秒内挂机
mac: '68:69:2e:03:8b:3e' //设备MAC地址
}
```
被动接收查询(电话系统作为HTTP服务端)
l当前实时通话列表
请求指令:
``` bash
curl -X POST "http://192.168.12.183:8000/coocenter-api/extensions/current-calls" -H "accept: application/json"
```
返回数据:
``` json
{
"status":"success",
"message":"Channels will follow",
"data":[
{
"calleridname":"896", //主叫名称
"calleridnum":"896", //主叫号码
"channel":"SIP/896-0000000b", //主叫通道
"channelstate":"6", //通道当前状态码
"channelstatedesc":"Up", //通道当前状态
"connectedlinename":"897", //被叫名称
"connectedlinenum":"897", //被叫号码
"duration":"00:02:58", //通话时长
}
]
}
```
l分机注册信息列表
请求指令:
```bash
curl -X GET "http:// 192.168.12.183:8000/coocenter-api/extensions/extension-status" -H "accept: application/json"
```
返回数据:
``` json
{
"status":"success",
"message":"Peer status list will follow",
"data":
[
{
"Exten": "800",
"Type": "SIP",
"IPAddr": "-none-",
"Status": "UNKNOWN"
},
{
"Exten": "801",
"Type": "SIP",
"IPAddr": "192.168.12.4",
"Status": "OK (45 ms)"
},
{
"Exten": "802",
"Type": "SIP",
"IPAddr": "192.168.12.3",
"Status": "OK (42 ms)"
}
]
}
```
l分机状态列表
请求指令:
```bash
curl -X GET "http://192.168.12.183:8000/coocenter-api/extensions/extension-hints-status" -H "accept: application/json"
```
返回数据:
``` json
[
{
"agentName": "800",
"extension": "800",
"extenType": "analogCallCenter",
"status": "0"
},
{
"agentName": "801",
"extension": "801",
"extenType": "analogCallCenter",
"status": "0"
}
]
```
l队列数据信息
请求指令:
```bash
curl -X GET "http://192.168.12.183:8000/coocenter-api/queues/queue-info" -H "accept: application/json"
```
返回数据:
``` json
{
"status":"success",
"message":"Queue status will follow",
"data":
{
"630"://队列号码
[
{"name":"sip/876","paused":"0","penalty":"0"},//队列中的坐席信息(name:坐席通道,paused:是否暂停"0为取消暂停,1为暂停",penalty:权重"队列中呼叫的优先级别")
{"name":"sip/805","paused":"0","penalty":"1"},
{"name":"sip/870","paused":"0","penalty":"0"},
{"name":"sip/802","paused":"0","penalty":"1"},
{"name":"sip/800","paused":"0","penalty":"0"},
{"name":"sip/899","paused":"0","penalty":"0"},
{"name":"sip/898","paused":"0","penalty":"0"},
{"name":"sip/895","paused":"0","penalty":"0"},
{"name":"sip/893","paused":"1","penalty":"0"}
],
"631":
[
{"name":"sip/870","paused":"0","penalty":"0"},
{"name":"sip/876","paused":"0","penalty":"0"},
{"name":"sip/897","paused":"0","penalty":"0"},
{"name":"sip/802","paused":"0","penalty":"0"},
{"name":"sip/898","paused":"0","penalty":"0"},
{"name":"sip/800","paused":"0","penalty":"0"}
],
"632":
[
{"name":"sip/897","paused":"0","penalty":"0"},
{"name":"sip/898","paused":"0","penalty":"0"}
]
}
}
```
l坐席暂停指令
请求指令:
** 设置暂停 **
``` shell
curl -X POST "http://192.168.12.183:8000/coocenter-api/queues/agent-pause" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "queue=630member=808state=on"
```
** 取消暂停 **
``` shell
curl -X POST "http://192.168.12.183:8000/coocenter-api/queues/agent-pause" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "queue=630member=808state=on"
```
l坐席登录
请求指令:
** 坐席签入 **
``` shell
curl -X POST "http://192.168.12.183:8000/coocenter-api/queues/agent-login" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "extension=800queue=630"
```
正确响应
``` json
{
"status": "success",
"message": "login extension success"
}
** 坐席签出 **
``` shell
curl -X POST "http://192.168.12.183:8000/coocenter-api/queues/agent-logout" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "extension=800queue=630"
```
正确响应
``` json
{
"status": "success",
"message": "logout extension success"
}
l点击拨号
向电话系统 post 请求主叫号码,被叫号码. 电话系统首先拨打主叫号码,主叫接听后拨打被叫号码.
主叫 808 拨打被叫 809.
``` shell
curl -X POST "http://192.168.12.183:8000/coocenter-api/extensions/click-number" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "src=808dst=809"
```
l通话挂断
挂断分机801的通话
请求指令:
``` shell
curl -X POST "https://192.168.12.185:8080/coocenter-api/extensions/hangup" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "extension=801"
```
正确响应
``` json
{
"status": "success",
"message": "hangup extension success"
}
```
l呼叫转接
将802转给801
请求指令:
``` shell
curl -X POST "https://192.168.12.185:8080/coocenter-api/extensions/transfer" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "dst=801src=802"
```
正确响应
``` json
{
"status": "success",
"message": "tansfer extension success"
}
l呼叫监听
使用分机801监听分机806
请求指令:
``` shell
curl -X POST "http://192.168.12.183:8000/coocenter-api/extensions/extenSpy" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "dst=806src=801"
```
正确响应
``` json
{
"status": "success",
"message": "spy extension success"
}
l呼入黑名单
呼入号码黑名单包括添加/查看/删除三个 API
** 查看黑名单列表 **
``` shell
curl -X GET "http://192.168.12.183:8000/coocenter-api/blacklist/index" -H "accept: application/json"
```
正确响应
``` json
{
"status": "success",
"data": [
"123456"
]
}
```
** 删除黑名单 **
``` shell
curl -X DELETE "http://192.168.12.183:8000/coocenter-api/blacklist/delete" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "number=123456"
```
正确响应
``` json
{
"status": "success",
"message": "Key deleted successfully"
}
```
** 添加黑名单 **
``` shell
curl -X POST "http://192.168.12.183:8000/coocenter-api/blacklist/create" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "number=123123"
```
正确响应
``` json
{
"status": "success",
"message": "Updated database successfully"
}
```
l获取录音文件
请求指令:
```bash
curl -X GET "http://192.168.12.183:8000/coocenter-api/monitor/${filePath}"
```
返回录音文件