dialogflow-eswebhooksdialogflow-es-fulfillmentivr

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.


Solution

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