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());
        }
Exemple #2
0
 /// <summary>
 /// Overload for Message that allows a Message object to be passed.
 /// </summary>
 /// <param name="message">A Message object.</param>
 public void Message(Message message)
 {
     Message(message.Say, message.To, message.AnswerOnMedia, message.Channel, message.From, message.Name, message.Network, message.Required, message.Timeout);
 }
Exemple #3
0
        /// <summary>
        /// A shortcut method to create a session, say something, and hang up, all in one step. 
        /// This is particularly useful for sending out a quick SMS or IM. 
        /// </summary>
        /// <param name="say">This determines what is played or sent to the caller.</param>
        /// <param name="to">The destination to make a call to or send a message to.</param>
        /// <param name="answerOnMedia">If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end.</param>
        /// <param name="channel">This defines the channel used to place new calls.</param>
        /// <param name="from">A string representing who the call is from.</param>
        /// <param name="name">Identifies the return value of a Message, so you know the context for the returned information.</param>
        /// <param name="network">Network is used mainly by the text channels; values can be SMS when sending a text message, or a valid IM network name such as AIM, MSN, JABBER, YAHOO and GTALK.</param>
        /// <param name="required">Determines whether Tropo should move on to the next action.</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 Message(Say say, IEnumerable<String> to, bool? answerOnMedia, string channel, string from, string name, string network, bool? required, float? timeout)
        {
            Message message = new Message();
            message.Say = say;
            message.To = to;
            message.AnswerOnMedia = answerOnMedia;
            message.Channel = channel;
            message.From = from;
            message.Name = name;
            message.Network = network;
            message.Required = required;
            message.Timeout = timeout;
            message.Voice = String.IsNullOrEmpty(this.Voice) ? null : this.Voice;

            Serialize(message, "message");
        }
 /// <summary>
 /// Overload for Message that allows a Message object to be passed.
 /// </summary>
 /// <param name="message">A Message object.</param>
 public void message(Message message)
 {
     this.message(message.say, message.to, message.answerOnMedia, message.channel, message.from, message.name, message.network, message.required, message.timeout);
 }
        /// <summary>
        /// A shortcut method to create a session, say something, and hang up, all in one step. 
        /// This is particularly useful for sending out a quick SMS or IM. 
        /// </summary>
        /// <param name="say">This determines what is played or sent to the caller.</param>
        /// <param name="to">The destination to make a call to or send a message to.</param>
        /// <param name="answerOnMedia">If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end.</param>
        /// <param name="channel">This defines the channel used to place new calls.</param>
        /// <param name="from">An Endpoint object representing who the call is from.</param>
        /// <param name="name">Identifies the return value of a Message, so you know the context for the returned information.</param>
        /// <param name="network">Network is used mainly by the text channels; values can be SMS when sending a text message, or a valid IM network name such as AIM, MSN, JABBER, YAHOO and GTALK.</param>
        /// <param name="required">Determines whether Tropo should move on to the next action.</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 message(Say say, ArrayList to, bool? answerOnMedia, string channel, Endpoint from, string name, string network, bool? required, float? timeout)
        {
            Message message = new Message();
            message.say = say;
            message.to = to;
            message.answerOnMedia = answerOnMedia;
            message.channel = channel;
            message.from = from;
            message.name = name;
            message.network = network;
            message.required = required;
            message.timeout = timeout;
            message.voice = String.IsNullOrEmpty(this.Voice) ? null : this.Voice;

            serialize(message, "message");
        }
        public void testMessageFromObject()
        {
            Say say = new Say("This is an announcement");
            Endpoint from = new Endpoint("3055551212", null, null, null);
            Message message = new Message();
            ArrayList to = new ArrayList();
            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.British_English_female;
            tropo.message(message);

            Assert.AreEqual(this.messageJson, TropoJSON.render(tropo));
        }