CodePlexProject Hosting for Open Source Software
1 person following this project (follow)
public ActionResult PlaceCall() { var twilioApi = new TwilioApi(); twilioApi.PlaceCall( Request.Form["PhoneNumber"], new Uri(String.Format("{0}://{1}/{2}", Request.Url.Scheme,Request.Url.Authority,"/TwilioListener/Voice/OutBoundCallInstructions"))); return RedirectToAction("Index"); }
[TwilioFilter] public void OutBoundCallInstructions() { var output = new ResponseType() { Items = new object[] { new SayVerb() {Value = "hello world"}, new PlayVerb() {Value = "http://demo.twilio.com/hellomonkey/monkey.mp3"}, new GatherVerb() { numDigits = 1, action = "StopCallingMe", method = MethodValues.POST, Items = new object[] { new SayVerb(){Value="To not be called again, press 1."} } } } }.ToXml(); Response.Write(output); }
[TwilioFilter] public void StopCallingMe() { if (int.Parse(Request["Digits"]) != 1) return; var callRequest = (CallRequest) this.HttpContext.Items["CallRequest"]; var output = new ResponseType() { Items = new object[] { new SayVerb() { Value = "you asked to not be called again at " + callRequest.Called + ", we won't thanks." } } }.ToXml(); Response.Write(output); }
<add key="Twilio.AccountSid" value=""/> <add key="Twilio.AuthToken" value=""/> <add key="Twilio.OutboundNumber" value=""/>
Last edited Aug 17 2010 at 1:27 PM by simnova, version 4