This project is read-only.
Project Description
TwilML# is a community project for a strongly typed and IntelliSense capable library for Twilio's TwilML API.

This is a community project, not a Twilio supported library.

While Twilio does have a supported TwilML library of their own in the works, it heavily depends on .NET 3.5 and uses dynamic types in order to support loose versioning and compact streamlined code.

This library comes close to the compactness of Twilio's library while maintaining support for .NET 2.0, strong typing and IntelliSense that you wouldn't get with Twilio's library. If compile-time validation is important to you, this might be a good alternative. Otherwise you may be better off using Twilio's version. At Twilio's suggestion, I'm posting this library as a community alternative.

Here's a quickie example of using this library:

public ActionResult Index(string CallSid, string AccountSid, string From, string To, string CallStatus, string ApiVersion, string Direction, string ForwardedFrom)
    Response response = new Response();
    Gather gather = response.Append(new Gather(VirtualPathUtility.ToAbsolute("~/Twilio/MainMenuHandler"), 1) { Timeout = 0 });
    gather.Append(new Say("Welcome to Matrix IO."));
    gather.Append(new Pause(1));
    gather.Append(new Say("If you know the extension of the party you are calling you may dial it at any time. Otherwise,"));
    response.Append(new Redirect(VirtualPathUtility.ToAbsolute("~/Twilio/MainMenu")));

    return Content(response, "application/xml", new UTF8Encoding(false));
This is obviously a sample Controller method for ASP.NET MVC 3 but you can just as easily use this in classic ASP.NET page or handler calling by Response.Write(response).

Last edited Jul 6, 2011 at 12:47 AM by jclary, version 6