# 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);
?>

```

#### 返回数据结构示例

```
{
    "code": 200,
    "msg": "请求成功",
    "data": {
        "desc": "播放命令发送成功",
        "reqtime": 1588836407,
        "rsptime": 1588836407
    }
}

```

#### 返回参数说明

| 参数名      | 类型     | 说明         |
| :------- | :----- | :--------- |
| code     | int    | 返回码 200 成功 |
| msg      | string | 返回提示信息     |
| data     | object | 返回数据对象     |
| —desc    | string | 请求提示信息     |
| —reqtime | int    | 请求时间戳      |
| —rsptime | int    | 返回时间戳      |