示例#1
0
        /**
         * Initialize a "joinPrompt" command.
         *
         * @param  Key[]
         * @return this
         */
        public Voice JoinPrompt(params Key[] keys)
        {
            // initialize join prompt
            JoinPrompt joinPrompt = new JoinPrompt(keys);

            // push to our commands
            this.rootArray.Add(joinPrompt.GetAction());

            return(this);
        }
        public void testConferenceWithPromptsAndpromptLogSecurity()
        {
            Tropo tropo = new Tropo();

            string[] signals = new string[] { "conferenceOver" };
            tropo.Call("3035551212");
            tropo.Say("Welcome to the conference.");
            JoinPrompt  joinPrompt  = new JoinPrompt("somebody join the conference");
            LeavePrompt leavePrompt = new LeavePrompt("some one leave the conference");

            tropo.Conference("123456789098765432", signals, 4, false, "testConference", false, true, "#", joinPrompt, leavePrompt, "none");

            Assert.AreEqual(this.conferenceJsonWithWithPromptsAndpromptLogSecurity, renderJSONToText(tropo));
        }
        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, "#");
                    JoinPrompt  joinPrompt  = new JoinPrompt("somebody join the conference");
                    LeavePrompt leavePrompt = new LeavePrompt("some one leave the conference");
                    tropo.Conference(tropoSession.Parameters["conferenceID"], signals, 3, false, "testConference", false, true, "#", joinPrompt, leavePrompt, "none");
                    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."));
                }

                tropo.RenderJSON(Response);
            }
        }