This project is read-only.

Samples Projects

There are two Samples projects in the TSL.NET solution:
  • NebulaRnD.TwilioServer.Samples.Win
    • Windows Forms sample in C# initiates REST call to
    • The form was significantly enhanced in v0.2.0 to allow the single form to support all samples.
  • NebulaRnD.TwilioServer.Samples.Web
    • ASP.NET (classic) pages only get called in response to Win samples. TwiML is returned to established calls.
Before running the samples, edit the App.config and Web.config files for the above projects, adding your own Account SID, AuthToken, and other data.
To run the samples, Run the Win project. Your Account SID and Token will display in the form. Select a sample from the dropdown list. Provide extra data if required. Click Run. Depending on the sample your telephone will ring, or (for Account samples) data will be displayed in the Visual Studio Output window.


This is a Windows Forms project in C# that currently contains four main samples and various assocated "sub samples".
  • New in v0.2.0
    • Group of pre-defined numbers displays using data from App.config.
      • From/To numbers for SMS
      • From/To numbers for other samples
      • Second To number for Conference sample
    • A checkbox is provided for developers using the Twilio Sandbox.
      • If you check this box the outbound number used for SMS will be forced to your Sandbox phone number.
  • Account Samples executing REST calls
    • Retrieve list of recordings
    • Retrieve Outgoing Caller IDs for account
    • Retrieve list of phone calls for account
    • Retrieve data for a single phone call
    • Change the friendly name on the account
    • Retrieve list of notifications
    • Retrieve a single notification
    • Delete recordings for today
Those samples use Debug.WriteLine to log their activity. The output can easily be re-routed elsewhere.
  • Weather Sample
    • Provide a USA zipcode in the winform before clicking. In effect you get called and told the current temperature for whatever zip code you entered in the form. This sample places a call using REST, then from the Twilio server posts back to a page in the Web project with the zip code in the query string. A web service call is made to get the current weather for that zip code. The result is parsed and the current temperature is embedded in a Say verb. The TwiML is returned to the Twilio server, and the person on the call hears the temperature spoken to them.
  • Recording Sample demonstrates multiple calls back to the server depending on user keypress responses
    • As with the Weather Sample, the Twilio server calls a provided telephone number. When someone answers a postback is made to the web project, TwiML is returned, and the called person is asked to record a message and press Star. A second postback is made to echo the recording back to the person and ask if it's OK. If the user presses 1, a link to the recording is saved in a log file. If the user presses 2, they can re-record the message.
  • Conference Sample
    • After entering a telephone number in the Win form, a call is made to the primary To phone number (specified in App.config). The person accepting that call gets put into a conference with music playing. A call is made to the number entered in the form, and the conference begins. The conference ends when the first person leaves.
  • SMS Sample
    • Enter text for message to be sent. REST query sends the message.
    • StatusCallback URL points to new page in Web Samples project. This simply logs incoming status data from Twilio.

Please feel free to add more samples!

Last edited Jun 21, 2010 at 5:29 AM by TonyGravagno, version 3


No comments yet.