I am trying to test the CallOut API in a new app I'm developing. I've gotten pretty far. I have installed the RC Phone and can call into that phone with the sandbox account phone number.
So back to my app, I need to get the deviceId of that RC Phone. To get the deviceId, I need the extensionId. So I've called the GetExtensionList and I do get the info on my one sandbox extension. I don't see an extensionId. Given some of the other posts I've read and the urls that are shown on the api calls, I see them using the accountId as the extensionId.
So, I've called GetDevice with https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/device and I've also tried with accountId in both places instead of the tilde. No matter what I try, the records value in the response is empty.
What am I doing wrong it trying to get the device to target? Any help would be greatly appreciated!
Here is the problem. You don't have a phone for your 101 user extension. Login your sandbox account, select the user -> numbers & phones and add a phone (select the RingCentral softphone) for your extension.
@Phong Vu Just curious to know if RC phone support any device id? As per the question, it seems device response is empty because of using RC phone.
If I check following ref:
https://community.ringcentral.com/questions/10052/callout-using-mobiledesktop-app.html
you clearly mentioned:
"The RC mobile apps and the RC Desktop app do not register a device id so that you cannot find it from the extension device list. "
Correct me if I am missing anything
If there is no way to get a deviceId for any device in the sandbox, is there ANY way to test a CallOut from the sandbox? I have a Ring Central Poly phone. Is there a way to log that into the sandbox?
Any other ideas???
Unfortunately, that RingCentral Phone app does not register its device Id to the system. I wonder how you could login that RC Phone app with your sandbox account user's credentials. Or did I misunderstand that you logged in with your production account and receive incoming call from your sandbox number? Please clarify.
This is the only phone app (scroll to the RC Phone Desktop) that can be used with the sandbox account, provided you switch the app to "sandbox" mode (e.g. fn-command-f2 on Mac).
We are working on the possibility to have other RC app to register its device Id but it is not possible right now.
This is the app I'm using. I switched it to Sandbox and logged in with my sandbox credentials. I can call from my mobile phone to this sandbox number and that works fine.
So if this doesn't give a deviceId, then there is nothing else that works in the Sandbox that does give a deviceId?
If I want to test, do I create an app with CallControl and then test some other call control enough to get it promoted to production and THEN I can test CallOut?
Yes, this is the RingCentral softphone app (RC Phone Desktop).
Yes, you need an app with the CallControl permission to call the call-out API. My code shared above should work. If you still don't see the device Id, let me know your app client id.
I tested the API.. This app actually give device id in response
the API url is: https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/device method GET
Here is my API call from Postman. Can you see anything wrong? I'm logged in with username "+14243520781" and extension "101" (and password) from my app details in the sandbox. That gives me the bearer token I'm using.
You logged into the app with same extension right? The access_token generated from token api should be from using same ext
Yes. Using 101 for all logins.
The app client id is -QWCx-B0RO-4UJZVS5B9Hw
It has the CallControl and ReadAccounts permissions needed to run the code above, but I just have nothing with a deviceId.
Are you saying the RC Phone Desktop does or does not register a deviceId?
Her is all what you need to implement in Node JS. Let me know if you have problem or you want in other programming language.
const RingCentral = require('@ringcentral/sdk').SDK RINGCENTRAL_CLIENTID = 'your-app-client-id' RINGCENTRAL_CLIENTSECRET = 'your-app-client-secret' RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com' RINGCENTRAL_USERNAME = 'username' RINGCENTRAL_PASSWORD = 'password' RINGCENTRAL_EXTENSION = 'ext-number' const rcsdk = new RingCentral({ server: RINGCENTRAL_SERVER, clientId: RINGCENTRAL_CLIENTID, clientSecret: RINGCENTRAL_CLIENTSECRET }) var platform = rcsdk.platform(); rcsdk.login({ username: RINGCENTRAL_USERNAME, extension: RINGCENTRAL_EXTENSION, password: RINGCENTRAL_PASSWORD }) platform.on(platform.events.loginSuccess, async function(e){ console.log("Login success") get_extension_devices() }); async function get_extension_devices() { console.log("get_extension_devices") try{ var resp = await platform.get('/restapi/v1.0/account/~/extension/~/device') var jsonObj = await resp.json() for (var record of jsonObj.records){ if (record.status == "Online"){ console.log(record.status) console.log(record.id) call_out(record.id) break } } }catch(e){ console.log(e.message) } } async function call_out(deviceId) { var params = { from: { deviceId: deviceId }, to: { phoneNumber: "phone number to call" } } try{ var resp = await platform.post('/restapi/v1.0/account/~/telephony/call-out', params) var jsonObj = await resp.json() console.log(JSON.stringify(jsonObj)) }catch(e){ console.log(e.message) } }
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder