Muhammad Naufil
Muhammad Naufil

Reputation: 2637

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.

Upvotes: 0

Views: 725

Answers (2)

Muhammad Naufil
Muhammad Naufil

Reputation: 2637

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

};

Upvotes: 0

Nikhil Savaliya
Nikhil Savaliya

Reputation: 2166

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

Upvotes: 1

Related Questions