Home > FluentTwilioML

FluentTwilioML

FluentTwilioML is a project mainly written in C#, based on the MIT license.

Fluent interface for Twilio's TwiML

= FluentTwilioML

Use a fluent interface to generate TwiML responses for use by Twilio.

public virtual ActionResult Index()
    {
        return new TwilioResult(r =>
            {
                r.Gather(Url.Action("ChooseItem"), HttpMethod.POST, 1, null, null,x =>
                    {
                        x.Say("You Have reached Our Company");
                        x.Say("If you know your partie's extention, you may dial it at any time.");
                        x.Say("For Sales, Press 1");
                        x.Say("For Billing, Press 2");
                        x.Say("For Support, Press 3");
                        x.Say("For a Company Directory, Press 4");
                        x.Say("To Repeat these options, Press 9");
                        x.Pause(5);
                    });
                r.Redirect(Url.Action("Index"));
            });
    }

Generates:

You Have reached Our Company If you know your partie's extention, you may dial it at any time. For Sales, Press 1 For Billing, Press 2 For Support, Press 3 For a Company Directory, Press 4 To Repeat these options, Press 9 /Twilio

You can also access all of the parameters from a call within a controller: private TwilioResult NightTimeMenu() { var from = this.TwilioRequestParams().From; var apiVersion = this.TwilioRequestParams().ApiVersion; var accountSid = this.TwilioRequestParams().AccountSid; ... } Copyright (c) 2010 Chris Kooken and contributors. See LICENSE for details.

Previous:cosmocode-solr