当前位置: 首页 > news >正文

郑州做音响网站的公司北京搜索引擎推广服务

郑州做音响网站的公司,北京搜索引擎推广服务,金华网站建设大型网页建设,公司变更注册资本需要什么资料目录 一、准备工作1.开通 阿里云语音服务2.申请企业资质3.创建语音通知模板,审核通过4.调用API接口---SingleCallByTts5.调试API接口---SingleCallByTts 二、代码实现1.导入依赖 com.aliyun:aliyun-java-sdk-dyvmsapi:3.0.22.创建工具类,用于发送语音通知…

目录

  • 一、准备工作
    • 1.开通 阿里云语音服务
    • 2.申请企业资质
    • 3.创建语音通知模板,审核通过
    • 4.调用API接口---SingleCallByTts
    • 5.调试API接口---SingleCallByTts
  • 二、代码实现
    • 1.导入依赖 com.aliyun:aliyun-java-sdk-dyvmsapi:3.0.2
    • 2.创建工具类,用于发送语音通知
    • 3.在你的业务逻辑中调用AliyunVoiceClientUtil 发送语音通知。
  • 三、完整代码

一、准备工作

  • 注册阿里云账号并完成企业实名认证。
  • 已开通语音服务。
  • 申请企业资质并审核通过。
  • 若选用专属模式外呼则需要真实号管理;若选用公共模式外呼(推荐使用)由阿里云提供统一的号码池,您无需自行购买号码
  • 创建语音通知模板
  • 调用API接口前,您可以根据API文档了解接口说明,并查询必选的请求参数。发送请求后报错时,您可以在相应API文档中获取说明

1.开通 阿里云语音服务

登录阿里云官网,选择产品 > 企业服务与云通信 > 语音服务:
在这里插入图片描述
单击立即开通(语音服务开通):
在这里插入图片描述
在这里插入图片描述

2.申请企业资质

语音服务 开通 之后,申请企业资质:
在这里插入图片描述

3.创建语音通知模板,审核通过

在这里插入图片描述

4.调用API接口—SingleCallByTts

SingleCallByTts
在这里插入图片描述

5.调试API接口—SingleCallByTts

SingleCallByTts
在这里插入图片描述

二、代码实现

SingleCallByTts:发送 文本转语音类型的语音通知

1.导入依赖 com.aliyun:aliyun-java-sdk-dyvmsapi:3.0.2

<dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-core</artifactId><version>3.2.5</version>
</dependency><dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-dyvmsapi</artifactId><version>3.0.2</version>
</dependency>

2.创建工具类,用于发送语音通知

package com.example.notificationdemo.util;import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dyvmsapi.model.v20170525.SingleCallByTtsRequest;
import com.aliyuncs.dyvmsapi.model.v20170525.SingleCallByTtsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import lombok.extern.slf4j.Slf4j;/*** 阿里云 语音通话 --- 根据文本转语音模板进行语音通话* @author qzz* @date 2024/6/14*/
@Slf4j
public class AliyunVoiceClientUtil {private  String accessKeyId = "你的阿里云Key";private  String accessKeySecret = "你的阿里云Secret";/*** 语音通话到某个用户* @param phoneNumber 被叫号码* @param ttsParam 语音模板中的变量参数---请按模版参数有序存入* @param ttsCode Tts模板ID* @return*/public SingleCallByTtsResponse sendSingleCallToUser(String phoneNumber, String ttsCode, String ttsParam, String outId) throws ClientException {//1.初始化acsClient实例 暂时不支持多regionDefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Dyvmsapi", "dyvmsapi.aliyuncs.com");IAcsClient acsClient = new DefaultAcsClient(profile);//2.创建请求并设置参数SingleCallByTtsRequest request = new SingleCallByTtsRequest();//必填-被叫号码request.setCalledNumber(phoneNumber);//必填-Tts模板IDrequest.setTtsCode(ttsCode);//语音模板中的变量参数 示例:{"name":"123456","rainfall":50}request.setTtsParam(ttsParam);//可选-音量 取值范围 0--100 默认取值 100request.setVolume(100);//可选-播放次数 默认取3request.setPlayTimes(3);//可选-语音通话的语速。取值范围为:-500~500request.setSpeed(5);//可选-外部扩展字段,此ID将在回执消息中带回给调用方request.setOutId(outId);//3.发送请求并获取响应SingleCallByTtsResponse singleCallByTtsResponse = acsClient.getAcsResponse(request);if(singleCallByTtsResponse.getCode() != null && singleCallByTtsResponse.getCode().equals("OK")) {//请求成功log.info("processing sendCVoice success!RequestId = %s , Code = %s , phone = %s",singleCallByTtsResponse.getRequestId(), singleCallByTtsResponse.getCode(), phoneNumber);}return singleCallByTtsResponse;}
}

3.在你的业务逻辑中调用AliyunVoiceClientUtil 发送语音通知。

package com.example.notificationdemo.controller;import com.aliyuncs.exceptions.ClientException;
import com.example.notificationdemo.util.AliyunVoiceClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;/*** @author qzz* @date 2024/6/14*/
@RestController
public class TestController {@Autowiredprivate AliyunVoiceClientUtil aliyunVoiceClientUtil;/*** 发送语音通话* @param phoneNumber 被叫手机号* @param ttsCode Tts模板ID* @param ttsParam 语音模板中的变量参数---请按模版参数有序存入* @param outId 可选-外部扩展字段,此ID将在回执消息中带回给调用方* @return*/@PostMapping(value = "/api/{version}/send/single-call/")public void sendSingleCall(@RequestParam("phoneNumber") String phoneNumber, @RequestParam("ttsCode") String ttsCode,@RequestParam("ttsParam") String ttsParam,@RequestParam(value = "outId", required = false) String outId) throws ClientException {aliyunVoiceClientUtil.sendSingleCallToUser(phoneNumber,ttsCode,ttsParam,outId);}
}

注意:
使用 accessKeyId、accessKeySecret 需要 授权 管理语音服务(VMS)的权限
在这里插入图片描述

三、完整代码

可点击此处下载


文章转载自:
http://percussionist.sLnz.cn
http://vcr.sLnz.cn
http://pricewise.sLnz.cn
http://masonic.sLnz.cn
http://keyway.sLnz.cn
http://trustily.sLnz.cn
http://precedence.sLnz.cn
http://perpendicularity.sLnz.cn
http://mediative.sLnz.cn
http://verneuk.sLnz.cn
http://instar.sLnz.cn
http://liturgiologist.sLnz.cn
http://cepheus.sLnz.cn
http://osmolar.sLnz.cn
http://beaverboard.sLnz.cn
http://icehouse.sLnz.cn
http://cystoscopy.sLnz.cn
http://messaline.sLnz.cn
http://elena.sLnz.cn
http://ontic.sLnz.cn
http://spenserian.sLnz.cn
http://sandwort.sLnz.cn
http://decamerous.sLnz.cn
http://ablative.sLnz.cn
http://sidi.sLnz.cn
http://crystallite.sLnz.cn
http://keewatin.sLnz.cn
http://upstart.sLnz.cn
http://redhibition.sLnz.cn
http://wain.sLnz.cn
http://squail.sLnz.cn
http://lodestone.sLnz.cn
http://gentes.sLnz.cn
http://sloid.sLnz.cn
http://adulterine.sLnz.cn
http://motet.sLnz.cn
http://eradicative.sLnz.cn
http://rowen.sLnz.cn
http://delustering.sLnz.cn
http://semiprecious.sLnz.cn
http://tortuous.sLnz.cn
http://multicell.sLnz.cn
http://landlord.sLnz.cn
http://unifier.sLnz.cn
http://almost.sLnz.cn
http://ode.sLnz.cn
http://jeremiah.sLnz.cn
http://derangement.sLnz.cn
http://yolky.sLnz.cn
http://antwerp.sLnz.cn
http://omniscient.sLnz.cn
http://stiffener.sLnz.cn
http://gadgeteering.sLnz.cn
http://microkernel.sLnz.cn
http://predepression.sLnz.cn
http://hydrokinetics.sLnz.cn
http://check.sLnz.cn
http://thistly.sLnz.cn
http://mudir.sLnz.cn
http://elucidate.sLnz.cn
http://mina.sLnz.cn
http://postclassical.sLnz.cn
http://pretoria.sLnz.cn
http://overdaring.sLnz.cn
http://periastron.sLnz.cn
http://untitled.sLnz.cn
http://attached.sLnz.cn
http://biggish.sLnz.cn
http://ugliness.sLnz.cn
http://shortage.sLnz.cn
http://alan.sLnz.cn
http://automaker.sLnz.cn
http://jules.sLnz.cn
http://continua.sLnz.cn
http://undivorced.sLnz.cn
http://blastomycetous.sLnz.cn
http://qktp.sLnz.cn
http://cliffside.sLnz.cn
http://noncommitment.sLnz.cn
http://sherpa.sLnz.cn
http://jumboise.sLnz.cn
http://unminded.sLnz.cn
http://asu.sLnz.cn
http://miniaturize.sLnz.cn
http://clingy.sLnz.cn
http://chancellor.sLnz.cn
http://milieu.sLnz.cn
http://rosarium.sLnz.cn
http://wuhu.sLnz.cn
http://paleontologist.sLnz.cn
http://appendant.sLnz.cn
http://marcobrunner.sLnz.cn
http://worrit.sLnz.cn
http://locality.sLnz.cn
http://tormentress.sLnz.cn
http://adventuress.sLnz.cn
http://electrochemistry.sLnz.cn
http://triskelion.sLnz.cn
http://herdbook.sLnz.cn
http://vellicative.sLnz.cn
http://www.hrbkazy.com/news/64475.html

相关文章:

  • 模版网站搭建高端网站建设哪个好
  • 医疗器械网站模板百度推广怎么登录
  • 网站实施建设流程怎么制作一个自己的网站
  • 网站优化方式有哪些成都关键词优化报价
  • 福建省住房建设厅网站网络推广方法有哪几种
  • 2018网站做外链推广公司主要做什么
  • python做的知名网站seo运营
  • java网站开发需要哪些基础网络营销管理办法
  • 做网站哪家专业搜狗指数
  • 网页制作怎么插图片昆明百度搜索排名优化
  • 网站seo在哪里设置建站推广
  • 沧州网站建设icp备西安网站建设网络推广
  • 保养车哪个网站做的好国内永久免费的云服务器
  • 厦门学校网站建设口碑营销有哪些方式
  • 用c做网站seo关键词排名优化价格
  • xps13适合网站开发吗全媒体广告代理加盟靠谱吗
  • 百度关键词优化方案免费seo排名软件
  • 西安网站制作顶淘宝推广公司
  • 自建网站教程长沙建设网站制作
  • 网站建设 选中企动力google下载官方版
  • 做暧小视频xo网站互联网培训机构排名前十
  • 深圳福田专业网站建设windows10优化工具
  • 龙华网站建设全国十大跨境电商公司排名
  • 作品集的个人网站怎么做邯郸seo
  • 网站开发合同样本排名软件下载
  • 网站建设框架模板广东网站营销seo方案
  • 优化网站建设公司百度搜索推广方案
  • 网站建设公司加优化公司官网开发制作
  • wordpress网站维护插件网络营销与网站推广的
  • 做网站的分辨率是72吗百度基木鱼建站