使用 webhook 挂断 Dialogflow 电话呼叫

Hang up Dialogflow telephony call using webhook

我想使用 webhook 挂断 Dialogflow 电话呼叫。 This documentation says

If you are using fulfilment, you can terminate a call by setting the end_interaction field of the WebhookResponse message.

我正在使用 Dialogflow-fulfilment nodejs 库。我不知道该怎么做。

Add a response or list of responses to be sent to Dialogflow and end the conversation Note: Only supported on Dialogflow v2's telephony gateway, Google Assistant and Alexa integrations

agent.end 将完成挂断电话的工作。

您可以使用

agent.end('Thank you for calling')

issue还在营业,

如果您更新 dialogflow-fulfillment/src/v2-agent.js,将会起作用

 if (this.agent.endConversation_) {
      responseJson.triggerEndOfConversation = this.agent.endConversation_;
      responseJson.end_interaction = this.agent.endConversation_;
  }

或者你必须在你的函数中访问 response 然后你可以试试,

return response.json({
    fulfillmentText: `Perfect I've got you down for  at , see you later!`,
    end_interaction: true
})

I found a workaround 成功了!

send a follow-up intent from your webhook to the intent which has nothing other than end conversation switched on.

编辑

此外,我与 dialogflow 支持人员进行了交谈,他们表示完成响应将如下所示以结束交互:

{

"fulfillmentMessages": [{

"platform": "TELEPHONY",
"telephonySynthesizeSpeech": {

"text": "Goodbye!"

}

}],
"endInteraction": true

};