需求:必须给用户打电话,才会播放语音消息。
第 1 步:
在 php 中调用 startoutboundvoicecontact API。以下是 AWS API 调用及其相关属性的链接。
https://docs.aws.amazon.com/connect/latest/APIReference/API_StartOutboundVoiceContact.html
https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-connect-2017-08-08.html#startoutboundvoicecontact
步骤#2:
AWS 将使用“播放提示中的预定义语音消息”运行特定的联系流(需要使其动态,这将来自 api)并调用用户。
第 3 步:
用户将接听电话并收听语音消息,调用将自动断开或用户可以选择断开连接。
问题#1:是否可以在 startoutboundvoicecontact API 中传递“动态文本”?
问题#2:在步骤#1 中,联系流 -> 播放提示具有文本到语音 -> 动态输入选项,但我不太确定它是如何工作的?
问题#3:任何其他api将有助于实现上述功能?
最佳答案
是的,这一切都可以通过 API 实现,我只是在 javascript 中实现了相同的流程,但主要部分应该是相同的。
$.Attributes
在播放提示中添加动态属性多变的。点击 Play prompt
在联系流中添加您想要在通话中说出的文字。我使用了 SSML,这可能也适用于文本:记得要保存和发布 联系流。
Javascript:
const connect = new aws.Connect();
var params = {
Attributes: {'message' : 'my dynamic message'},
ContactFlowId: 'your contact flow guid (found from url in browser)', /* required */
DestinationPhoneNumber: 'phonenumber to call', /* required */
InstanceId: 'your connect instance id (found from url in browser)', /* required */
SourcePhoneNumber: 'phone number you claimed in connect'
};
connect.startOutboundVoiceContact(params, function (err, data) {
if (err) { console.log('Error', err.stack) }
else { console.log('Success') }
});
PHP 可能看起来像这样(抱歉,从未编码过 PHP..):
$result = $client->startOutboundVoiceContact([
'Attributes' => array('message' => 'my dynamic message'),
'ContactFlowId' => 'your contact flow guid (found from url in browser)' // REQUIRED
'DestinationPhoneNumber' => 'phonenumber to call', // REQUIRED
'InstanceId' => 'your connect instance id (found from url in browser)', // REQUIRED
'SourcePhoneNumber' => 'phone number you claimed in connect',
]);
关于amazon-web-services - 带有动态(自定义)文本的 AWS 出站 api 调用和带有文本转语音的电话?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49785535/