Skip to content

Commit

Permalink
Update the twiml ssml code snippets to avoid deprecated functions (Tw…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmena1 authored Mar 13, 2020
1 parent baf80ca commit 96c71d8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 30 deletions.
22 changes: 11 additions & 11 deletions twiml/voice/say/ssml/ssml.3.x.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
const say = response.say({
voice: 'Polly.Joanna'
}, 'Hi');
say.ssmlBreak({
say.break_({
strength: 'x-weak',
time: '100ms'
});
say.ssmlEmphasis({
say.emphasis({
level: 'moderate'
}, 'Words to emphasize');
say.ssmlP('Words to speak');
say.p('Words to speak');
say.addText('aaaaaa')
say.ssmlPhoneme({
say.phoneme({
alphabet: 'x-sampa',
ph: 'pɪˈkɑːn'
}, 'Words to speak');
say.addText('bbbbbbb')
say.ssmlProsody({
say.prosody({
pitch: '-10%',
rate: '85%',
volume: '-6dB'
}, 'Words to speak');
say.ssmlS('Words to speak');
say.ssmlSayAs({
'interpret-as': 'spell-out'
say.s('Words to speak');
say.sayAs({
'interpret-as': 'spell-out',
role: 'yyyymmdd'
}, 'Words to speak');
say.ssmlSub({
say.sub({
alias: 'alias'
}, 'Words to be substituted');
say.ssmlW('Words to speak');
say.w('Words to speak');

console.log(response.toString());
19 changes: 9 additions & 10 deletions twiml/voice/say/ssml/ssml.5.x.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ static void Main()
{
var response = new VoiceResponse();
var say = new Say("Hi", voice: "Polly.Joanna");
say.SsmlBreak(strength: "x-weak", time: "100ms");
say.SsmlEmphasis("Words to emphasize", level: "moderate");
say.SsmlP("Words to speak");
say.Break(strength: "x-weak", time: "100ms");
say.Emphasis("Words to emphasize", level: "moderate");
say.P("Words to speak");
say.AddText("aaaaaa");
say.SsmlPhoneme("Words to speak", alphabet: "x-sampa", ph: "pɪˈkɑːn");
say.Phoneme("Words to speak", alphabet: "x-sampa", ph: "pɪˈkɑːn");
say.AddText("bbbbbbb");
say.SsmlProsody("Words to speak", pitch: "-10%", rate: "85%",
volume: "-6dB");
say.SsmlS("Words to speak");
say.SsmlSayAs("Words to speak", interpretAs: "spell-out");
say.SsmlSub("Words to be substituted", alias: "alias");
say.SsmlW("Words to speak");
say.Prosody("Words to speak", pitch: "-10%", rate: "85%", volume: "-6dB");
say.S("Words to speak");
say.SayAs("Words to speak", interpretAs: "spell-out", role: "yyyymmdd");
say.Sub("Words to be substituted", alias: "alias");
say.W("Words to speak");
response.Append(say);

Console.WriteLine(response.ToString());
Expand Down
18 changes: 9 additions & 9 deletions twiml/voice/say/ssml/ssml.6.x.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

response = VoiceResponse()
say = Say('Hi', voice='Polly.Joanna')
say.ssml_break(strength='x-weak', time='100ms')
say.ssml_emphasis('Words to emphasize', level='moderate')
say.ssml_p('Words to speak')
say.break_(strength='x-weak', time='100ms')
say.emphasis('Words to emphasize', level='moderate')
say.p('Words to speak')
say.append('aaaaaa')
say.ssml_phoneme('Words to speak', alphabet='x-sampa', ph='pɪˈkɑːn')
say.phoneme('Words to speak', alphabet='x-sampa', ph='pɪˈkɑːn')
say.append('bbbbbbb')
say.ssml_prosody('Words to speak', pitch='-10%', rate='85%', volume='-6dB')
say.ssml_s('Words to speak')
say.ssml_say_as('Words to speak', interpret_as='spell-out')
say.ssml_sub('Words to be substituted', alias='alias')
say.ssml_w('Words to speak')
say.prosody('Words to speak', pitch='-10%', rate='85%', volume='-6dB')
say.s('Words to speak')
say.say_as('Words to speak', interpret_as='spell-out', role='yyyymmdd')
say.sub('Words to be substituted', alias='alias')
say.w('Words to speak')
response.append(say)

print(response)

0 comments on commit 96c71d8

Please sign in to comment.