How to Initiate Calls From WebRTC To The PSTN Network ?
In this tutorial we will show you how to initiate phone calls from WebRTC Web SDK to the PSTN network, this means you can dial any number in the world right from your browser and connect to it including Mobile and Fixed networks all over the world.
WebRTC provides web browsers and mobile applications with real-time communication.
In this tutorial we will be using Restcomm Web SDK and TelecomsXChange for PSTN connectivity.
To achieve WebRTC to PSTN you must first have:
Once you have got your restcomm cloud account credentials, please follow this tutorial to connect with TelecomsXChange Platform.
- Login to restcomm cloud account
- Click on “Clients”
- Add new (Enter Username and Password) “Save them, we will use these to register to WebRTC in the next steps”
Now let’s dive in to make our first WebRTC to PSTN Call:
- Make sure you have NodeJS and NPM is installed on your machine, if not you can get it here: https://nodejs.org/en/download/
Once you have installed NodeJS and NPM proceed to the next steps:
Open Terminal & Copy restcomm-web-sdk Quickstart Code:
# git clone https://github.com/ajamous/restcomm-web-sdk.git
#cd to /restcomm-web-sdk/samples/hello-world/
Install required node modules, run below commands:
npm install node-static
npm install https
npm install fs
Open index.html in your favirout text-editor and follow below steps:
Change the var parameters section to be exactly as shown below:
var parameters = {
'debug': true,
'username': 'ENTER SIP USERNAME', // Created in Restcomm Cloud >> Clients
'password': 'ENTER SIP PASSWORD', // Created in Restcomm Cloud >> Clients
'registrar': 'wss://cloud.restcomm.com/webrtc'. // Restcomm Cloud Registrar, its the same for all Restcomm Cloud Clients
};
Go down to function call() “line 141”, and replace with :
function call() {
var parameters = {
'username': '73297%2318003333333@cloud.restcomm.com', // Phone number you want to dial when you click on the Call Icon
73297%23 is the tech prefix to dial this call via carrier AirTel, to switch to TATA communications use 32770%23 and so on.
Now finally go to directory /restcomm-web-sdk/samples/hello-world/ and run this command to start project:
# node server-secure.js
Open chrome browser and visit https://localhost:7443/index.html
Click the call button and it will dial 18003333333 via your restcomm cloud account on to TelecomsXChange for the PSTN Termination.
You must be logged in to post a comment.