本文整理汇总了C#中TropoCSharp.Tropo.Tropo.Say方法的典型用法代码示例。如果您正苦于以下问题:C# Tropo.Say方法的具体用法?C# Tropo.Say怎么用?C# Tropo.Say使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TropoCSharp.Tropo.Tropo
的用法示例。
在下文中一共展示了Tropo.Say方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// Get the JSON submitted from Tropo.
string sessionJSON = TropoUtilities.parseJSON(reader);
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
try
{
// Create a new Session object and pass in the JSON submitted from Tropo.
Session tropoSession = new Session(sessionJSON);
// Get parameters submitted with Session API call.
string sendToNumber = tropoSession.Parameters.Get("sendToNumber");
string sendFromNumber = tropoSession.Parameters.Get("sendFromNumber");
string channel = tropoSession.Parameters.Get("channel");
string network = tropoSession.Parameters.Get("network");
string msg = tropoSession.Parameters.Get("msg");
// Send an outbound message.
tropo.Call(sendToNumber, sendFromNumber, network, channel, true, 60, null, null);
tropo.Say(msg);
// Render the JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
catch (JsonReaderException ex)
{
EventLog log = new EventLog();
log.Source = "TROPOWEBAPI";
log.WriteEntry("Tropo WebAPI Exception " + ex.Message, EventLogEntryType.Error);
Response.StatusCode = 500;
tropo.Say("An error occured in the application. Bad JSON");
}
catch (Exception ex)
{
EventLog log = new EventLog();
log.Source = "TROPOWEBAPI";
log.WriteEntry("Tropo WebAPI Exception " + ex.Message, EventLogEntryType.Error);
Response.StatusCode = 500;
tropo.Say("An error occured in the application.");
}
finally
{
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();
// 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());
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// Get the JSON submitted from Tropo.
string resultJSON = TropoUtilities.parseJSON(reader);
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
try
{
// Create a new Result object and pass in the JSON submitted from Tropo.
Result tropoResult = new Result(resultJSON);
// Parse the Actions object and get the value property.
JContainer Actions = TropoUtilities.parseActions(tropoResult.Actions);
// Get the input submited by the user.
// This value can be used to query a database, hit a web service, etc.
// In the example, we'll simply read the number back to the caller.
string answer = TropoUtilities.removeQuotes(Actions["value"].ToString());
tropo.Say("You entered, " + TropoUtilities.addSpaces(answer) + ". Goodbye");
}
// In the event of an error in rendering the page, play an error message to the caller.
catch (JsonReaderException ex)
{
tropo.Say("An error occured. " + ex.Message);
}
catch (Exception ex)
{
tropo.Say("An error occured. " + ex.Message);
}
finally
{
// Render JSON for Tropo to consume.
tropo.Hangup();
Response.Write(tropo.RenderJSON());
}
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
if (!String.IsNullOrEmpty(Request.QueryString["signal"]))
{
if (Request.QueryString["signal"] == "interruptConference")
{
tropo.Say(". Now, rejoin the conference. Press the pound key to exit without hanging up.");
tropo.Conference(Request.QueryString["confid"], false, "testConference", false, true, "#");
tropo.Say("You have now left the conference.");
tropo.Hangup();
}
else
{
tropo.Say("The call is now over. Gooddbye.");
tropo.Hangup();
}
}
else
{
// Get the JSON submitted from Tropo.
string sessionJSON = TropoUtilities.parseJSON(reader);
// Create a new Session object and pass in the JSON submitted from Tropo.
Session tropoSession = new Session(sessionJSON);
// Create a signal to end the conference.
string[] signals = new string[] { "interruptConference", "endCall" };
// Call an outbound number and create a conference.
tropo.Call(tropoSession.Parameters["callToNumber"]);
tropo.Say("Welcome to the conference.");
tropo.Conference(tropoSession.Parameters["conferenceID"], signals, false, "testConference", false, true, "#");
tropo.On("interruptConference", "Conference.aspx?signal=interruptConference&confid=" + tropoSession.Parameters["conferenceID"], new Say("You have left the conference."));
tropo.On("endCall", "Conference.aspx?signal=endCall", new Say("You have left the conference."));
}
// Render the JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
}
示例5: Page_Load
public void Page_Load(object sender, EventArgs args)
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Call the say method of the Tropo object and give it a prompt to say.
tropo.Say("Hello World!");
// Render the JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Play an error message to the caller.
tropo.Say("I'm sorry, there was an error. Please try you call again later.");
// End the current session.
tropo.Hangup();
// Render JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader sr = new StreamReader(Request.InputStream))
{
// Get the JSON submitted from Tropo.
string sessionJSON = GetJSON(sr);
// Create a new Session object and pass in the JSON submitted from Tropo.
Session tropoSession = new Session(sessionJSON);
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Call an outbound number and create a conference.
tropo.Call(tropoSession.Parameters["callToNumber"]);
tropo.Say("Welcome to the conference.");
tropo.Conference(tropoSession.Parameters["conferenceID"], false, "testConference", false, true, "#");
tropo.Say("Thanks for joining our conference. Goodbye.");
tropo.Hangup();
// Render the JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Create a new instance of the Tropo object.
Tropo tropo = new Tropo();
// Say an introductory message to the caller.
tropo.Say("Welcome to the claim test application.");
// Create new choices to use with Ask.
Choices choices = new Choices("[5 DIGITS]");
// Create new ask with desired prompt that will be sent to user.
tropo.Ask(3, false, choices, null, "claim_id", true, new Say("Please enter your 5 digits claim ID."), 5);
// Create On handlers for Tropo event.
tropo.On(Event.Continue, "Answer.aspx", null); // Fires when the user provides valid input.
tropo.On(Event.Error, "Error.aspx", null); // Fires when an error occurs.
tropo.On(Event.Incomplete, "Error.aspx", null); // Fires when the user does not enter correct input.
// Render JSON for Tropo to consume.
Response.Write(tropo.RenderJSON());
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// Get the JSON submitted from Tropo.
string sessionJSON = TropoUtilities.parseJSON(reader);
// Create a new instance of the Tropo class.
Tropo tropo = new Tropo();
try
{
// Create a new Session object and pass in the JSON submitted from Tropo.
Session tropoSession = new Session(sessionJSON);
tropo.Say("The Tropo Session ID is " + tropoSession.Id);
tropo.Say("The channnel of the called party is " + tropoSession.To.Channel);
tropo.Say("The channel of the calling party is " + tropoSession.From.Channel);
tropo.Say("This initial text sent with the call is " + tropoSession.InitialText);
tropo.Say("The From SIP header on the call is " + TropoUtilities.removeQuotes(tropoSession.Headers["From"]));
}
catch (JsonReaderException)
{
tropo.Say("Sorry, an error occured. I choked on some JSON");
}
catch (Exception ex)
{
tropo.Say("Sorry, an error occured. " + ex.Message);
}
finally
{
Response.Write(tropo.RenderJSON());
}
}
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// Get the JSON submitted from Tropo.
string resultJSON = TropoUtilities.parseJSON(reader);
// Create a new instance of the Tropo class.
Tropo tropo = new Tropo();
try
{
// Create a new Result object and pass in the JSON submitted from Tropo.
Result tropoResult = new Result(resultJSON);
// Get Actions container and parse.
JContainer Actions = TropoUtilities.parseActions(tropoResult.Actions);
// A simple example showing how to access properties of the Result object.
tropo.Say("The State of the current session is " + tropoResult.State);
tropo.Say("The Sequence of this Result payload is " + tropoResult.Sequence);
tropo.Say("The session ID for the current session is is " + TropoUtilities.addSpaces(tropoResult.SessionId));
tropo.Say("The value selected by the caller is " + TropoUtilities.removeQuotes(Actions["value"].ToString()));
}
catch (JsonReaderException)
{
tropo.Say("Sorry, an error occured. I choked on some JSON");
}
catch (Exception ex)
{
tropo.Say("Sorry, an error occured. " + ex.Message);
}
finally
{
Response.Write(tropo.RenderJSON());
}
}
}
示例11: testConferenceWithEvents
public void testConferenceWithEvents()
{
Tropo tropo = new Tropo();
string[] signals = new string[] { "conferenceOver" };
tropo.Call("3035551212");
tropo.Say("Welcome to the conference.");
tropo.Conference("123456789098765432", signals, false, "testConference", false, true, "#");
Assert.AreEqual(this.conferenceJsonWithEvents, tropo.RenderJSON());
}
示例12: testConference
public void testConference()
{
Tropo tropo = new Tropo();
tropo.Call("3035551212");
tropo.Say("Welcome to the conference.");
tropo.Conference("123456789098765432", false, "testConference", false, true, "#");
tropo.Say("Thank you for joining the conference.");
Assert.AreEqual(this.conferenceJson, tropo.RenderJSON());
}