本文整理汇总了C#中TropoCSharp.Tropo.Say类的典型用法代码示例。如果您正苦于以下问题:C# Say类的具体用法?C# Say怎么用?C# Say使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Say类属于TropoCSharp.Tropo命名空间,在下文中一共展示了Say类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Set the voice property.
tropo.Voice = Voice.UsEnglishMale;
Say say = new Say("Please record your 45 second message after the beep, press pound when complete.");
tropo.Say(say);
Record record = new Record()
{
Bargein = true,
Beep = true,
Say = new Say(""),
Format = "audio/mp3",
MaxTime = 45,
Choices = new Choices("", "dtmf", "#"),
Url = "../UploadRecording"
};
tropo.Record(record);
// Render JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Create a transcription object to use with recording.
Transcription trancription = new Transcription();
trancription.Uri = "mailto:[email protected]";
trancription.EmailFormat = "omit";
// Set up grammar for recording.
Choices choices = new Choices();
choices.Value = "[10 DIGITS]";
choices.Terminator = "#";
// Construct a prompt to use with the recording.
Say say = new Say();
say.Value = "Please say your account number";
// Use the record() method to set up a recording.
tropo.Record(3, false, true, choices, AudioFormat.Wav, 10, 60, Method.Post, null, true, say, 5, trancription, null, "http://somehost.com/record.aspx");
// Hangup when finished.
tropo.Hangup();
// Render the JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Set the voice to use when saying a prompt.
tropo.Voice = Voice.UsEnglishMale;
// A prompt to give the say to the recipient.
Say say = new Say("Remember you have a meeting at 2 PM");
// An ArrayList to hold the numbers to call (first call answered hears the prompt).
List<String> to = new List<String>();
to.Add("3055195825");
to.Add("3054445567");
// Create an endpoint object to denote who the call is from.
string from = "7777777777";
// Call the message method of the Tropo object and pass in values.
tropo.Message(say, to, false, Channel.Voice, from, "reminder", Network.Pstn, true, 60);
// Render the JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
示例4: testAsk
public void testAsk()
{
Say say = new Say("Please enter your 5 digit zip code.");
Choices choices = new Choices("[5 DIGITS]");
Tropo tropo = new Tropo();
tropo.Ask(null, null, choices, null, "foo", null, say, null);
Assert.AreEqual(this.askJson, tropo.RenderJSON());
}
示例5: testAskWithEvents
public void testAskWithEvents()
{
Tropo tropo = new Tropo();
string[] signals = new string[] { "endCall", "tooLong" };
Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");
Choices choices = new Choices("1,2,3");
tropo.Ask(5, signals, false, choices, null, "test", true, say, 30);
tropo.Hangup();
Assert.AreEqual(this.askJsonWithEvents, tropo.RenderJSON());
}
示例6: testAskFromObject
public void testAskFromObject()
{
Say say = new Say("Please enter your 5 digit zip code.");
Choices choices = new Choices("[5 DIGITS]");
Ask ask = new Ask(choices, "foo", say);
Tropo tropo = new Tropo();
tropo.Ask(ask);
Assert.AreEqual(this.askJson, tropo.RenderJSON());
}
示例7: Ask
/// <summary>
/// Sends a prompt to the user and optionally waits for a response.
/// </summary>
/// <param name="attempts">How many times the caller can attempt input before an error is thrown.</param>
/// <param name="bargein">Should the user be allowed to barge in before TTS is complete?</param>
/// <param name="choices">The grammar to use in recognizing and validating input.</param>
/// <param name="minConfidence">How confident should Tropo be in a speech recognition match?</param>
/// <param name="name">identifies the return value of an ask, so you know the context for the returned information.</param>
/// <param name="required">Is input required here?</param>
/// <param name="say">This determines what is played or sent to the caller.</param>
/// <param name="timeout">The amount of time Tropo will wait, in seconds, after sending or playing the prompt for the user to begin a response.</param>
public void Ask(int? attempts, bool? bargein, Choices choices, int? minConfidence, string name, bool? required, Say say, float? timeout)
{
Ask ask = new Ask();
ask.Attempts = attempts;
ask.Bargein = bargein;
ask.Choices = choices;
ask.MinConfidence = minConfidence;
ask.Name = name;
ask.Required = required;
ask.Voice = String.IsNullOrEmpty(this.Voice) ? null : this.Voice;
ask.Say = say;
ask.Timeout = timeout;
Serialize(ask, "ask");
}
示例8: testAskWithOptions
public void testAskWithOptions()
{
Say say = new Say("Please enter your 5 digit zip code.");
Choices choices = new Choices("[5 DIGITS]");
Ask ask = new Ask();
ask.Choices = choices;
ask.Name = "foo";
ask.Say = say;
ask.Timeout = 30;
ask.Required = true;
ask.MinConfidence = 30;
ask.Attempts = 1;
ask.Bargein = false;
Tropo tropo = new Tropo();
tropo.Ask(ask);
Assert.AreEqual(this.askJsonWithOptions, tropo.RenderJSON());
}
示例9: testAskWithOptions
public void testAskWithOptions()
{
Say say = new Say("Please enter your 5 digit zip code.");
Choices choices = new Choices("[5 DIGITS]");
Ask ask = new Ask();
ask.choices = choices;
ask.name = "foo";
ask.say = say;
ask.timeout = 30;
ask.required = true;
ask.minConfidence = 30;
ask.attempts = 1;
ask.bargein = false;
Tropo tropo = new Tropo();
tropo.ask(ask);
Assert.AreEqual(this.askJsonWithOptions, TropoJSON.render(tropo));
}
示例10: Ask
/// <summary>
/// Overload method for Ask that allows events to be set via allowSignals.
/// </summary>
/// <param name="attempts">How many times the caller can attempt input before an error is thrown.</param>
/// <param name="allowSignals">Allows for the assignment of an interruptable signal for this Tropo function</param>
/// <param name="bargein">Should the user be allowed to barge in before TTS is complete?</param>
/// <param name="interdigitTimeout">Defines how long to wait - in seconds - between key presses to determine the user has stopped entering input.</param>
/// <param name="choices">The grammar to use in recognizing and validating input</param>
/// <param name="minConfidence">How confident should Tropo be in a speech reco match?</param>
/// <param name="name">Identifies the return value of an Ask, so you know the context for the returned information.</param>
/// <param name="recognizer">Tells Tropo what language to listen for</param>
/// <param name="required">Is input required here?</param>
/// <param name="say">This determines what is played or sent to the caller.</param>
/// <param name="timeout">The amount of time Tropo will wait, in seconds, after sending or playing the prompt for the user to begin a response.</param>
public void Ask(int? attempts, Array allowSignals, bool? bargein, int? interdigitTimeout, Choices choices, int? minConfidence, string name, string recognizer, bool? required, Say say, float? timeout)
{
Ask ask = new Ask();
ask.Attempts = attempts;
ask.allowSignals = allowSignals;
ask.Bargein = bargein;
ask.Choices = choices;
ask.InterdigitTimeout = interdigitTimeout;
ask.MinConfidence = minConfidence;
ask.Name = name;
ask.Recognizer = recognizer;
ask.Required = required;
ask.Voice = String.IsNullOrEmpty(this.Voice) ? null : this.Voice;
ask.Say = say;
ask.Timeout = timeout;
Serialize(ask, "ask");
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Create an array of signals - used to interupt the Ask.
string[] signals = new string[] {"endCall", "tooLong"};
// A prompt to use with the Ask.
Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");
// Choices for the Ask.
Choices choices = new Choices("1,2,3");
// Set up the dialog.
tropo.Ask(5, signals, false, choices, null, "test", true, say, 30);
tropo.Hangup();
// Render the dialog JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
示例12: testMessageUseAllOptions
public void testMessageUseAllOptions()
{
Say say = new Say("This is an announcement");
Tropo tropo = new Tropo();
tropo.Voice = Voice.BritishEnglishFemale;
string from = "3055551212";
List<String> to = new List<String>();
to.Add("3055195825");
tropo.Message(say, to, false, Channel.Text, from, "foo", Network.SMS, true, 10);
Assert.AreEqual(this.messageJsonAllOptions, tropo.RenderJSON());
}
示例13: testMessageFromObject
public void testMessageFromObject()
{
Say say = new Say("This is an announcement");
string from = "3055551212";
Message message = new Message();
List<String> to = new List<String>();
to.Add("3055195825");
message.Say = say;
message.To = to;
message.From = from;
message.AnswerOnMedia = false;
message.Channel = Channel.Text;
message.Network = Network.SMS;
message.Timeout = 10;
Tropo tropo = new Tropo();
tropo.Voice = Voice.BritishEnglishFemale;
tropo.Message(message);
Assert.AreEqual(this.messageJson, tropo.RenderJSON());
}
示例14: On
public On(string @event, string next, Say say)
{
Event = @event;
Next = next;
Say = say;
}
示例15: Ask
public Ask(Choices choices, string name, Say say)
{
Choices = choices;
Name = name;
Say = new [] {say};
}