SIP Trunking with Twilio

SIP(Session Initiation Protocol) and WebRTC both are infrastructures developed to support real-time communication and collaboration over the Internet(VOIP).
Both technologies provide video, audio, instant messages capabilities. But with the introduction of WebRTC, softphone need not to be configured anymore and the communication can be done through browser only.
Hence, every device with a web browser have real-time communications capabilities.

What is SIP Trunking

In simple, SIP Trunk connects your VOIP audio call to the PSTN network.

Why we do need SIP Trunk

SIP Trunk is the gateway to connect your internal PBX system to the outside world (IP network). For example, in an office environment SIP Trunks provide the phone service to the entire office to connect to outside world.

Why we wanted SIP Trunking?

WebRTC provides a great opportunity to people to start a call directly through their web browser. Making use of this feature, we decided to implement call button feature on any website which generates a call to a Customer Care Agent hence to his PSTN network
For this example we would simply try to forward the WebRTC call to a given PSTN number. But in a real world customer care solution, you would need to route the call based on the inputs from user to the right department.

Steps we followed

  1. We created a demo web page and added a call button. Pressing the call button initiates webRTC call to FreeSwitch.
  2. We then configured FreeSwitch as the media server and the PBX to forward the call to the SIP Trunk
  3. We used Twilio as the SIP trunk provider and configured it to receive a PSTN call to one of our devices.

Using Twilio as the SIP Trunk provider

We make a WebRTC call to the PSTN network