本文整理汇总了C#中TropoCSharp.Tropo.Tropo.Message方法的典型用法代码示例。如果您正苦于以下问题:C# Tropo.Message方法的具体用法?C# Tropo.Message怎么用?C# Tropo.Message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TropoCSharp.Tropo.Tropo
的用法示例。
在下文中一共展示了Tropo.Message方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteSession
/// <summary>
/// Must be used from an endpoint URL.
/// This will parse the active session and send the specified messages.
/// As of now, it only supports sending through the MSN Network IM
/// </summary>
/// <param name="reader"></param>
/// <param name="messages"></param>
/// <returns></returns>
public static string ExecuteSession(StreamReader reader, Dictionary<string, List<string>> messages)
{
string sessionJSON = reader.ReadToEnd();
Tropo tropo = new Tropo();
try
{
Session tropoSession = new Session(sessionJSON);
foreach (var kvp in messages)
{
string to = kvp.Key;
string from = "[email protected]";
foreach (string msg in kvp.Value)
{
tropo.Message(new Say(msg), new List<string>() { to }, false, Channel.Text, from, from, Network.Msn, false, 30);
}
}
}
catch
{
}
return 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 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());
}
示例3: 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());
}
示例4: 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());
}