IVR管理 - 按号码及文本异步创建批量 IVR 任务-v2
接口说明
对于需要播放不同ivr语音的不同号码,可以使用此接口批量呼出,单次提交不要超过5000个号码。
请求方式
POST,form-data格式
请求参数
| 参数名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| service | string | 是 | App.Sip_Call.playVoiceBatchByText |
| token | string | 是 | 通过授权接口获取的token |
| language | string | 是 | 整批语音合成语言;候选值:英语 en-US、西班牙语 es-ES、印尼语 id-ID;实际可合成语言取决于TTS服务商| |
| voice_name | string | 是 | 合成音色 |
| items | string(JSON) | 是 | 对应号码和需要播放的ivr语音,数据格式示例:[{"phone":"13900000001","text":"您好","userid":"u-1","memberid":"m-1","ext":"{"source":"order"}","customuuid":"order-1"}] |
| disnumber | 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.playVoiceBatchByText ',
'token' => 'ABCDEFG',
'items' => '[{"phone":"13900000001","text":"您好","userid":"u-1","memberid":"m-1","ext":"{\"source\":\"order\"}","customuuid":"order-1"}],
'disnumber' => '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 | 返回时间戳 |