我正在测试 RingCentral RingOut 功能并遵循相关文档。但我面临一些问题:
- RingCentral 支持向哪些国家/地区调用电话(往返)?
- 如何使用两个不同的手机号码调用测试电话?
目前,我正在发出 RingOut 请求,但作为响应,我收到 400 bad request 错误,并显示以下消息:
from and to ("Unrecognized token 'from': was expecting 'null)
更新:
发送具有这些参数的ajax请求:
var url = 'https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/ringout';
var data = {
"from": {"phoneNumber": "usa_phone_sandboxed"},/*from parameter is optional if there is a default number in user's forwarding numbers */
"to": {"phoneNumber": "usa_phone_real"}, /*to parameter is required */
/*"playPrompt": true optional field */
};
var headersArray = [
{"Content-Type": "application/json"},
{"Authorization": "Bearer "+my_access_token}
];
我正在使用沙盒帐户。语言:浏览器端的 Javascript。
最佳答案
要解决 400(错误请求)问题,您要做的第一件事是 GET the list of Forwarding Numbers确定您帐户的转接号码中是否配置了默认号码。这会让您知道是否需要在 POST RingOut 请求中提供 from
对象。
如果您的分机转接号码的 totalResults === 0
和 defaultNumber 未设置
,则您必须提供 from
对象POST 正文。
{
"from": {
"phoneNumber":"{{rcUsername}}"
},
"to": {
"phoneNumber":"{{toPhoneNumber}}"
}
}
请记住,from.phoneNumber
必须是您分机的直拨号码或您分机的可用转接号码之一。 to.phoneNumber
应是您联系人的电话号码。
您还提出了以下问题:
RingCentral 支持哪些国家/地区的调用(往返)?
这将取决于您的帐户类型和扩展程序设置。首先,您需要了解当前经过身份验证的分机是否通常能够调用国际电话。这可以使用 GET an Extension by Id 来完成响应正文将包含一个名为 serviceFeatures
的属性,featureName === InternationalCalling
是首先查看的正确属性。
例如,我的免费开发者帐户中的设置如下(这意味着我无法使用我的分机调用国际电话):
{
"featureName": "InternationalCalling",
"enabled": false,
"reason": "AccountTypeLimitation"
}
有关您帐户的国际拨号功能的全面信息,您需要查看RingCentral Online Account Portal .
如何使用两个不同的手机号码调用测试电话?
不确定我完全理解你的问题,你的意思是使用两个不同的to.phoneNumbers
还是两个不同的from.phoneNumbers
?您能否提供更多有关您想要实现的目标的具体信息?
关于javascript - 如何发起测试 RingOut 调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41565889/