The Sinch Platform can initiate callback requests to a URL you define (Callback URL) on events like call initiation, call answer, and call disconnect. All callback requests are signed using your Application key and secret pair found on the Sinch Dashboard. The signature is included in the authorization header of the HTTP request.
This code sample will:
- Validate the signature to ensure the call event originates from Sinch.
- Respond with a Sinch Voice Application Markup Language (SVAML) example on the ICE event (Conference connect).
- Respond with 200OK for the DICE event.
- node v16.* or later
- ngrok
-
Use environment variables for your application key and secret. Create an
.env
file with your credentials for your application from the Sinch dashboard in the format shown:APP_KEY="YOUR_app_key" APP_SECRET="YOUR_app_secret"
-
Run
npm install
to install the required dependencies. -
Start the server using the following command:
node index.js
-
Start ngrok using
ngrok http 8000
-
Take the ngrok URL example
https://97e8-147-28-76-39.ngrok.io
-
Copy it to the Voice & Video application you are using Sinch dashboard
-
Click Save and test your connection!
-
Make that call! You can test direct from the Sinch dashboard or use the samples here
If you want to inspect the incoming call events please set DEBUG=ON
in the .env
file.