예제 #1
0
        public ActionResult Index()
        {
            VoiceBase voice = new VoiceBase();

            voice.Say("Welcome to my Tropo Web API.");

            Say timeout = new Say(
                VALUE("Sorry, I did not hear anything. Please call back."),
                EVENT("timeout")
                );

            Say say = new Say(VALUE("Please leave a message"), ARRAY(timeout));

            Choices choices = new Choices(TERMINATOR("#"));

            Transcription transcription = new Transcription(
                ID("1234"),
                URL("mailto:[email protected]")
                );

            voice.Record(
                ATTEMPTS(3),
                BARGEIN(false),
                METHOD("POST"),
                REQUIRED(true),
                INSTANCE(say),
                NAME("foo"),
                URL("http://openovate.com/globe.php"),
                FORMAT(Format.WAV),
                INSTANCE(choices),
                INSTANCE(transcription)
                );

            return(Content(voice.Render().ToString(), "application/json"));
        }
        public ActionResult Index()
        {
            VoiceBase voice = new VoiceBase();

            voice.Say("Welcome to my Tropo Web API, please hold while you are being transferred.");

            Say say = new Say("Press 1 to accept this call or any other number to reject");

            Choices choices = new Choices(
                VALUE("1"),
                MODE(Mode.DTMF)
                );

            Ask ask = new Ask(
                INSTANCE(choices),
                NAME("color"),
                INSTANCE(say),
                TIMEOUT(60)
                );

            On connect1 = new On(
                EVENT("connect"),
                INSTANCE(ask)
                );

            On connect2 = new On(
                EVENT("connect"),
                INSTANCE(new Say("You are now being connected."))
                );

            On ring = new On(
                EVENT("ring"),
                INSTANCE(new Say("http://openovate.com/hold-music.mp3"))
                );

            On connect = new On(ARRAY(ring, connect1, connect2));

            voice.Transfer(
                TO("9054799241"),
                NAME("foo"),
                INSTANCE(connect),
                REQUIRED(true),
                TERMINATOR("*")
                );

            voice.On(
                EVENT("incomplete"),
                NEXT("/transferwhisper/hangup"),
                INSTANCE(new Say("You are now being disconnected."))
                );

            return(Content(voice.Render().ToString(), "application/json"));
        }