1

是否有一个属性可以添加到client.calls.create({方法中,允许我向 Twilio 将在回调 URL 中发布的请求正文添加额外信息?像这样的东西:

client.calls.create({
                method: 'GET',
                extraInfo: { employeeID: 'ABC123' }, <-- This would be what I want to add to the JSON response.
                statusCallback: `${config.host}/completed`,
                statusCallbackMethod: 'POST',
                twiml: responseString,
                to: data.number`,
                from: `+1${availableNumbers[0]}`
            })

会让 Twilio 将此返回到我的回调 URL:

{
  "extraInfo": { employeeID: 'ABC123' }, <-- This would be what should be added to the POST request
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "annotation": null,
  "answered_by": null,
  "api_version": "2010-04-01",
  "caller_name": null,
  "date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
  "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
  "direction": "inbound",
  "duration": "15",
  "end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
  "forwarded_from": "+141586753093",
  "from": "+18668675310",
  "from_formatted": "(866) 867-5310",
  "group_sid": null,
  "parent_call_sid": null,
  "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "price": "-0.03000",
  "price_unit": "USD",
  "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
  "status": "completed",
  "subresource_uris": {
    "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
    "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
    "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json",
    "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json",
    "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json"
  },
  "to": "+14155551212",
  "to_formatted": "(415) 555-1212",
  "trunk_sid": null,
  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
  "queue_time": "1000"
}
4

1 回答 1

1

不要使用 twiml 参数,而是使用 url 参数并将 HTTP 查询参数附加到 URL 的末尾。您可以对 statusCallback URL 执行相同的操作。

通过请求将自定义信息传递给 Twilio

如何在您的应用程序之间共享信息

于 2020-06-11T11:11:19.930 回答