【问题标题】:How to set RingCentral hold music?如何设置 RingCentral 保持音乐?
【发布时间】:2020-05-08 15:48:23
【问题描述】:

RingCentral 能够通过 UI 上传自定义保留音乐。这可以作为用户和其他用户的管理员通过 API 完成吗?在 API Reference 中搜索等待音乐并没有找到 API。

以下是有关此功能的一些信息:

用户界面如下所示:

【问题讨论】:

    标签: ringcentral


    【解决方案1】:

    尝试使用 API 创建自定义用户问候语并将问候语类型设置为 HoldMusic https://developers.ringcentral.com/api-reference/Rule-Management/createCustomUserGreeting

    Create custom user greeting API

    【讨论】:

      【解决方案2】:

      有两个步骤:

      1. 获取要更改的规则的应答规则 ID。这可以是标准规则,例如business-hours-rule,也可以是您创建的自定义规则。您可以调用获取呼叫处理规则 API 以获取当前标准和自定义规则的列表。
      2. 调用 Update Greeting API,将 type 设置为 HoldMusic 并将 answeringRuleId 设置为您要更新的 id,例如business-hours-rule

      实际上有几种方法可以调用 Update Greeting API:

      1. multipart/form-data 带有单独的字符串部分。在这种方法中,单独的部分以名称typeansweringRuleIdbinary 发送
      2. multipart/form-data 带有 JSON 元数据部分。在这种方法中,一个名为 json 的 JSON MIME 部分与如下负载一起发送:{"type": "HoldMusic", "answeringRule": { "id": "12345678" }}
      3. multipart/mixed

      我更喜欢第一种方法(multipart/form-data 带有单独的字符串部分),因为它很容易与 cURL 和许多 HTTP 客户端等工具一起使用。

      这是一个使用 Go 的示例:

      package main
      
      import(
          "log"
          "net/http"
          "net/url"
          "os"
      
          "github.com/grokify/gotilla/mime/multipartutil"
          "github.com/grokify/oauth2more/ringcentral"
      )
      
      func main() {
      
          // Get the Client (*http.Client):
          client, err = ringcentral.NewClientPassword(
              ringcentral.ApplicationCredentials{
                  ClientID:     os.Getenv("RINGCENTRAL_CLIENT_ID"),
                  ClientSecret: os.Getenv("RINGCENTRAL_CLIENT_SECRET"),
                  ServerURL:    os.Getenv("RINGCENTRAL_SERVER_URL")},
              ringcentral.PasswordCredentials{
                  Username:  os.Getenv("RINGCENTRAL_USERNAME"),
                  Extension: os.Getenv("RINGCENTRAL_EXTENSION"),
                  Password:  os.Getenv("RINGCENTRAL_PASSWORD")})
          if err!=nil {
              log.Fatal(err)
          }
      
          // Create the HTTP Request (*http.Request)
          params := url.Values{}
          params.Set("type", "HoldMusic")
          params.Set("answeringRuleId", "business-hours-rule")
      
          req, err := multipartutil.NewRequest(
              http.MethodPost,
              "https://platform.ringcenral.com/restapi/v1.0/account/~/extension/~/greeting",
              params,
              []multipartutil.FileInfo{
                  {
                      MIMEPartName: "binary",
                      Filepath:     "mygreeting.wav",
                  },
              },
          )
      
          // Send the request
          resp, err = client.Do(req)
          if err != nil {
              log.Fatal(err)
          }
          fmt.Printf("STATUS: %v\n", resp.StatusCode) 
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多