[英]What event should be subscribed in RingCentral to get notified when a call is received?
I'm working on an application where I need to get notified when a call is received on the main line or any of the available extensions. 我正在开发一个应用程序,当在主线或任何可用的分机上接到呼叫时,需要通知我。 Which event should be subscribed to get notification? 应该订阅哪个事件来获得通知?
Moreover does RingCentral support Webhook notification? 此外,RingCentral是否支持Webhook通知? At some place I came across something which said RingCentral only supports PubNub but I saw that there is a way to provide TransportType as PubNub or Webhook. 在某个地方,我遇到了一些东西,说RingCentral仅支持PubNub,但我看到有一种方法可以将TransportType提供为PubNub或Webhook。
You would want to subscribe to Presence events making sure to set the detailedTelephonyStatus
query parameter to true
. 您需要预订Presence事件,以确保将detailedTelephonyStatus
查询参数设置为true
。
Here is an example of this from the documentation for creating a subscription to presence events: 这是来自文档的示例,用于创建对出席事件的预订:
POST /restapi/v1.0/subscription HTTP/1.1
Authorization: Bearer U0pDMDFQMDFQQVMwMnxBQUJFU3VOMlp2bjZFR0gxNFhfTUNONhaU1SVHc
Content-Type: application/json
Content-Length: 235
{
"eventFilters": [
"/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true&aggregated=true"
],
"deliveryMode": {
"transportType": "PubNub",
"encryption": "true"
}
}
Within the eventFilters
property, you would want to add an array element for each extension within the account which you wish to monitor. 在eventFilters
属性内,您想为要监控的帐户内的每个扩展添加一个数组元素。
I have created a sample application built in Node.js for creating a subscription to all of the extensions within a RingCentral sandbox account here: https://github.com/bdeanindy/ringcentral-subscription-basics . 我已经在Node.js中创建了一个示例应用程序,用于在以下位置创建对RingCentral沙箱帐户中所有扩展的预订: https : //github.com/bdeanindy/ringcentral-subscription-basics 。
Yes, read the documentation for creating subscriptions https://developers.ringcentral.com/api-docs/latest/index.html#!#RefCreateSubscription and you will see that both PubNub
and Webhook
are supported transportType . 是的,阅读用于创建订阅的文档https://developers.ringcentral.com/api-docs/latest/index.html#!#RefCreateSubscription ,您将看到PubNub
和Webhook
都受支持transportType 。
Here is an example of how to create a subscription which uses the Webhook
transportType : 这是如何创建使用Webhook
transportType的订阅的Webhook
:
POST /restapi/v1.0/subscription HTTP/1.1
Accept: application/json
Authorization: Bearer U0pDMDFQMDFQQVMwMXxBQURIZjAzWFFySGpMen
Content-Type: application/json
Content-Length: 269
{
"eventFilters": [
"/restapi/v1.0/account/~/extension/~/presence",
"/restapi/v1.0/account/~/extension/~/message-store"
],
"deliveryMode": {
"transportType": "WebHook",
"address": "https://consumer-host.example.com/consumer/path"
}
}
You'll want to make sure to change the deliveryMode.address
value to point to a server you manage to receive the events. 您将需要确保将deliveryMode.address
值更改为指向您设法接收事件的服务器。 This server will need to have a valid certificate chain supporting connections on port 443. 该服务器将需要具有有效的证书链,以支持端口443上的连接。
Here is a quick start tutorial on using RingCentral Webhooks . 这是有关使用RingCentral Webhooks的快速入门教程 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.