打电话接口.md
3.94 KB
1. 通话接口
接口地址:/v1/app/call/{targetId}?access_token=token
Request Method:GET
Request params:
参数名 | 是否必须 | 说明 | 参数类型 |
---|---|---|---|
targetId | 是 | 被叫的用户id | Long |
access_token | 是 | 系统当前登录用户的token | String |
Response Body:
成功建立通话连接:
{
"data": {
"callSid": "16090510160925480001030600243044"
}
},
"returnCode": 200,
"returnMsg": "success"
}
系统异常:
{
"returnCode": 500,
"returnMsg": "系统内部异常!"
}
用户未绑定手机号:
{
"returnCode": 400,
"returnMsg": "用户未绑定手机号,请手动拨打010-56469588!"
}
客服电话不存在:
{
"returnCode": 400,
"returnMsg": "客服电话不存在,请联系管理员!"
}
无通讯子账户:
{
"returnCode": 400,
"returnMsg": "无通讯子账户,请联系管理员!"
}
呼叫请求的参数有误:
{
"returnCode": 400,
"returnMsg": "呼叫请求的参数有误,请联系管理员!"
}
2. 客服呼叫
接口地址:/v1/app/callService?access_token=token
Request Method:GET
Request params:
参数名 | 是否必须 | 说明 | 参数类型 |
---|---|---|---|
access_token | 是 | 系统当前登录用户的token | String |
Response Body:
成功建立通话连接:
{
"data": {
"callSid": "16090510160925480001030600243044"
}
},
"returnCode": 200,
"returnMsg": "success"
}
系统异常:
{
"returnCode": 500,
"returnMsg": "系统内部异常!"
}
用户未绑定手机号:
{
"returnCode": 400,
"returnMsg": "用户未绑定手机号,请手动拨打010-56469588!"
}
客服电话不存在:
{
"returnCode": 400,
"returnMsg": "客服电话不存在,请联系管理员!"
}
无通讯子账户:
{
"returnCode": 400,
"returnMsg": "无通讯子账户,请联系管理员!"
}
呼叫请求的参数有误:
{
"returnCode": 400,
"returnMsg": "呼叫请求的参数有误,请联系管理员!"
}
3. 取消呼叫
接口地址:/v1/app/callCancel/{callSid}?access_token=token
Request Method:GET
Request params:
参数名 | 是否必须 | 说明 | 参数类型 |
---|---|---|---|
callSid | 是 | 当前通话的唯一标识 | String |
access_token | 是 | 系统当前登录用户的token | String |
Response Body:
成功取消呼叫:
{
"data": {
"isSuccess": "success"
}
},
"returnCode": 200,
"returnMsg": "success"
}
用户信息有误:
{
"returnCode": 400,
"returnMsg": "用户信息有误!"
}
取消呼叫失败:
{
"returnCode": 400,
"returnMsg": "取消呼叫失败!"
}
4. 获取通话状态
接口地址:/v1/app/callState/{callSid}?access_token=token
Request Method:GET
Request params:
参数名 | 是否必须 | 说明 | 参数类型 |
---|---|---|---|
callSid | 是 | 当前通话的唯一标识 | String |
access_token | 是 | 系统当前登录用户的token | String |
Response Body:
请求通话:
{
"data": {
"stateType": "1"
}
},
"returnCode": 200,
"returnMsg": "success"
}
响铃(等待接听):
{
"data": {
"stateType": "2"
}
},
"returnCode": 200,
"returnMsg": "success"
}
建立通话(被叫已接听):
{
"data": {
"stateType": "3"
}
},
"returnCode": 200,
"returnMsg": "success"
}
通话结束:
{
"data": {
"stateType": "4"
}
},
"returnCode": 200,
"returnMsg": "success"
}
系统异常:
{
"returnCode": 500,
"returnMsg": "系统内部异常!"
}