You can retrieve a user's phone numbers by calling the extension phone number endpoint (e.g. "account/~/extension/~/phone-number" which is described below:
https://developer.ringcentral.com/api-docs/latest/index.html#!#RefExtensionPhoneNumbers.htmlA RingCentral user has an extension which can have multiple phone numbers. Using the above endpoint, you'll receive only the phone numbers associated with that user.
Since a user can login with any of their phone numbers, e.g. main company number + extension, digital line number, direct number, etc., our best practices is to allow a user to login with any number and after doing so, making available all their numbers for use, e.g. voice calls, SMS, fax, etc.
Let us know if that helps.
Dear John Wang,
Greetings!!!
Thanks for your reply.
After successful RingCentral login(after getting access token) I have called above (account/~/extension/~/phone-number) apiCall to get particular phone number which one i was used during OAuth RIngCentral login(1XXXXXXXXXX).
But i got below response as list of phone numbers. But we need the phone number which was given during RingCentral OAuth login. Then only we can use the same phone number during ring-out (from field) .
Hope this is clears.
Could you please let me know if any further information is needed.
{ "uri" : "
https://platform.devtest.ringcentral.com/restapi/v1.0/account/665168005/extension/665168005/phone-nu...;,
"records" : [ {
"id" : ZZZZZZZZ,
"phoneNumber" : "+1XXXXXXXXXX",
"paymentType" : "Local",
"location" : "Alamitos, CA",
"type" : "VoiceFax",
"usageType" : "MainCompanyNumber",
"features" : [ "SmsSender", "CallerId" ],
"status" : "Normal",
"country" : {
"uri" : "
https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/country/1";,
"id" : "1",
"name" : "United States"
}
}, {
"id" : AAAAAAAA,
"phoneNumber" : "+1YYYYYYYYYYY",
"paymentType" : "Local",
"location" : "Philadelphia, PA",
"type" : "VoiceFax",
"usageType" : "DirectNumber",
"features" : [ "SmsSender", "CallerId" ],
"status" : "Normal",
"country" : {
"uri" : "
https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/country/1";,
"id" : "1",
"name" : "United States"
}
} ],
Regards,
Mathikumar.C
These are two numbers available for the same user. You can tell by looking at the "usageType" values. In your case, one is the "MainCompanyNumber" (which the user is able to use for dialing) the other is the "DirectNumber" (which the user is also able to use for dialing).
According to your original question, "After receiving the access token we need to get user phone number(direct number) which he was used for RC OAuth login.".
So in this case, you would want to use the phone-number.id where usageType = "DirectNumber". (id AAAAAAA in your example response)
Does this answer your question?
Hi Mathi,
A correction is necessary for the above. To select calling phone numbers for RingOut, you must use the "account/~/extension~/forwarding-number" endpoint and filter for phone numbers with the "CallForwarding" feature.
The "account/~/extension~/phone-number" endpoint is used for finding phone numbers that can be used for the Caller ID. Currently, the RingOut API does not support setting the Caller ID value and uses the Caller ID setting set in the Online Account Portal under the "RingOut for Web" feature. To configure a Caller ID via an API call, consider using WebRTC.
Some additional information is available here:
- https://developer.ringcentral.com/api-docs/latest/index.html#!#MakeRingOut.html
- http://ringcentral-sdk-ruby.readthedocs.io/en/latest/usage/voice/Click-To-Call/
If more than one phone number is available in the account under "forwarding-number" with the "CallForwarding" feature, that means the user can receive calls on more than one number. Best practices is to create a select element and allow the user to choose which number to use.
Thanks,
John
Dear John,
Much appreciate for your quick response.
I decided to go in your way to give choice to customer to choose phone number after successful login.
So, For the first select element(RingCentral Phones) i can use "account/~/extension/~/phone-number" endpoint to get Customer's RingCentral phone numbers.
In second select element(Other Phones) i will use "account/~/extension~/forwarding-number" endpoint to get other phones what customer have in RingCentral Online Portal (Call handling & Forwarding).
According to customer's choice of phone number, we will make "from" field during RingOut process.
Hope this will be a better idea.
Could you please suggest us if you feel any changes.
Regards,
Mathikumar.C
Hi Dean,
Thanks for your response.
As in my previous comment there is only one direct number for extension id. But for customer there might be a one or more direct number can be mapped to same extension id. So i think that end point will not work to choose one particular phone number for RIngOut.
We need to give choice to customer to choose which number customer wants to use for RIngOut Process.
Regards,
Mathikumar.C
Hi Mathikumar,
Could you please create a developer support case (
https://developers.ringcentral.com/api/support-cases/create) to help isolate and resolve this issue.
In your support case, please reference the URL for this community post, and inform them that you've been asked to have this issue directly escalated to Tier 2 developer support.