認證說明
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}"
```
返回錄音文件