Esempio n. 1
0
 public void Example_2()
 {
     var response = new TwilioResponse();
     response.Say("Please leave a message at the beep. Press the star key when finished.");
     response.Record(new { action = "http://foo.edu/handleRecording.php", method = "GET", maxLength = 20, finishOnKey = "*" });
     response.Say("I did not receive a recording");
     Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
 }
Esempio n. 2
0
        public void Can_Generate_Consecutive_Mixed_Says()
        {
            var response = new TwilioResponse();
            response.Say("Hello world", new { voice = "woman" });
            response.Say("Hello world2", new { loop = 3 });

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 3
0
        public void Example_1()
        {
            var response = new TwilioResponse();
            response.Say("I will pause 10 seconds starting now!");
            response.Pause(10);
            response.Say("I just paused 10 seconds");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 4
0
        public void _5_0()
        {
            var name = "Monkey";

            var response = new TwilioResponse();
            response.Say("Hello " + name);
            response.Say(name + ", thanks for the call!");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 5
0
        public void Example_2()
        {
            var response = new TwilioResponse();
            response.BeginGather(new { action = "/process_gather.php", method = "GET" });
            response.Say("Please enter your account number, followed by the pound sign");
            response.EndGather();
            response.Say("We didn't receive any input. Goodbye!");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 6
0
        public void _1_4a()
        {
            var name = "Monkey";

            var response = new TwilioResponse();
            response.Say("Hello " + name);
            response.Play("http://demo.twilio.com/hellomonkey/monkey.mp3");
            response.BeginGather(new { numDigits = 1, action = "hello-monkey-handle-key.php", method = "POST" });
            response.Say("To speak to a real monkey, press 1. Press 2 to record your own monkey howl. Press any other key to start over.");
            response.EndGather();

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
    // /Voice
    public TwiMLResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("Hello. It's me.", new { voice = "alice", language = "en-GB" });
        response.Play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3");
        response.BeginGather(new { numDigits = "1", action = "/Voice/HandleGather" });
        response.Say("To speak to a real person, press 1.\n" +
                     "Press 2 to record a message for a Twilio educator.\n" +
                     "Press any other key to start over.");
        response.EndGather();
        return(TwiML(response));
    }
Esempio n. 8
0
        public void _1_4a()
        {
            var name = "Monkey";

            var response = new TwilioResponse();

            response.Say("Hello " + name);
            response.Play("http://demo.twilio.com/hellomonkey/monkey.mp3");
            response.BeginGather(new { numDigits = 1, action = "hello-monkey-handle-key.php", method = "POST" });
            response.Say("To speak to a real monkey, press 1. Press 2 to record your own monkey howl. Press any other key to start over.");
            response.EndGather();

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 9
0
        public TwilioResponse PreConnect(VoiceRequest request, string callingPartyId)
        {
            var response = new TwilioResponse();

            var callingParty = directory.GetContact(callingPartyId);

            response.BeginGather(new { numDigits = 1, action = "/Router/RespondToPreConnect" });
            response.Say(string.Format("You have an incoming call from {0}", callingParty.Name));
            response.Say("Press 1 to be connected");
            response.Say("Press 2 to hangup");
            response.EndGather();
            response.Hangup();

            return(response);
        }
Esempio n. 10
0
 public void EnterNumber(
     string message,
     Dictionary <string, string> urlParameters,
     int amountOfDigis = 1,
     int wait_time     = 10
     )
 {
     response.BeginGather(new
     {
         action    = GetCallbackUrl(TwillioConfig.VoiceCallbackUrl, urlParameters),
         numDigits = amountOfDigis
     });
     response.Say(message);
     response.EndGather();
 }
        public ActionResult ServiceRequest(string CallSid, string Digits)
        {
            var            call     = GetCall(CallSid);
            TwilioResponse response = new TwilioResponse();

            switch (Digits)
            {
            case "0":
            {
                StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Return to Menu"));
                response.Say("Returning to the main menu.");
                response.Redirect(Url.Action("IncomingCall"));
            }
            break;

            case "1":
            {
                StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Manage Account"));
                response.BeginGather(
                    new { action = Url.Action("ManageAccount"), timeout = 120, method = "POST", numDigits = 8 });
                response.Say("Please enter your 8 digit account number");
                response.EndGather();
            }
            break;

            case "2":
            {
                StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Take a Loan"));
                response.Say(
                    "All of our loan officers are currently giving money away to people less deserving than you.");
            }
            break;

            case "3":
            {
                StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Talk to a Representative"));
            }
            break;

            default:
            {
                response.Say("Oy vey.");
                response.Redirect(Url.Action("IncomingCall"));
            } break;
            }

            return(SendTwilioResult(response));
        }
Esempio n. 12
0
        public ActionResult There()
        {
            var response = new TwilioResponse();

            response.Say("You made it there!  Thanks for playing.");
            return(TwiML(response));
        }
        public IActionResult ReceiveCall()
        {
            var twiml = new TwilioResponse();

            twiml.Say("You are calling Marcos Placona").Dial(_twilioSettings.Options.MyOwnNumber);
            return(Content(twiml.ToString()));
        }
    public ActionResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        if (!string.IsNullOrEmpty(request.To))
        {
            var callerId = "+15017250604";

            // wrap the phone number or client name in the appropriate TwiML verb
            // by checking if the number given has only digits and format symbols
            if (Regex.IsMatch(request.To, "^[\\d\\+\\-\\(\\) ]+$"))
            {
                response.Dial(new Number(request.To), new { callerId });
            }
            else
            {
                response.Dial(new Client(request.To), new { callerId });
            }
        }
        else
        {
            response.Say("Thanks for calling!");
        }
        return(TwiML(response));
    }
Esempio n. 15
0
    // /Voice
    public TwiMLResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("Hello. It's me. I've been wondering if after this guide you'd like to meet.");
        return(TwiML(response));
    }
    public ActionResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("Thanks for calling!");
        return(TwiML(response));
    }
Esempio n. 17
0
    public TwiMLResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("hello world!", new { voice = "alice" });
        return(TwiML(response));
    }
        public ActionResult GoodResponse()
        {
            var response = new TwilioResponse();

            response.Say("Oops.  Looks like a glitch in the kingdom.  Maybe try casting a different spell later.");
            return(TwiML(response));
        }
        public ActionResult Connect()
        {
            var response = new TwilioResponse();

            response.Say("This is a test phone call");
            return(TwiML(response));
        }
Esempio n. 20
0
        public void Can_Generate_Single_Say()
        {
            var response = new TwilioResponse();
            response.Say("Hello world");

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 21
0
        public void _1_0()
        {
            var response = new TwilioResponse();
            response.Say("Hello monkey");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 22
0
        public async Task <ActionResult> Twiml(string digits, string called)
        {
            var response = new TwilioResponse();

            if (string.IsNullOrEmpty(digits))
            {
                response
                .BeginGather(new { numDigits = 6, timeOut = 10 })
                .Say("Please enter your verification.")
                .EndGather();
            }
            else
            {
                var number = await _service.FindByPhoneNumberAsync(called);

                if (digits.Equals(number.VerificationCode))
                {
                    number.Verified = true;
                    await _service.UpdateAsync(number);

                    response.Say("Thank you! Your phone number has been verified.");
                }
                else
                {
                    response
                    .BeginGather(new { numDigits = 6, timeOut = 10 })
                    .Say("Verification code incorrect, please try again.")
                    .EndGather();
                }
            }

            return(TwiML(response));
        }
Esempio n. 23
0
        public void Example_1()
        {
            var response = new TwilioResponse();
            response.Say("Hello world");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 24
0
        public void Example_2()
        {
            var response = new TwilioResponse();
            response.Say("Hello world", new { voice = "woman", loop = 2 });

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
    // /Voice
    public TwiMLResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("Hello from your pals at Twilio! Have fun.");
        return(TwiML(response));
    }
Esempio n. 26
0
        public void Can_Generate_Single_Say_And_Attributes()
        {
            var response = new TwilioResponse();
            response.Say("Hello world", new { language = "en" });

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 27
0
        public ActionResult AdvancedWait(string QueuePosition, string QueueTime, string AvgWaitTime, string CurrentQueueSize)
        {
            var response = new TwilioResponse();

            response.Say(string.Format("Bwahahaha!  Your time in the queue has been {0} seconds.  Enjoy your wait with {1} of your friends!", QueueTime, CurrentQueueSize));

            response.BeginGather(new { action = Url.Action("AdvancedWaitGather", "Queue", null, "http") });

            //TODO: for some reason I have to hit # to get the Gather to work.  Not sure why?
            response.Say("Enter the magic number now to be released from the queue", new { numDigits = "3", timeout = "7" });
            response.EndGather();

            response.Say("Not even brave enough to proffer a guess?  Figures.  You can try again in a bit.");
            response.Pause(10); //TODO: replace this with a play

            return(TwiML(response));
        }
Esempio n. 28
0
        public void Example_1()
        {
            var response = new TwilioResponse();

            response.Say("Hello world");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 29
0
        public void Example_2()
        {
            var response = new TwilioResponse();

            response.Say("Hello world", new { voice = "woman", loop = 2 });

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 30
0
        public void Example_2()
        {
            var response = new TwilioResponse();
            response.Dial("415-123-4567", new { action = "/handleDialCallStatus.php", method = "GET" });
            response.Say("I am unreachable");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 31
0
        public void Example_2()
        {
            var response = new TwilioResponse();
            response.Pause(5);
            response.Say("Hi there.");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 32
0
        public void _1_0()
        {
            var response = new TwilioResponse();

            response.Say("Hello monkey");

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 33
0
        public void _1_3b()
        {
            var response = new TwilioResponse();
            response.Dial("+13105551212");
            response.Say("The call failed or the remote party hung up. Goodbye.");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 34
0
        public void Example_1()
        {
            var response = new TwilioResponse();
            response.Dial("515-123-4567");
            response.Say("Goodbye");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
        public ActionResult Test2(string from, string to)
        {
            var response = new TwilioResponse();

            response.Say("From: " + from + ", To: " + to);

            return(new TwiMLResult(response));
        }
Esempio n. 36
0
        public ActionResult Connect()
        {
            var response = new TwilioResponse();

            response.Say("Connecting you to an agent");

            return(TwiML(response));
        }
Esempio n. 37
0
    public HttpResponseMessage Post(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("Welcome to Dhaval demo app. Please enter your 5 digit ID.");
        response.Gather(new { numDigits = 5, action = string.Format("/api/Authenticate") });
        return(this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter()));
    }
Esempio n. 38
0
    public ActionResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("Hello! You will get an SMS message soon.");
        response.Sms("This is the ship that made the Kessel Run in fourteen parsecs?");
        return(TwiML(response));
    }
Esempio n. 39
0
        public void Example_2()
        {
            var response = new TwilioResponse();
            response.Say("Our store is located at 123 Easy St.");
            response.Sms("Store Location: 123 Easy St.", new { action = "/smsHandler.php", method = "POST" });

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 40
0
        public void Example_3()
        {
            var response = new TwilioResponse();
            response.Say("Our store is located at 123 Easy St.");
            response.Sms("Store Location: 123 Easy St.", new { statusCallback = "/smsHandler.php" });

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
        //
        // GET: /CallCenter/

        public ActionResult Index()
        {
            var response = new TwilioResponse();

            response.Pause(5);
            response.Say("Thanks for calling the Music Store");
            return(TwiML(response));
        }
Esempio n. 42
0
        public void Example_1()
        {
            var response = new TwilioResponse();
            response.Say("Our store is located at 123 Easy St.");
            response.Sms("Store Location: 123 Easy St.");

            Assert.True(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 43
0
        private static TwiMLResult ReturnInstructions()
        {
            var response = new TwilioResponse();

            response.Say("To get to your extraction point, get on your bike and go down " +
                         "the street. Then Left down an alley. Avoid the police cars. Turn left " +
                         "into an unfinished housing development. Fly over the roadblock. Go " +
                         "passed the moon. Soon after you will see your mother ship.",
                         new { voice = "alice", language = "en-GB" });

            response.Say("Thank you for calling the ET Phone Home Service - the " +
                         "adventurous alien's first choice in intergalactic travel");

            response.Hangup();

            return(new TwiMLResult(response));
        }
Esempio n. 44
0
        public void Can_Generate_Single_Say_And_Attributes()
        {
            var response = new TwilioResponse();

            response.Say("Hello world", new { language = "en" });

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 45
0
        public void Can_Generate_Single_Say()
        {
            var response = new TwilioResponse();

            response.Say("Hello world");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
    // /Voice
    public TwiMLResult Index(VoiceRequest request)
    {
        var response = new TwilioResponse();

        response.Say("Hello. It's me.");
        response.Play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3");
        return(TwiML(response));
    }
Esempio n. 47
0
        public void _1_1()
        {
            var name = "Monkey";

            var response = new TwilioResponse();
            response.Say("Hello " + name);

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 48
0
    // helper function to set up a <Gather>
    private static void RenderMainMenu(TwilioResponse response)
    {
        response.BeginGather(new { numDigits = 1 });
        response.Say("For sales, press 1. For support, press 2.");
        response.EndGather();

        // If the user doesn't enter input, loop
        response.Redirect("/voice");
    }
Esempio n. 49
0
        public ActionResult LeaveGameExperience()
        {
            var response = new TwilioResponse();

            response.Say("Thanks for playing a game.");
            response.Redirect(Url.ActionAbsolute("BasicWaitExperience"));

            return(TwiML(response));
        }
Esempio n. 50
0
        public void Advanced()
        {
            var response = new TwilioResponse();
            response.BeginGather(new { action = "/process_gather.php", method = "GET" });
            response.Say("Enter something, or not");
            response.EndGather();
            response.Redirect("/process_gather.php?Digits=TIMEOUT", "GET");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 51
0
        public void _1_2()
        {
            var name = "Monkey";

            var response = new TwilioResponse();
            response.Say("Hello " + name);
            response.Play("http://demo.twilio.com/hellomonkey/monkey.mp3");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 52
0
            //create a TwiML response to transfer the call
            public static TwilioResponse GetResponseTransfer(TwilioRequestVoice request, Entity.Client client, Entity.Call call)
            {
                TwilioResponse resp = new TwilioResponse();

                if (call != null &&
                    !string.IsNullOrEmpty(call.TransferTo))
                {
                    if (log.IsDebugEnabled) { log.Debug("GetResponseTransfer.request." + (request == null ? "null" : request.ToJsonString())); }

                    if (request.CallRecord)
                        GetResponseRecord(resp, request, client, call);

                    resp.Pause(1);
                    resp.Say("You are being transferred now.");

                    //TODO: pull caller id from database
                    //caller ID is required for outbound calls; it must be registered with your twilio account
                    string callerId = ConfigurationManager.AppSettings["DemoCallerId"];

                    Twilio.TwiML.Number number = new Twilio.TwiML.Number(call.TransferTo);
                    resp.Dial(number, new { callerId = callerId });

                    //update call result
                    if (call != null)
                    {
                        call.CallResult = "transfered to " + call.TransferTo;
                        call.Save();
                    }
                }
                else
                {
                    if (log.IsDebugEnabled) { log.Error("GetResponseTransfer.NoTransferNumber.request." + (request == null ? "null" : request.ToJsonString())); }

                    //no transfer number, send to voicemail
                    resp = GetResponseVoicemail(request, client, call);
                }

                return resp;
            }
Esempio n. 53
0
            //create a TwiML response for calls to an unknown client
            public static TwilioResponse GetResponseUnknownClient(TwilioRequestVoice request, Entity.Call call)
            {
                if (log.IsDebugEnabled) { log.Debug("GetResponseUnknownClient.request." + (request == null ? "null" : request.ToJsonString())); }

                TwilioResponse resp = new TwilioResponse();

                resp.Pause(1);
                resp.Say("We're sorry.  The person you are trying to reach could not be found.");
                resp.Pause(1);
                resp.Hangup();

                //log the current call state
                if (call != null)
                {
                    call.CallResult = "unknown client";
                    call.Save();
                }

                return resp;
            }
Esempio n. 54
0
            //create a TwiML response to notify the caller that the call is being recorded; appends the response to an existing response
            public static TwilioResponse GetResponseRecord(TwilioResponse resp, TwilioRequestVoice request, Entity.Client client, Entity.Call call)
            {
                if (log.IsDebugEnabled) { log.Debug("GetResponseRecord.request." + (request == null ? "null" : request.ToJsonString())); }

                resp.Say("This call may be recorded for quality assurance.");
                resp.Record();

                //log the current call state
                if (call != null)
                {
                    call.CallRecord = true;
                    call.Save();
                }

                return resp;
            }
Esempio n. 55
0
            //create a TwiML response to ignore the call
            public static TwilioResponse GetResponseIgnore(TwilioRequestVoice request, Entity.Client client, Entity.Call call)
            {
                if (log.IsDebugEnabled) { log.Debug("GetResponseIgnore.request." + (request == null ? "null" : request.ToJsonString())); }

                TwilioResponse resp = new TwilioResponse();

                //TODO: create an ignored voicemail box to send the call to
                resp.Pause(1);
                resp.Say("Your call was ignored.");
                resp.Pause(1);
                resp.Hangup();

                //log the current call state
                if (call != null)
                {
                    call.CallResult = "call was ignored";
                    call.Save();
                }

                return resp;
            }
Esempio n. 56
0
            //create a TwiML response to send the call to voicemail; appends the response to an existing response
            public static TwilioResponse GetResponseVoicemail(TwilioResponse resp, TwilioRequestVoice request, Entity.Client client, Entity.Call call)
            {
                if (log.IsDebugEnabled) { log.Debug("GetResponseVoicemail.request." + (request == null ? "null" : request.ToJsonString())); }

                //TODO: create valid voicemail box dial plan
                resp.Pause(1);
                resp.Say("You are being transferred to voicemail, but it's not setup yet.  Goodbye.");
                resp.Pause(1);
                resp.Hangup();

                //log the current call state
                if (call != null)
                {
                    call.CallResult = "sent to voicemail";
                    call.Save();
                }

                return resp;
            }
Esempio n. 57
0
        public void _1_4c()
        {
            var recordingUrl = "http://example.com/example.mp3";

            var response = new TwilioResponse();
            response.Say("Thanks for howling... take a listen to what you howled.");
            response.Play(recordingUrl);
            response.Say("Goodbye");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 58
0
        public void _1_4b()
        {
            var digits = 1;

            var response = new TwilioResponse();
            if (digits == 1)
            {
                response.Dial("+13105551212");
                response.Say("The call failed or the remote party hung up. Goodbye.");
            }
            else if (digits == 2)
            {
                response.Say("Record your monkey howl after the tone.");
                response.Record(new { maxLength = 30, action = "hello-monkey-handle-recording.php" });
            }

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
Esempio n. 59
0
            //create a default ringing TwiML response
            public static TwilioResponse GetResponseRing(TwilioRequestVoice request, Entity.Client client, Entity.Call call)
            {
                TwilioResponse resp = new TwilioResponse();

                //is client available?
                if (client == null ||
                    client.ClientState != Entity.Client.ClientStateEnum.Available)
                {
                    if (log.IsDebugEnabled) { log.Debug("GetResponseRing.Unavailable.request." + (request == null ? "null" : request.ToJsonString())); }

                    //transfer to unavailable voicemail
                    return GetResponseVoicemail(request, client, call);
                }
                else
                {
                    if (log.IsDebugEnabled) { log.Debug("GetResponseRing.request." + (request == null ? "null" : request.ToJsonString())); }

                    //TODO: find a ring MP3 file to play instead of just pausing with silence
                    //definte the default ringing response
                    resp.Pause(1);
                    resp.Say("Asking the person you are calling what they want to do.");
                    resp.Pause(20);

                    //if the call isn't dealt with after the specified time, then transfer the person to voicemail
                    GetResponseVoicemail(resp, request, client, call);

                    //log the current call state
                    if (call != null)
                    {
                        call.CallResult = "ringing";
                        call.Save();
                    }
                }

                return resp;
            }
Esempio n. 60
0
            //create a TwiML response to answer the call
            public static TwilioResponse GetResponseAnswer(TwilioRequestVoice request, Entity.Client client, Entity.Call call)
            {
                TwilioResponse resp = new TwilioResponse();

                if (client == null ||
                    client.ClientState != Entity.Client.ClientStateEnum.Available)
                {
                    if (log.IsDebugEnabled) { log.Debug("GetResponseAnswer.Unavailable.request." + (request == null ? "null" : request.ToJsonString())); }

                    //transfer to unavailable voicemail
                    return GetResponseVoicemail(request, client, call);
                }
                else
                {
                    if (log.IsDebugEnabled) { log.Debug("GetResponseAnswer.request." + (request == null ? "null" : request.ToJsonString())); }

                    resp.Pause(1);

                    if (request.CallRecord)
                        GetResponseRecord(resp, request, client, call);

                    resp.Say("Your call is being answered now.");

                    //find the number to dial
                    string toNumber = request.To;
                    if (string.IsNullOrEmpty(toNumber))
                        toNumber = call.ToNumber;

                    //TODO: pull caller id from database
                    //caller ID is required for outbound calls; it must be registered with your twilio account
                    string callerId = ConfigurationManager.AppSettings["DemoCallerId"];;

                    if (toNumber.StartsWith("client:"))
                    {
                        //call is being routed to a twilio client
                        Twilio.TwiML.Client clientToCall = new Twilio.TwiML.Client(toNumber.Replace("client:",""));
                        resp.Dial(clientToCall, new { callerId = callerId });
                    }
                    else
                    {
                        //call is being routed to an external number
                        Twilio.TwiML.Number number = new Twilio.TwiML.Number(toNumber);
                        resp.Dial(number, new { callerId = callerId });
                    }

                    //log the current call state
                    if (call != null)
                    {
                        call.CallResult = "answered by " + request.To;
                        call.Save();
                    }
                }

                return resp;
            }