播放自定义铃声

获取指定自定义铃声的播放资源 URL,然后访问该 URL 下载铃声并在本地播放。

请求 URL

GET {base_url}/{api_path}/custom_ringtone/play?file={file}&type={type}&access_token={access_token}

请求参数

参数 是否必填 类型 说明
file 是 String 自定义铃声的文件名,包含文件扩展名 (如 "demo_ringtone.wav")。
注: 可使用 搜索自定义铃声 接口查询自定义铃声的文件名。
type 否 String 自定义铃声类型。

取值范围:

  • built-in:PBX 内置铃声。
  • backend:本地上传的自定义铃声。

响应参数

参数 类型 说明
errcode Integer 返回错误码。
  • 0:请求成功。
  • 非零值:请求失败。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息。
errmsg String 返回信息。
  • SUCCESS:请求成功。
  • FAILURE:请求失败。
file String 自定义铃声的文件名。
play_resource_url String 自定义铃声的播放资源 URL。

示例

请求示例

GET /openapi/v1.0/custom_ringtone/play?file=Ring1.mp3&type=built-in&access_token=gwakjgu9ZBUfz36wql4ndsVKkryI0kdj HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com

响应示例

HTTP/1.1 200 OK
{
  "errcode": 0,
  "errmsg": "SUCCESS",
  "file": "Ring1.mp3",
  "play_resource_url": "/api/download/CustomRingtone-3xxxxx7-download-6198d3954d36091e6795ccdb5a966e22.mp3"
}

将播放资源 URL 与 {base_url} 组合,然后使用组合后的完整链接下载自定义铃声文件并在本地播放。

播放链接格式

{base_url}/{play_resource_url}

播放链接示例

https://yeastardocs.example.yeastarcloud.com/api/download/CustomRingtone-3xxxxx7-download-6198d3954d36091e6795ccdb5a966e22.mp3