04-28-2023 06:37 PM
I have a problem with SInchClient. Everytime I instantiate a new instance of SinchClient, I get this error:
Response { type: "cors", url: "https://ocra.api.sinch.com/ocra/v2/applications/.../instances", redirected: false, status: 400, ok: false, statusText: "Bad Request", headers: Headers(2), body: ReadableStream, bodyUsed: false } body: ReadableStream { locked: false } bodyUsed: false headers: Headers { "content-length" → "211", "content-type" → "application/json" } ok: false redirected: false status: 400 statusText: "Bad Request" type: "cors" url: "https://ocra.api.sinch.com/ocra/v2/applications/..../instances" <prototype>: ResponsePrototype { clone: clone(), arrayBuffer: arrayBuffer(), blob: blob(), … } sinch-rtc-min.js:2:460086 { "message": "Unable to create instance!", "code": 500, "domain": 2 }
I followed this tutorial: Getting started with Sinch In-app Calling for JavaScript SDK
I also test this samples on my machine and got the same error. Is there a way to fix this? Also, follow-up question. How to call an app in browser using a phone? In the samples above, there's only browser-to-phone call sample.
Solved! Go to Solution.
04-29-2023 11:23 AM
Hi,
Sorry to hear you are having issues.
This error is usually triggered if you have not used the correct username format when you start the Sinch client. (It must be in base64 urlsafe format)
Please see here: https://developers.sinch.com/docs/in-app-calling/js/miscellaneous/#restrictions-on-user-ids
Change to the recommended format and try again.
05-01-2023 07:40 AM
Hi,
You can respond with a SVAML connectConf for the incoming PSTN and using the Voice / Calling API ConferenceCallout using to add the InApp client to the same conference.
Regions
Please be aware both participants must be in the same region for conferences to work. (https://developers.sinch.com/docs/voice/api-reference/#endpoints).
If they are in different regions using the Global redirect URL, then you will have to be specific in the region you state in the SDK API URL and the Voice Calling API URL.
There is a sample callback server on our github page in nodejs for experimentation purposes
https://github.com/sinch/voice-api-webhook-nodejs
You could use an Axios client to do the callout in the "ice" case statement to achieve ConferenceCallout.
04-29-2023 11:23 AM
Hi,
Sorry to hear you are having issues.
This error is usually triggered if you have not used the correct username format when you start the Sinch client. (It must be in base64 urlsafe format)
Please see here: https://developers.sinch.com/docs/in-app-calling/js/miscellaneous/#restrictions-on-user-ids
Change to the recommended format and try again.
04-29-2023 03:54 PM
Thanks. It works now. My next problem is how to call my web app using my phone. This sample only demonstrates how to call a phone using a web app. Could you give me a procedure on how to call my app using a phone? Thanks!
04-30-2023 05:55 AM
Hi,
You cannot call an InApp SDK client directly, however you can use the Calling API ConferenceCallout to invite the InApp client to a conference as well as a phone (PSTN) participant.
You can test this immediately with our github php API client conference sample here: https://github.com/sinch/voice-api-php
Be sure to change the destination type to username and the endpoint to the InApp client username.
There are more samples at the page below in the "Add a participant to a conference" in:
04-30-2023 09:29 AM - edited 04-30-2023 09:30 AM
Thanks for the response. Is it possible to handle incoming calls using a callback in my back-end? This example only demonstrates a text-to-speech call. I'm wondering if I can just call my virtual number using my phone and then my callback handles the call and connect my phone to my web application. Thanks.
05-01-2023 07:40 AM
Hi,
You can respond with a SVAML connectConf for the incoming PSTN and using the Voice / Calling API ConferenceCallout using to add the InApp client to the same conference.
Regions
Please be aware both participants must be in the same region for conferences to work. (https://developers.sinch.com/docs/voice/api-reference/#endpoints).
If they are in different regions using the Global redirect URL, then you will have to be specific in the region you state in the SDK API URL and the Voice Calling API URL.
There is a sample callback server on our github page in nodejs for experimentation purposes
https://github.com/sinch/voice-api-webhook-nodejs
You could use an Axios client to do the callout in the "ice" case statement to achieve ConferenceCallout.
10-02-2023 06:04 AM - edited 10-02-2023 06:05 AM
Hello, Roland_Ian
I have a problem with ConferenceCallout request. I specify the following parameters: enableAce and enableDice, but they don't work. I don't receive webhooks
10-02-2023 07:21 AM
Hi
I have tested the following and this produces ACE and DICE towards my backend
{
"method": "conferenceCallout",
"conferenceCallout": {
"cli": "+46XXXXXXXXX",
"destination": { "type": "number", "endpoint": "46XXXXXXXX" },
"domain": "pstn",
"custom": "conf_test",
"conferenceId":"conf_test",
"moh": "ring2",
"enableAce": true,
"enableDice": true
}
}
Resulting in
Mon, 02 Oct 2023 13:27:27 GMT Body: {
event: 'ace',
callid: 'XXXXXX-b4ef-4a67-8813-XXXXXXXX',
timestamp: '2023-10-02T13:27:27Z',
version: 1,
custom: 'conf_test',
applicationKey: 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
}
Mon, 02 Oct 2023 13:27:40 GMT Body: {
event: 'dice',
callid: 'XXXXXX-b4ef-4a67-8813-XXXXXXXX',
timestamp: '2023-10-02T13:27:40Z',
reason: 'CALLERHANGUP',
result: 'ANSWERED',
version: 1,
custom: 'conf_test',
debit: { currencyId: 'USD', amount: 0.293 },
userRate: { currencyId: 'USD', amount: 0.293 },
to: { type: 'number', endpoint: '46XXXXXXXX' },
applicationKey: 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
duration: 13,
from: '46XXXXXXX'
Can you confirm you can see any incoming HTTP traffic towards your application server?
Is the URL correct / present in the dashboard against the application you are using (has it been accidentally applied to another application you have?)
Voice -> Apps -> Settings -> Callback URL.
10-02-2023 07:33 AM
Perhaps the problem is that I'm using the username in the destination?
I created a new thread, I suggest moving the discussion there