简体   繁体   中英

Setting dynamic voice attribute inside TwiML Bin from Twilio Studio via TwiML Redirect

I'm trying to use a variable from a Studio Flow to set the type of voice to be used by a gather input interaction generated by a TwiML Bin, but when I attempt to reference the variable as the definition of the voice attribute I get a syntax error. I know that the {{VoiceEnglish}} variable reference works correctly since it will say the correct value if I put it inside of the Say tags, but is there no way to use it for any attributes? Example of what I would like to work is below:

<?xml version="1.0" encoding="UTF-8"?>

<Response>
  <Gather input="dtmf" timeout="15" numDigits="1" action="https://webhooks.twilio.com/v1/Accounts/[AccountSID]/Flows/[FlowSId}?FlowEvent=return" method="GET">
    <Say voice="{{VoiceEnglish}}" language="en-US">English verbiage here</Say>
    <Say voice="{{VoiceSpanish}}" language="es-MX">Spanish verbiage here</Say>
  </Gather>
</Response>

I think that the TwiML syntax is reported as invalid because it cannot tell that the result of {{VoiceEnglish}} or {{VoiceSpanish}} will be a valid voice.

You are able to to save the TwiML Bin as long as you agree to the modal:

显示 TwiML Bin 包含无效 TwiML 并询问您是否确定要保存它的模式。选项是取消或保存。

Once you save it, you can use it in your Studio Flow as long as you provide valid VoiceEnglish and VoiceSpanish parameters in the redirect URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM