简体   繁体   中英

Hang up Dialogflow telephony call using webhook

I want to hang up Dialogflow telephony call using webhook. This documentation says

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

I am using Dialogflow-fulfilment nodejs library. I don't know how to do it.

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 will do the work to hang up the call.

You can use

agent.end('Thank you for calling')

The issue is still open,

If you update the dialogflow-fulfillment/src/v2-agent.js , will work

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

Or you must be having access of response in your function then you can try,

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

I found a workaround and it worked!

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

Edit

Besides, I talked to the dialogflow support and they said the fulfillment response will look like this to end the interaction:

{

"fulfillmentMessages": [{

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

"text": "Goodbye!"

}

}],
"endInteraction": true

};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM