Reference app of the Javascript SDK from Sinch.
Use latest version of Chrome to test the app.
Start from root url and enter the application key and secret and select the type of call to be made.
In order to obtain your credentials you need to either creating and account or loging in to dashboard.sinch.com. And after that navigate to Voice & Video / Apps and create a new App.
Read specific instructions for each call sample by clicking the icon on the left hand side of the call type header. i.e. 'In app video calling demo'
Run npm install and then npm start to host the app locally.
You can create a samples/config.json file to preload named environments into the login screen, avoiding the need to type credentials manually each time.
Create samples/config.json with your credentials:
[
{
"name": "Production",
"appKey": "your-app-key",
"appSecret": "your-app-secret",
"environment": "https://ocra.api.sinch.com"
}
]You can add multiple entries — they will appear in a dropdown on the login screen. Selecting — manual entry — from the dropdown clears the fields so you can type credentials manually instead.
- voicecall - in-app to in-app voice (data to data voice)
- videocall - in-app to in-app voice and video (data to data voice)
- numbercall - in-app to telephone (data voice to PSTN)
- sipcall - in-app to SIP (data to SIP)
- conferencecall - in-app conference calling
- numberdial - Voice v2 phone number dial
- sipdial - Voice v2 SIP dial
- streamdial - Voice v2 Stream dial
- voicerelaydial - Voice v2 Voice Relay dial
The sample application (and the Sinch SDK) works on all major browsers currently available. However, the SDK relies on the W3C Push API to send push notifications, so the browser must support this API. For a detailed list of minimum version requirements for each browser, see: link.
To receive push messages on iOS, keep the following in mind:
- Your application must run on Safari 16.4+. Other browsers on iOS run within a WebView, which does not support the Push API.
- The application must run as a standalone app. This means you need to set the
"display": "standalone"property in your app’smanifest.jsonfile. Additionally, the user must add the app to the home screen and launch it from there. See how this is handled within our reference app. Search formanifest.jsonfile andisIOSBrowserNotInStandaloneMode()check. - Browsers usually allow HTTP traffic for local development. This facilitates testing JavaScript applications locally, on desktop browsers. However, when testing on a mobile device connected via USB, localhost refers to the device itself and not the machine serving the web application. In this case, HTTPS is required to ensure that the mobile device and the browser can access the application hosted on desktop.
For more information regarding Push API on iOS see link.
See link for more information regarding the current limitation of the reference app in terms of receiving push notifications when terminated.
Chrome does not support the Push API in incognito mode (crbug.com/41124656), and deliberately provides no way to detect this up front. The failure only surfaces when the SinchClient subscribes to push during startup, which makes the start fail. Depending on the Chrome version, it is reported either as an incognito error or as Registration failed - permission denied, because incognito auto-denies the notification permission. To keep the samples usable, the reference app catches these push errors in onClientFailed, including a regular permission denial, disables managed push and starts the client again. In this mode outgoing calls work, but the client cannot receive incoming calls. The landing page shows a non-blocking warning when push permission is denied. See restartWithoutPushIfUnsupported() in the reference app.
In browsers other than Chrome, it is typically required that the first interaction with the Push API, which triggers a permission request, must be initiated by a user action (e.g., a user click). This interaction usually happens automatically when the SinchClient starts. As a result, in some cases, we cannot start the SinchClient automatically when the page loads. Instead, we must delay the process until the user performs some interaction. For a more detailed explanation and a working example of how to handle this issue, see how the canAutoStart() method is used in the reference app.
Read full documentation here.