Click to Dial with Pstn Termination Using Twilio Elastic Trunking

For maximum use of web telephony, you will probably want to reach PSTN users from your web page as well. Connecting web telephony with PSTN requires an additional PSTN termination service: everything else is done by the ABC SBC. The ABC SBC Gateway translates a WebRTC browser call into SIP call and authenticates against a PSTN termination service. In our examples, we are using twilio services, interworking with other services would be similar.

You will start a WebRTC service, configure it to make phone calls through twilio PSTN termination service during cloud formation launch, and eventually make a browser-to-PSTN phone call from a password-protected webpage.

How to Use It

Before starting your service, you must set up your twilio account and the “Elastic SIP Trunking Service”. Twilio provides a quick guide in Getting Started.

To start the cloud formation process visit the following link:

Include parameters describing your Twilio trunk: authentication username, authentication password, the trunk FQDN and your caller Id. The caller Id may be either the telephone number associated with the twilio account owner and verified, or it can be a PSTN number rented from Twilio under “Elastic Sip Trunking -> Trunks -> Numbers”.

Once the cloud formation process completes which takes several minutes, the Outputs will show a link to a webpage for creating a personalized click-to-dial button. Click on the link and accept self-signed certificates. Include a valid E.164 number beginning with the “+” sign under “Call to”.  After you press the dialling button, you will be prompted for permission to use your audio/video equipment. After you approve, your browser will  connect to the PSTN  destination.


What is Orchestrated


The only EC2 instance which is started by the cloud formation is the ABC WebRTC Gateway. It is configured to use a third-party Twilio Elastic Trunking Service during the Cloud Formation launching phase.

What Else You Should Know

This basic configuration permits anyone with proper password to make phone calls to any destination through the Twilio PSTN termination service. Click-to-dial is typically used to reach a single well-known telephone number. In such cases it makes sense to configure the ABC SBC Routing policy to always forward to this specific number. This way, even if a user modifies the HTML click-to-dial code in his browser to call a different number, the call will still be forwarded by the SBC to the intended number. See the ABC-SBC Documentation for details on devising SIP routing policies.