
# 创建语音外呼（V2.0.0）（createVoiceNotification）
#### 场景描述
创建语音外呼。
#### 接口方法
POST
#### 接口URI
https://域名/apiaccess/rest/voiceNotification/v2/createVoiceNotification，例如域名是service.besclouds.com
#### 请求说明
表1请求头参数 
| 序号 | 名称            | 参数类型   | 是否必选  | 说明                                                           |
|:---|:---|:---|:---|:---|
| 1  | X-APP-Key     | string | False | appKey字段，用户标识                                                |
| 2  | Authorization | string | True  | 鉴权字段，内容格式为：Bearer +tokenByAKSK接口的返回值中AccessToken（Bearer后有空格） |
   
表2请求体参数 
| 序号  | 名称             | 参数类型            | 是否必选  | 说明                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|:---|
| 1   | called         | string          | True  | 外呼被叫号码 长度限制:string(32)                                                                                                                                                    |
| 2   | playList       | array\[object\] | True  | 数组长度：1-5                                                                                                                                                                                                                                                                        |
| 2.1 | voiceId        | string          | False | 录音id（voiceId，voiceFileName，templateId必须填写1个）                                                                                                                                                                                                                                    |
| 2.2 | voiceFileName  | string          | False | 录音文件名（voiceId，voiceFileName，templateId必须填写1个）                                                                                                                                                                                                                                   |
| 2.3 | templateId     | string          | False | 模板id（voiceId，voiceFileName，templateId必须填写1个）                                                                                                                                                                                                                                    |
| 2.5 | templateParams | array\[string\] | False | 数组长度：1-10 长度限制:string(32)                                                                                                                                              |
| 3   | callBackUrl    | string          | False | 回调URL 长度限制:string(256) 回调URL的域名或IP端口已通过系统管理员加入手机客服回调的地址白名单中。 |
| 4   | callerPresent  | string          | False | 用户侧主叫外显号码 长度限制:string(32)                                                                                                                                              |
| 5   | playTimes      | number          | False | 播放次数 范围：1-5                                                                                                                                                           |
| 6   | priority       | string          | False | 播放语音通知优先级参数。 取值范围1-9整数，默认值为9。数字越小优先级越高。                                                                                                                                |
   
#### 响应说明
- **响应状态码: 200**
表3响应体参数 
| 序号    | 名称           | 参数类型   | 是否必选  | 说明               |
|:---|:---|:---|:---|:---|
| 1.1   | retCode      | string | False | 返回码。0表示成功，其他为失败。 |
| 1.2   | retMsg       | string | False | 失败原因的描述          |
| 1.3   | result       | object | False | 返回结果             |
| 1.3.1 | callSerialNo | string | False | 呼叫流水号            |
   
- **响应状态码: 400**
  错误的请求：请检查请求路径及参数。
  
- **响应状态码: 401**
  未授权：1.请确认是否购买了相关服务。2.请联系客服人员检查您账号的当前状态。
  
- **响应状态码: 404**
  请求的内容未找到：请检查请求的路径。
  
- **响应状态码: 500**
  业务失败：请依次确认您请求中各参数的取值。
  
 
#### 错误码
无。
#### 报文样例
请求头：
```
x-app-key:9******************************3  
Authorization:Bearer 9******************************7
```
请求参数:
```
{
    "called": "8899",
    "playList": [
        {
            "voiceId": "100001",
            "templateParams": [
                "100",
                "200"
            ]
        }
    ],
    "playTimes": 1,
    "callerPresent": "2222201",
    "callBackUrl": "http://xx.xx.xx.xx:8800/callbackTest"
}
```
响应参数:
```
{
"retMsg": "Created successfully.",
"retCode": "0",
        "result": {"callSerialNo": "1308434073450058757"}
}
```
