统一通信呼叫中心API
为接入统一通信的企业提供基础通信服务。
更新信息
暂无。
服务器信息
- 产品服务器地址:apiPrefix = http://cc.uccc.cc:9037/api/v31
- 测试服务器地址:apiPrefix = http://cc.uccc.cc:9137/api/v31
返回数据
错误信息
示例:
{
"status": 422,
"error": {
"code": 30105,
"message": "“主叫号码”不是合法的手机号或固定电话。",
"field": "callerNumber"
}
}
一、发起呼叫
Request
POST #{apiPrefix}/tserver/tenants/:tenantId/calls
Request body
{
"calleeNumber": string,
"callerNumber": string,
"agentId": integer,
"salesmanCode": string
}
- calleeNumber: 被叫号码
需要是合法的手机号或固定电话。
- callerNumber: 主叫号码(选填)
如果是固定话机,可不填本值,系统可以根据"agentId"查询到绑定的主叫号码。
需要是合法的手机号或者固定电话。
- agentId: 固定话机ID(选填)
如果是移动话机,或者"callerNumber"对应了唯一的"agentId",可不填本值。"agentId"值举例: 699861013。
只在多个固定话机共用一个主叫号码时,本值才有填写的必要。
- salesmanCode: 销售员编号(选填)
用于记录是哪个销售员进行的操作。这样,在话单和报表统计中,可以根据销售员进行搜索。
“销售员编号”能唯一标识一个销售员。如果贵公司销售员没有工号,你甚至可以传入销售员的姓名进来。
如果话机已经绑定了销售员,"salesmanCode"不填系统也可以自动关联到销售员。
只要"salesmanCode"值不为空,系统就会以此值为准。
如果"salesmanCode"在系统中不存在,系统会自动创建一个销售员。
Response
{
"callId": string
}
- callId: 本次呼叫的唯一ID。可据此查询本次呼叫的话单和录音等。callId是36位长的UUID。
二、查询一通呼叫
根据"callId"查询某个呼叫的话单和录音等。
Request
GET #{apiPrefix}/tserver/tenants/:tenantId/calls/:callId
Path parameters
- callId: string, 就是调用“发起呼叫接口”返回的"callId"。
Response
{
"id": string,
"callerNumber": string,
"calleeNumber": string,
"agentId": integer,
"salesmanCode": string,
"startTime": datetime,
"answerTime": datetime,
"endTime": datetime,
"duration": integer,
"cost": string,
"recordUrl": string
}
id: 与Path parameters中的"callId"相同
callerNumber: 主叫号码
calleeNumber: 被叫号码
agentId: 固定话机ID
salesmanCode: 销售员编号
startTime: 呼叫发起时间(RFC 3339 date-time,如:2016-01-11T18:25:43.511Z,下同)
answerTime: 应答时间
endTime: 通话结束时间
duration: 通话持续时长(单位:秒)
cost: 费用(单位:元)
recordUrl: 录音URL
三、按时间段查询话单
Request
GET #{apiPrefix}/tserver/tenants/:tenantId/calls/queryByPeriod?startTime=:startTime&endTime=:endTime&accessToken=:accessToken
Query parameters
- startTime: 查询开始时间(RFC 3339 date-time,如:2016-01-11T18:25:43.511Z,下同)
- endTime: 查询结束时间
- accessToken: 访问密钥
Response
{
"calls": [
calls Resource(即“查询一通呼叫”接口的Response)
]
}
一次最多返回1万条数据。如果系统报返回结果超过1万条,请缩短查询时间间隔。
四、查询座席日报表数据
Request
GET #{apiPrefix}/tserver/tenants/:tenantId/report/daily/:date/:accessToken
Query parameters
- date: 统计日期(如:20160901)
- accessToken: 访问密钥
Response
{
"status": 200,
"reports": [
{
"id": integer 在系统中的ID,
"targetDate": string 统计日期,
"callType": integer 呼叫类型{0: 呼出, 1: 呼入},
"agentId": integer 座席ID,
"salesmanId": integer 销售员ID,
"salesmanName": string 销售员姓名,
"triggerCount": integer 话单数,
"talkCount": integer 通话数,
"talkRatio": integer 接通率,
"talkDuration": integer 通话总时长,
"talkMinutes": integer 计费分钟数,
"cost": float 费用(单位: 元),
"checkinDuration": integer 签到总时长,
"checkinCount": integer 签到次数
},
{
"id": 32395,
"targetDate": "2016-09-01",
"callType": 0,
"agentId": 600151011,
"salesmanId": 19228,
"salesmanName": "王波",
"triggerCount": 303,
"talkCount": 58,
"talkRatio": "19.14%",
"talkDuration": 1988,
"talkMinutes": 78,
"cost": 0.05,
"checkinDuration": 1991,
"checkinCount": 18
}
]
}
五、导号到号码库
Request
POST #{apiPrefix}/outbound/tenants/:tenantId/campaigns/:campaignId/numbers
一个campaign(呼叫任务)对应一个号码库,一个号码库中包含若干被叫号码。
Path parameters
- campaignId: string, 呼叫任务ID
Request body
{
"numbers": [
string
]
}
- numbers: 被叫号码数组(“被叫号码”需要是合法的手机号或固定电话。)
Response
如果调用成功,body返回值为空。
其它功能
一、订阅话机状态
订阅代码
请在WEB代码中加入如下内容:
<script src="http://cc.uccc.cc:9003/faye/client.js" type="text/javascript"></script>
<script type="text/javascript">
var client = new Faye.Client("http://cc.uccc.cc:9003/faye", {timeout: 120});
client.subscribe("/monitor_agent_699861013", function(message) {
console.log(message);
});
</script>
上述的示例代码中的"699861013"是"agentId",您需要替换成实际的值。
返回的message值
{
"agentId": integer,
"callId": string,
"calleeNumber": string,
"callerNumber": string,
"salesmanCode": string,
"state": string,
"updatedAt": integer
}
agentId: 固定话机ID
callId: 本次呼叫的唯一ID。callId是36位长的UUID。
callerNumber: 主叫号码
calleeNumber: 被叫号码
salesmanCode: 销售员编号
-
state: 当前状态,具体状态值如下
{ "started": "呼叫已开始", "agentReady": "固定话机已准备好", "callAgentSuccess": "固定话机已接起", "callAgentFailed": "呼叫固定话机失败", "callCallee": "呼叫被叫号码", "calleeRingBack": "收到被叫号码回铃音。回铃音是被叫运营商给的。关机、停机等情况也可能收到回铃音。", "processed": "呼叫告一段落。如果没有收到'calleeRingBack',意味着呼叫已结束。", "calleeAnswered": "被叫已接起", "hangup": "挂断" }
updatedAt: 呼叫开始时间