Skip to main content

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!

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)
}
}



@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.


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.

screen-shot-2020-11-24-at-20624-pm.png


Reply