Skip to content

Commit 138bf4c

Browse files
authored
Say snippets (TwilioDevEd#1022)
* Remove TTS stuff that didn't work and add Say basic usage * Add Say examples * Fix csharp say-languge example * Fix formatting
1 parent 7a5ecc9 commit 138bf4c

34 files changed

+272
-4024
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "<Say> basic usage",
3+
"type": "server"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Response>
3+
<Say>Hello!</Say>
4+
</Response>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2+
3+
const response = new VoiceResponse();
4+
response.say('Hello!');
5+
6+
console.log(response.toString());
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require 'twilio-ruby'
2+
3+
response = Twilio::TwiML::VoiceResponse.new
4+
response.say(message: 'Hello!')
5+
6+
puts response
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using Twilio.TwiML;
3+
using Twilio.TwiML.Voice;
4+
5+
6+
class Example
7+
{
8+
static void Main()
9+
{
10+
var response = new VoiceResponse();
11+
response.Say("Hello!");
12+
13+
Console.WriteLine(response.ToString());
14+
}
15+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
require_once './vendor/autoload.php';
3+
use Twilio\TwiML\VoiceResponse;
4+
5+
$response = new VoiceResponse();
6+
$response->say('Hello!');
7+
8+
echo $response;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from twilio.twiml.voice_response import VoiceResponse, Say
2+
3+
response = VoiceResponse()
4+
response.say('Hello!')
5+
6+
print(response)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import com.twilio.twiml.VoiceResponse;
2+
import com.twilio.twiml.voice.Say;
3+
import com.twilio.twiml.TwiMLException;
4+
5+
6+
public class Example {
7+
public static void main(String[] args) {
8+
Say say = new Say.Builder("Hello!").build();
9+
VoiceResponse response = new VoiceResponse.Builder().say(say).build();
10+
11+
try {
12+
System.out.println(response.toXml());
13+
} catch (TwiMLException e) {
14+
e.printStackTrace();
15+
}
16+
}
17+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "<Say> using language attribute",
3+
"type": "server"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Response>
3+
<Say language="fr-FR">Bonjour!</Say>
4+
</Response>

0 commit comments

Comments
 (0)