【问题标题】:What event should be subscribed in RingCentral to get notified when a call is received?应在 RingCentral 中订阅什么事件以在接到呼叫时得到通知?
【发布时间】:2016-09-12 04:31:43
【问题描述】:

我正在开发一个应用程序,当在主线或任何可用分机上收到呼叫时,我需要得到通知。应该订阅哪个事件来获得通知?

此外,RingCentral 是否支持 Webhook 通知? 在某个地方,我遇到了说 RingCentral 只支持 PubNub,但我看到有一种方法可以将 TransportType 提供为 PubNub 或 Webhook。

【问题讨论】:

    标签: subscription webhooks ringcentral


    【解决方案1】:

    应订阅哪个事件以获取在我的主线或任何可用分机上收到呼叫的通知?

    您希望订阅 Presence 事件,确保将 detailedTelephonyStatus 查询参数设置为 true

    以下是创建在线事件订阅的文档中的一个示例:

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

    eventFilters 属性中,您需要为您希望监控的帐户中的每个扩展程序添加一个数组元素。

    我在 Node.js 中创建了一个示例应用程序,用于在此处创建对 RingCentral 沙盒帐户中所有扩展的订阅:https://github.com/bdeanindy/ringcentral-subscription-basics

    RingCentral 是否支持 Webhook 通知?

    是的,阅读有关创建订阅的文档https://developers.ringcentral.com/api-docs/latest/index.html#!#RefCreateSubscription,您将看到PubNubWebhook 均受支持transportType

    下面是一个使用WebhooktransportType创建订阅的示例:

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

    您需要确保将deliveryMode.address 值更改为指向您设法接收事件的服务器。此服务器需要有一个有效的证书链,支持端口 443 上的连接。

    这是quick start tutorial on using RingCentral Webhooks

    【讨论】:

    • PHP SDK 是否支持注册 Webhook 订阅? github.com/ringcentral/ringcentral-php
    • 注册订阅就像任何其他 REST API 调用一样,所以是的,PHP SDK 确实支持这一点,因为它提供了一个带有集成 OAuth 的通用 HTTP 客户端。我这里还有一个使用 Node 和 Express 的演示 webhook 应用程序:github.com/grokify/ringcentral-demos-webhooks
    • 谢谢。这真的很有帮助。
    • 在 webhook 的情况下,我们还必须将事件过滤器更改为“/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true&aggregated=true” “对吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多