認(rèn)證說(shuō)明
api.conf 中若設(shè)置了 WEBKEY 將對(duì)請(qǐng)求頭中的 Authorization 進(jìn)行驗(yàn)證。
認(rèn)證方式:
YYYY-MM-DD為當(dāng)前日期的 年-月-日 格式
$ md5sum(WEBKEY + 'YYYY-MM-DD')
注意:
1.日期為動(dòng)態(tài),取每一天的日期
2.若不需要認(rèn)證,在api.conf中直接注釋W(xué)EBKEY參數(shù)(#注釋,刪除或值空)
配置文件說(shuō)明
[general]
BINDPORT = 8000 接收指令使用端口
URL = http://192.168.12.185:8090 推送數(shù)據(jù)的URL地址
WEBKEY = asjdfjklkasdf 認(rèn)證使用的WEBKEY
mac = 68:69:2e:03:8b:3e 當(dāng)前設(shè)備MAC地址
pop_url = http://www.baidu.com 話務(wù)條使用的彈屏URL
[enable]
pausetime = no 是否開(kāi)啟后處理機(jī)制
后處理機(jī)制:開(kāi)啟后處理機(jī)制后,坐席每接聽(tīng)一通電話會(huì)自動(dòng)置忙,默認(rèn)最長(zhǎng)置忙時(shí)間為30秒,30秒后會(huì)自動(dòng)置閑,坐席可以通過(guò)操作面板手動(dòng)置閑。在通話日志中會(huì)記錄每次通話結(jié)束后置閑的時(shí)長(zhǎng)(日志存儲(chǔ)時(shí)長(zhǎng)的字段為pauseTime,單位 秒)。
API接口說(shuō)明
注:此文檔中示例環(huán)境為
接收地址為:192.168.12.185
設(shè)備地址為:192.168.12.183
API 包括主動(dòng)/被動(dòng)兩部分.
-
主動(dòng), 內(nèi)部狀態(tài)/事件向外輸出.
-
被動(dòng), 修改內(nèi)部狀態(tài), 查詢內(nèi)部配置.
主動(dòng)推送事件(電話系統(tǒng)作為HTTP客戶端)
將電話系統(tǒng)內(nèi)部分機(jī)狀態(tài), 撥號(hào)開(kāi)始, 撥號(hào)結(jié)束 通過(guò) http 方式發(fā)送到 客戶 http 服務(wù)端. (如服務(wù)端需要使用 socket, 推薦直接連接 AMI 接口)。
l呼叫開(kāi)始
```json
{
event:"dialbegein",
timestamp:"1534993059.785012", //主叫通道唯一標(biāo)識(shí)
channel:"DAHDI/i1/18782985586-51", //主叫通道
calleridnum:"18782985586", //主叫號(hào)碼
destchannel:"SIP/886-00000065", //被叫通道
destcalleridnum:"886", //被叫號(hào)碼
destuniqueid:"1534993059.630", //被叫通道唯一標(biāo)識(shí)
dialstring:"SIP/886",
uniqueid:"1534993030.626", //呼叫唯一標(biāo)識(shí)
mac:"68:69:2e:05:0f:9a", //設(shè)備MAC地址
}
```
l呼叫結(jié)束
``` json
{
event:"dialend",
timestamp: "1534993059.785012", //時(shí)間戳
channel: "DAHDI/i1/18782985586-51", //主叫通道
calleridnum: "18782985586", //主叫號(hào)碼
destchannel:"SIP/886-00000065", //被叫通道
destcalleridnum: "886", //被叫號(hào)碼
uniqueid: "1534993030.626", //呼叫唯一標(biāo)識(shí)
dialstatus:"hangup"
}
```
l掛機(jī)
```json
{
event: "hangup"
calleridnum: "808", //主叫號(hào)碼
calleridname: "808", //主叫名稱
connectedlinenum: "809", //被叫號(hào)碼
connectedlinename: "809", //被叫名稱
uniqueid: "1325747409.260", //呼叫唯一標(biāo)識(shí)
}
```
l分機(jī)狀態(tài)
```json
{
event: "extensionstatus",
exten: "808", //分機(jī)號(hào)碼
status: "0", //狀態(tài)碼: 0:待機(jī),1:通話中,2:忙線,4:離線,8:振鈴中,16:保持
statustext: "Idle",
}
```
lIVR事件
```json
{
event: 'ivr',
uuid: '1541643689.15', //唯一標(biāo)識(shí)
caller: '810', //主叫號(hào)碼
called: '',
callType: 'IN',
queueCode: '630', //下一級(jí)隊(duì)列
startTime: '2018-11-08 10:21:29', //當(dāng)前IVR的開(kāi)始時(shí)間
endTime: '2018-11-08 10:21:32', //當(dāng)前IVR的結(jié)束時(shí)間
duration: '3', //當(dāng)前IVR的持續(xù)時(shí)間
ivrId: '610', //當(dāng)前IVR中的IVR的ID
ivrName: 'working time', //當(dāng)前IVR中的IVR的名稱
ivrDtmf: '0', //當(dāng)前IVR中的DTMF按鍵
trunkNumber: '123456', //DID號(hào)碼
mac: '68:69:2e:03:8b:3e ' //設(shè)備MAC地址
}
```
l通話日志1
```json
{
event: "cdr",
callerid: ""808" 808>", //名稱 號(hào)碼>
source: "808", //主叫號(hào)碼
destination: "809", //被叫號(hào)碼
starttime: "2012-01-05 15:10:09", //呼叫開(kāi)始時(shí)間
answertime: "2012-01-05 15:10:10", //呼叫應(yīng)答時(shí)間
endtime: "2012-01-05 15:10:11", //呼叫結(jié)束時(shí)間
disposition: "ANSWERED", //通話狀態(tài)
duration: "2", //呼叫時(shí)長(zhǎng)
billableseconds: "1", //通話時(shí)長(zhǎng)
calltype: "", //呼叫類型(outbound:呼出,inbound:呼入,空為內(nèi)部呼叫)
recordfile: "", //錄音文件
uniqueid: "1325747409.260" //唯一標(biāo)識(shí)
}
```
l通話日志2
```json
{ event: 'cc_cdr',
uuid: '1541415929.807', //唯一標(biāo)識(shí)
caller: '85322361', //主叫號(hào)碼
called: '100', //被叫號(hào)碼
queueCode: '630', //隊(duì)列號(hào)碼
agentCode: '100', //坐席分機(jī)
callType: 'incoming', //呼叫類型
cdrState: 'queue', //結(jié)束時(shí)所在位置:bridged接通;feedback評(píng)價(jià);queue隊(duì)列;ivr自動(dòng)話務(wù)員
hangupSide: 'caller', //結(jié)束掛斷方
hangupCause: 'ANALOG ANALOG_EVENT_ONHOOK',
startTime: '2018-11-05 19:05:31', //通話開(kāi)始時(shí)間
endTime: '2018-11-05 19:05:39', //通話結(jié)束時(shí)間
duration: '8', //通話持續(xù)時(shí)長(zhǎng)
queueTime: '7', //隊(duì)列中等待時(shí)間
feedbackTime: '0', //滿意度評(píng)價(jià)使用的時(shí)間
ivrTime: '', //IVR中經(jīng)歷的時(shí)間
ringTime: '7', //振鈴時(shí)長(zhǎng)
holdTime: 0, //保持時(shí)長(zhǎng)
pauseTime: 0, //后處理時(shí)長(zhǎng)
talkingTime: '0', //通話時(shí)長(zhǎng)
voicemailState: '0', //是否有語(yǔ)音留言
ivrId: '', //呼入經(jīng)過(guò)的IVR的ID
ivrName: '', //呼入經(jīng)過(guò)的IVR的名稱
ivrDtmf: '0', //呼入經(jīng)過(guò)的DTMF按鍵
fwType: '',
score: '0', //滿意度評(píng)價(jià)數(shù)字
trunkNumber: '', //DID號(hào)碼
forwardNumber: '',
filePath: '', //錄音文件
missCause: 'MEMBER_CANCEL', //來(lái)電丟失原因;NO_ASSIGN客服人數(shù)不夠; NO_AGENT_ANSWER 電話不接聽(tīng); NO_AGENT_LOGIN無(wú)人登陸;MEMBER_CANCEL排隊(duì)10秒內(nèi)掛機(jī)
mac: '68:69:2e:03:8b:3e' //設(shè)備MAC地址
}
```
被動(dòng)接收查詢(電話系統(tǒng)作為HTTP服務(wù)端)
l當(dāng)前實(shí)時(shí)通話列表
請(qǐng)求指令:
``` bash
curl -X POST "http://192.168.12.183:8000/coocenter-api/extensions/current-calls" -H "accept: application/json"
```
返回?cái)?shù)據(jù):
``` json
{
"status":"success",
"message":"Channels will follow",
"data":[
{
"calleridname":"896", //主叫名稱
"calleridnum":"896", //主叫號(hào)碼
"channel":"SIP/896-0000000b", //主叫通道
"channelstate":"6", //通道當(dāng)前狀態(tài)碼
"channelstatedesc":"Up", //通道當(dāng)前狀態(tài)
"connectedlinename":"897", //被叫名稱
"connectedlinenum":"897", //被叫號(hào)碼
"duration":"00:02:58", //通話時(shí)長(zhǎng)
}
]
}
```
l分機(jī)注冊(cè)信息列表
請(qǐng)求指令:
```bash
curl -X GET "http:// 192.168.12.183:8000/coocenter-api/extensions/extension-status" -H "accept: application/json"
```
返回?cái)?shù)據(jù):
``` 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分機(jī)狀態(tài)列表
請(qǐng)求指令:
```bash
curl -X GET "http://192.168.12.183:8000/coocenter-api/extensions/extension-hints-status" -H "accept: application/json"
```
返回?cái)?shù)據(jù):
``` json
[
{
"agentName": "800",
"extension": "800",
"extenType": "analogCallCenter",
"status": "0"
},
{
"agentName": "801",
"extension": "801",
"extenType": "analogCallCenter",
"status": "0"
}
]
```
l隊(duì)列數(shù)據(jù)信息
請(qǐng)求指令:
```bash
curl -X GET "http://192.168.12.183:8000/coocenter-api/queues/queue-info" -H "accept: application/json"
```
返回?cái)?shù)據(jù):
``` json
{
"status":"success",
"message":"Queue status will follow",
"data":
{
"630"://隊(duì)列號(hào)碼
[
{"name":"sip/876","paused":"0","penalty":"0"},//隊(duì)列中的坐席信息(name:坐席通道,paused:是否暫停"0為取消暫停,1為暫停",penalty:權(quán)重"隊(duì)列中呼叫的優(yōu)先級(jí)別")
{"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坐席暫停指令
請(qǐng)求指令:
** 設(shè)置暫停 **
``` 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坐席登錄
請(qǐng)求指令:
** 坐席簽入 **
``` 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"
```
正確響應(yīng)
``` 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"
```
正確響應(yīng)
``` json
{
"status": "success",
"message": "logout extension success"
}
l點(diǎn)擊撥號(hào)
向電話系統(tǒng) post 請(qǐng)求主叫號(hào)碼,被叫號(hào)碼. 電話系統(tǒng)首先撥打主叫號(hào)碼,主叫接聽(tīng)后撥打被叫號(hào)碼.
主叫 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通話掛斷
掛斷分機(jī)801的通話
請(qǐng)求指令:
``` 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"
```
正確響應(yīng)
``` json
{
"status": "success",
"message": "hangup extension success"
}
```
l呼叫轉(zhuǎn)接
將802轉(zhuǎn)給801
請(qǐng)求指令:
``` 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"
```
正確響應(yīng)
``` json
{
"status": "success",
"message": "tansfer extension success"
}
l呼叫監(jiān)聽(tīng)
使用分機(jī)801監(jiān)聽(tīng)分機(jī)806
請(qǐng)求指令:
``` 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"
```
正確響應(yīng)
``` json
{
"status": "success",
"message": "spy extension success"
}
l呼入黑名單
呼入號(hào)碼黑名單包括添加/查看/刪除三個(gè) API
** 查看黑名單列表 **
``` shell
curl -X GET "http://192.168.12.183:8000/coocenter-api/blacklist/index" -H "accept: application/json"
```
正確響應(yīng)
``` 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"
```
正確響應(yīng)
``` 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"
```
正確響應(yīng)
``` json
{
"status": "success",
"message": "Updated database successfully"
}
```
l獲取錄音文件
請(qǐng)求指令:
```bash
curl -X GET "http://192.168.12.183:8000/coocenter-api/monitor/${filePath}"
```
返回錄音文件