Created
December 19, 2016 08:50
-
-
Save abhijitmehta/dce5dc1d5f68f28003cad2391a36605c to your computer and use it in GitHub Desktop.
sampleC#Conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In Package Manager, run: | |
// Install-Package Twilio.Mvc -DependencyVersion HighestMinor | |
using System.Web.Mvc; | |
using Twilio.Mvc; | |
using Twilio.TwiML; | |
using Twilio.TwiML.Mvc; | |
public class VoiceController : TwilioController | |
{ | |
[HttpPost] | |
public TwiMLResult Index(VoiceRequest request) | |
{ | |
// Get information about the incoming call, like the city associated | |
// with the phone number (if Twilio can discover it) | |
var city = request.FromCity; | |
var caller = request.From ; | |
var called = request.To ; | |
var callSid = request.CallSid ; | |
var confName = caller+"_"+called+"_"+callSid | |
var response = new TwilioResponse(); | |
response.Say($"You will be connected to an agent shortly", new {voice = "alice"}); | |
response.Play("https://demo.twilio.com/docs/classic.mp3"); | |
object conferenceOptions; | |
//Set your conference options here , one example below | |
conferenceOptions = new | |
{ | |
startConferenceOnEnter = false, | |
endConferenceOnExit = true | |
} | |
response.DialConference(confName, conferenceOptions); | |
return TwiML(response); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment