IVR接口文档
- 批量IVR - IVR群呼接入流程
- 批量IVR - 批量呼出ivr语音(过时)
- 语音文件管理 - 上传语音文件
- 语音文件管理 - 获取语音文件
- 语音文件管理 - 播放语音文件
- 语音文件管理 - 编辑语音文件
- 语音文件管理 - 删除语音文件
- IVR管理 - 播放ivr语音(异步批量)-v2
- IVR管理 - 查看IVR呼叫进度-v2
批量IVR - IVR群呼接入流程
IVR群呼接入流程
接入前录音文件准备: 接口请求前,请先使用Infinity提供的账号密码登录到后台,在Voice后台的左侧找到菜单“Record Template(offline)”,在此处上传接口要使用的录音文件.
录音文件要求:采样率为8000bps,mp3格式,文件名不可带中文,允许英文及"_"符号。
批量IVR - 批量呼出ivr语音(过时)
接口说明
对于需要播放同一个IVR语音内容的不同号码,可以使用此接口批量呼出,单次提交不要超过5000个号码。
请求方式
POST,form-data格式
请求URL
http://ivr.infin8linx.com/yunhu
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Call.PlayVoice |
| appid | string | 是 | 授权appid |
| accesskey | string | 是 | 授权accesskey |
| destnumber | string | 是 | 目标号码,多个号码用“,”连接 |
| voicetype | int | 是 | 播放的语音文件类型。1:离线语音文件(自己录制的语音文件,上传到系统后台或者通过系统后台在线生成的)、2:在线语音(url) (提供一个可以访问的录音文件地址) |
| voicefile | string | 是 | voicetype=1 传后台的录音文件名;voicetype=2 传可以访问的语音url地址 |
| userkey | int | 否 | 是否需要用户按键,1:需要 0:不需要 默认0 |
| chengshudu | string | 否 | 客户自定义数据,在通话结束之后的回调数据中原样返回。 |
| disnumber | string | 否 | 主叫号码(显示在用户手机上的来电号码),留空则系统会随机取一个主叫号码 |
| customuuid | string | 否 | 客户自定义数据,在通话结束之后的回调数据中原样返回 |
| transfer | int | 否 | 是否转接到agent, 0不转、1转接,默认值为0,设置为转接agent不能为空 |
| agent | string | 否 | 坐席组或坐席号 |
| waittime | int | 否 | 呼叫等待时间,默认60s (秒) |
| conntime | int | 否 | 呼叫通话时间, 播放多久后自动结束,默认60s (秒) |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Call.PlayVoice',
'appid' => 'ABCDEFG',
'accesskey' => 'ABCDEFG',
'destnumber' => '133,134,135,135',
'voicetype' => 'abcdefg',
'voicefile' => 'abcdefg',
'chengshudu' => 'abcdefg',
'disnumber' => 'abcdefg',
'customuuid' => 'abcdefg',
'waittime' => 60,
'conntime' => 60,
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"code": 200,
"msg": "请求成功",
"data": {
"desc": "播放命令发送成功",
"reqtime": 1588836407,
"rsptime": 1588836407
}
}
返回参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | int | 返回码 200 成功 |
| msg | string | 返回提示信息 |
| data | object | 返回数据对象 |
| —desc | string | 请求提示信息 |
| —reqtime | int | 请求时间戳 |
| —rsptime | int | 返回时间戳 |
语音文件管理 - 上传语音文件
接口说明
用于上传语音文件到后台,用于ivr语音播放
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Voice.UploadAudio |
| token | string | 是 | 登录token |
| filename | file | 是 | 上传的文件 |
| voicename | string | 是 | 语音名称 |
| mark | file | 否 | 备注描述 |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Auth.Login',
'token' => 'ABCDEFG',
'filename' => 'ABCDEFG',
'voicename' => 'ABCDEFG',
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "upload success",
"result": {
"id": 1897,
"filename": "welcome.mp3",
"voicename": "欢迎语音",
"mark": null
},
"reqtime": 1788924778,
"rsptime": 1788924779
},
"msg": ""
}
返回参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | int | 语音文件id |
| filename | string | 语音文件 |
| voicename | string | 语音文件名称 |
语音文件管理 - 获取语音文件
接口说明
获取语音文件列表。
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Voice.GetAudioList |
| token | string | 是 | 通过授权接口获取的token |
| filename | string | 否 | 文件名 |
| voicename | string | 否 | 语音名称,支持模糊查询 |
| status | int | 否 | 0:启用、1:禁用、2:全部 |
| currentpage | int | 否 | 页数,默认:1 |
| itemsperpage | int | 否 | 每页数量,默认:10,最小:1;最大:1000 |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Cdr.GetBill',
'token' => 'ABCDEFG',
'starttime' => '2019-01-12 00:00:00',
'endtime' => '2020-12-12 00:00:00',
'direction' => 3
'syncflag' => 3,
'callmethod' => 0,
'currentpage' => 1,
'itemsperpage' => 10,
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "success",
"result": {
"totalitems": 4,
"currentpage": 1,
"itemsperpage": 20,
"audios": [
{
"id": 1897,
"createtime": "2026-09-09 11:32:59",
"updatetime": "2026-09-09 11:32:59",
"status": 0,
"filename": "welcome.mp3",
"voicename": "欢迎语音",
"mark": null
},
{
"id": 32,
"createtime": "2020-04-05 12:24:32",
"updatetime": "2020-04-05 12:24:32",
"status": 0,
"filename": "162729test_Telat3hari.mp3",
"voicename": "test",
"mark": null
},
{
"id": 30,
"createtime": "2020-04-05 12:24:32",
"updatetime": "2020-04-05 12:24:32",
"status": 0,
"filename": "d0bc00b05d3e.mp3",
"voicename": "apply_pass_voice2",
"mark": null
},
{
"id": 6,
"createtime": "2020-04-05 12:24:32",
"updatetime": "2020-04-05 12:24:32",
"status": 0,
"filename": "pylv8-favv2.mp3",
"voicename": "apply_pass_voice",
"mark": null
}
]
},
"reqtime": 1788924914,
"rsptime": 1788924914
},
"msg": ""
}
返回参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| result | objest | 返回的结果集 |
| —totalitems | int | 记录总数 |
| —currentpage | int | 当前页码 |
| —itemsperpage | int | 每页数量 |
| —audios | array | 记录数组 |
| ——id | int | 记录id |
| ——filename | string | 文件名 |
| ——voicename | string | 语音文件名称 |
| ——mark | string | 备注说明 |
| ——status | string | 状态 |
| ——createtime | string | 创建时间 |
| ——updatetime | string | 更新时间 |
语音文件管理 - 播放语音文件
接口说明
当有新增分机或是分机进行调整后出现异常时,可以通过该接口清除Token后,再重新获取Token继续操作。
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Voice.GetAudio |
| token | string | 是 | Token字符串 |
| id | int | 是 | 语音记录ID |
| download | int | 否 | 0:在线播放(默认)、1:下载文件 |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => ' App.Sip_Voice.GetAudio',
'token' => 'ABCDEFG',
'id' => '111',
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "获取成功",
"reqtime": 1602655204,
"rsptime": 1602655204
},
"msg": ""
}
语音文件管理 - 编辑语音文件
接口说明
用来编辑语音文件,修改相关属性
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Voice.EditAudio |
| token | string | 是 | Token字符串 |
| id | int | 是 | 语音记录ID |
| voicename | string | 否 | 语音名称 |
| mark | string | 否 | 语音备注 |
| status | int | 否 | 0:启用、1:禁用 |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Voice.EditAudio',
'token' => 'ABCDEFG',
'id' => '111',
'voicename' => '111',
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "获取成功",
"reqtime": 1602655204,
"rsptime": 1602655204
},
"msg": ""
}
语音文件管理 - 删除语音文件
接口说明
用于删除语音文件
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Voice.DelAudio |
| token | string | 是 | Token字符串 |
| id | int | 是 | 语音记录ID |
| download | int | 否 | 0:在线播放(默认)、1:下载文件 |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => ' App.Sip_Voice.DelAudio',
'token' => 'ABCDEFG',
'id' => '111',
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "删除成功",
"reqtime": 1602655204,
"rsptime": 1602655204
},
"msg": ""
}
IVR管理 - 播放ivr语音(异步批量)-v2
接口说明
对于需要播放同一个IVR语音内容的不同号码,可以使用此接口批量呼出,单次提交不要超过5000个号码。
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Call.PlayVoiceBatch |
| token | string | 是 | 通过授权接口获取的token |
| destnumber | string | 是 | 目标号码,多个号码用“,”连接 |
| voicetype | int | 是 | 播放的语音文件类型。1:离线语音文件(自己录制的语音文件,上传到系统后台或者通过系统后台在线生成的)、2:在线语音(url) (提供一个可以访问的录音文件地址) |
| voicefile | string | 是 | voicetype=1 传后台的录音文件名;voicetype=2 传可以访问的语音url地址 |
| disnumber | string | 否 | 主叫号码(显示在用户手机上的来电号码),留空则系统会随机取一个主叫号码 |
| userid | string | 否 | 自定义数据(员工ID) |
| memberid | string | 否 | 自定义数据(会员ID) |
| ext | string | 否 | 自定义数据(可以是json字符串) |
| customuuid | string | 否 | 客户自定义数据,在通话结束之后的回调数据中原样返回 |
| transfer | int | 否 | 是否转接到agent, 0不转、1转接,默认值为0,设置为转接agent不能为空 |
| agent | string | 否 | 坐席组或坐席号 |
| waittime | int | 否 | 呼叫等待时间,默认60s (秒) |
| conntime | int | 否 | 呼叫通话时间, 播放多久后自动结束,默认60s (秒) |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Call.PlayVoiceBatch',
'token' => 'ABCDEFG',
'destnumber' => '133,134,135,135',
'voicetype' => 'abcdefg',
'voicefile' => 'abcdefg',
'userid' => 'abcdefg',
'disnumber' => 'abcdefg',
'customuuid' => 'abcdefg',
'waittime' => 60,
'conntime' => 60,
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "成功",
"result": {
"batch_id": "20260917114314491892",
"count": 5
},
"reqtime": 1789616594,
"rsptime": 1789616594
},
"msg": ""
}
返回参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | int | 返回码 200 成功 |
| msg | string | 返回提示信息 |
| data | object | 返回数据对象 |
| —desc | string | 请求提示信息 |
| —reqtime | int | 请求时间戳 |
| —rsptime | int | 返回时间戳 |
IVR管理 - 查看IVR呼叫进度-v2
接口说明
查看ivr任务呼叫进度
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Call.GetIvrBatchStatus |
| token | string | 是 | 通过授权接口获取的token |
| batch_id | string | 是 | 批次ID |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Call.GetIvrBatchStatus',
'token' => 'ABCDEFG',
'batch_id' => '12123131313'
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "成功",
"result": {
"batch_id": "20260917114314491892",
"total": 5,
"pending": 0,
"calling": 0,
"success": 5,
"fail": 0
},
"reqtime": 1789616670,
"rsptime": 1789616670
},
"msg": ""
}
返回参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | int | 返回码 200 成功 |
| msg | string | 返回提示信息 |
| data | object | 返回数据对象 |
| —desc | string | 请求提示信息 |
| —reqtime | int | 请求时间戳 |
| —rsptime | int | 返回时间戳 |