In this tutorial, we will learn how to implement Warm Transfers using ASP.NET MVC and Twilio. The example application simulates a support center, using Twilio to transfer calls from one agent to another.
-
First clone this repository and
cd
into it.git clone git@github.com:TwilioDevEd/warm-transfer-csharp.git cd warm-transfer-csharp
-
Create the sample configuration file and edit it to match your configuration.
rename WarmTransfer.Web\Local.config.example WarmTransfer.Web\Local.config
You can find your TwilioAccountSid
and TwilioAuthToken
in your
Twilio Console.
You will also need a TwilioPhoneNumber
, you may find it here.
-
Create database and run migrations.
In Visual Studio, open the following command in the Package Manager Console.
Update-Database
Make sure Sql Server is up and running.
-
Expose your application to the wider internet using ngrok. This step is important because the application won't work as expected if you run it through localhost.
To start using ngrok
in our project you'll have execute to the following line in the command prompt.
ngrok http 55585 -host-header="localhost:55585"
Keep in mind that our endpoint is:
http://<your-ngrok-subdomain>.ngrok.io/Conference/ConnectClient
Remember to update the Local.config file with the generated .
- Configure Twilio to call your webhooks
You will also need to configure Twilio to call your application when calls are received on your TWILIO_NUMBER
. The voice url should look something like this:
http://<your-ngrok-subdomain>.ngrok.io/Conference/ConnectClient
That's it!
-
Navigate to
https://<ngrok_subdomain>.ngrok.io
in two different browser tabs or windows.Notes:
-
In one window/tab click
Connect as Agent 1
and in the other one clickConnect as Agent 2
. Now both agents are waiting for an incoming call. -
Dial your Twilio Number to start a call with
Agent 1
. YourTWILIO_NUMBER
environment variable was set when configuring the application to run. -
When
Agent 1
answers the call from the client, he/she can dialAgent 2
in by clicking on theDial agent 2 in
button. -
Once
Agent 2
answers the call all three participants will have joined the same call. After thatAgent 1
can drop the call and leave both the client andAgent 2
having a pleasant talk.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.