This action determines the event(s) to be handled.
Inheritance: TropoBase
Esempio n. 1
0
        /// <summary>
        /// Adds an event callback so that your application may be notified when a particular event occurs.
        /// </summary>
        /// <param name="event">This defines which event the on action handles.</param>
        /// <param name="next">When an associated event occurs, Tropo will post to the URL defined here. If left blank, Tropo will simply hangup.</param>
        /// <param name="say">This determines what is played or sent to the caller.</param>
        public void On(string @event, string next, Say say)
        {
            On on = new On();

            on.Event = @event;
            on.Next  = next;
            on.Say   = say;

            Serialize(on, "on");
        }
Esempio n. 2
0
        /// <summary>
        /// Transfers an already answered call to another destination / phone number.
        /// Call may be transferred to another phone number or SIP address, which is set through the "to" parameter and is in URL format.
        /// </summary>
        /// <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="choices">The grammar to use in recognizing and validating input.</param>
        /// <param name="from">A string representing who the call is from.</param>
        /// <param name="on">An On object.</param>
        /// <param name="ringRepeat">The number of rings to allow on the outbound call attempt.</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>
        /// <param name="to">The new destination for the incoming call as a URL.</param>
        public void Transfer(bool?answerOnMedia, Choices choices, string from, On on, float?timeout, IEnumerable <String> to)
        {
            Transfer transfer = new Transfer();

            transfer.AnswerOnMedia = answerOnMedia;
            transfer.Choices       = choices;
            transfer.From          = from;
            transfer.On            = on;
            transfer.Timeout       = timeout;
            transfer.To            = to;

            Serialize(transfer, "transfer");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object
            Tropo tropo = new Tropo();
            
            // Set the grammar to use when collecting input.
            Choices choices = new Choices("[5 DIGITS]");
            
            // Create an event handler for when the input collection is finished. Tropo will POST Result object JSON.
            On on = new On(Event.Continue, "http://my-web-application-url/post", new Say("Please hold."));

            // Call the ask method of the Tropo object and pass in values. 
            tropo.Ask(3, false, choices, null, "zip", true, new Say("Please enter your 5 digit zip code"), 5);
            tropo.On(on);

            // Render the JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
Esempio n. 4
0
        /// <summary>
        /// Overload for Transfer that allows events to be set via allowSignals.
        /// </summary>
        /// <param name="answerOnMedia"></param>
        /// <param name="allowSignals">Allows for the assignment of an interruptable signal for this Tropo function</param>
        /// <param name="choices"></param>
        /// <param name="from"></param>
        /// <param name="on"></param>
        /// <param name="timeout"></param>
        /// <param name="to"></param>
        public void Transfer(bool? answerOnMedia, Array allowSignals, Choices choices, string from, On on, float? timeout, IEnumerable<String> to)
        {
            Transfer transfer = new Transfer();
            transfer.AnswerOnMedia = answerOnMedia;
            transfer.allowSignals = allowSignals;
            transfer.Choices = choices;
            transfer.From = from;
            transfer.On = on;
            transfer.Timeout = timeout;
            transfer.To = to;

            Serialize(transfer, "transfer");
        }
Esempio n. 5
0
 /// <summary>
 /// Overload for On that allows an On object to be passed.
 /// </summary>
 /// <param name="on">An On object.</param>
 public void On(On on)
 {
     On(on.Event, on.Next, on.Say);
 }
Esempio n. 6
0
        /// <summary>
        /// Adds an event callback so that your application may be notified when a particular event occurs.
        /// </summary>
        /// <param name="event">This defines which event the on action handles.</param>
        /// <param name="next">When an associated event occurs, Tropo will post to the URL defined here. If left blank, Tropo will simply hangup.</param>
        /// <param name="say">This determines what is played or sent to the caller.</param>      
        public void On(string @event, string next, Say say)
        {
            On on = new On();
            on.Event = @event;
            on.Next = next;
            on.Say = say;

            Serialize(on, "on");
        }
Esempio n. 7
0
        /// <summary>
        /// Overload for Transfer that allows events to be set via allowSignals.
        /// </summary>
        /// <param name="answerOnMedia"></param>
        /// <param name="allowSignals">Allows for the assignment of an interruptable signal for this Tropo function</param>
        /// <param name="choices"></param>
        /// <param name="from"></param>
        /// <param name="on"></param>
        /// <param name="timeout"></param>
        /// <param name="to"></param>
        public void Transfer(bool?answerOnMedia, Array allowSignals, Choices choices, string from, int?interdigitTimeout, On on, float?timeout, IEnumerable <String> to)
        {
            Transfer transfer = new Transfer();

            transfer.AnswerOnMedia     = answerOnMedia;
            transfer.allowSignals      = allowSignals;
            transfer.Choices           = choices;
            transfer.From              = from;
            transfer.InterdigitTimeout = interdigitTimeout;
            transfer.On      = on;
            transfer.Timeout = timeout;
            transfer.To      = to;

            Serialize(transfer, "transfer");
        }
Esempio n. 8
0
 /// <summary>
 /// Overload for On that allows an On object to be passed.
 /// </summary>
 /// <param name="on">An On object.</param>
 public void On(On on)
 {
     On(on.Event, on.Next, on.Say);
 }
Esempio n. 9
0
        /// <summary>
        /// Transfers an already answered call to another destination / phone number.
        /// Call may be transferred to another phone number or SIP address, which is set through the "to" parameter and is in URL format.
        /// </summary>
        /// <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="choices">The grammar to use in recognizing and validating input.</param>
        /// <param name="from">An Endpoint object representing who the call is from.</param>
        /// <param name="on">An On object.</param>
        /// <param name="ringRepeat">The number of rings to allow on the outbound call attempt.</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>
        /// <param name="to">The new destination for the incoming call as a URL.</param>
        public void transfer(bool? answerOnMedia, Choices choices, Endpoint from, On on, int? ringRepeat, float? timeout, ArrayList to)
        {
            Transfer transfer = new Transfer();
            transfer.answerOnMedia = answerOnMedia;
            transfer.choices = choices;
            transfer.from = from;
            transfer.on = on;
            transfer.ringRepeat = ringRepeat;
            transfer.timeout = timeout;
            transfer.to = to;

            serialize(transfer, "transfer");
        }
Esempio n. 10
0
 /// <summary>
 /// Overload for On that allows an On object to be passed.
 /// </summary>
 /// <param name="on">An On object.</param>
 public void on(On on)
 {
     this.on(on.@event, on.next, on.say);
 }
Esempio n. 11
0
        /// <summary>
        /// Adds an event callback so that your application may be notified when a particular event occurs.
        /// </summary>
        /// <param name="event">This defines which event the on action handles.</param>
        /// <param name="next">When an associated event occurs, Tropo will post to the URL defined here. If left blank, Tropo will simply hangup.</param>
        /// <param name="say">This determines what is played or sent to the caller.</param>      
        public void on(string @event, string next, Say say)
        {
            On on = new On();
            on.@event = @event;
            on.next = next;
            on.say = say;

            serialize(on, "on");
        }