Skip to content

Commit fd5e15e

Browse files
authored
Merge pull request #47 from twilio/twiml-speech-recognition
Add TwiML Speech Recognition parameters
2 parents c8000b7 + 0d56277 commit fd5e15e

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

src/Twilio/TwiML/VoiceResponse.cs

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,24 @@ public VoiceResponse Enqueue(string name,
160160
/// <param name="action">Action URL</param>
161161
/// <param name="method">Action URL method</param>
162162
/// <param name="finishOnKey">Finish gather on key</param>
163+
/// <param name="partialResultCallback">Callback for partial results</param>
164+
/// <param name="partialResultCallbackMethod">Callback URL method</param>
165+
/// <param name="language">Locale</param>
166+
/// <param name="hints">Speech recognition hints</param>
167+
/// <param name="bargeIn">Stop media on speech</param>
168+
/// <param name="acknowledgeSoundUrl">URL for speech recognition</param>
163169
/// <returns>VoiceResponse</returns>
164170
public VoiceResponse Gather(int? timeout=null,
165171
int? numDigits=null,
166172
string action=null,
167173
string method=null,
168-
string finishOnKey=null)
174+
string finishOnKey=null,
175+
string partialResultCallback=null,
176+
string partialResultCallbackMethod=null,
177+
string language=null,
178+
string hints=null,
179+
bool? bargeIn=null,
180+
string acknowledgeSoundUrl=null)
169181
{
170182
var gather = new XElement("Gather");
171183
if (timeout != null)
@@ -188,7 +200,31 @@ public VoiceResponse Gather(int? timeout=null,
188200
{
189201
gather.Add(new XAttribute("finishOnKey", finishOnKey));
190202
}
191-
203+
if (!string.IsNullOrEmpty(partialResultCallback))
204+
{
205+
gather.Add(new XAttribute("partialResultCallback", partialResultCallback));
206+
}
207+
if (!string.IsNullOrEmpty(partialResultCallbackMethod))
208+
{
209+
gather.Add(new XAttribute("partialResultCallbackMethod", partialResultCallbackMethod));
210+
}
211+
if (!string.IsNullOrEmpty(language))
212+
{
213+
gather.Add(new XAttribute("language", language));
214+
}
215+
if (!string.IsNullOrEmpty(hints))
216+
{
217+
gather.Add(new XAttribute("hints", hints));
218+
}
219+
if (bargeIn != null)
220+
{
221+
gather.Add(new XAttribute("bargeIn", bargeIn));
222+
}
223+
if (!string.IsNullOrEmpty(acknowledgeSoundUrl))
224+
{
225+
gather.Add(new XAttribute("acknowledgeSoundUrl", acknowledgeSoundUrl));
226+
}
227+
192228
_response.Add(gather);
193229
return this;
194230
}

0 commit comments

Comments
 (0)