dialogflow-fulfillment-nodejs icon indicating copy to clipboard operation
dialogflow-fulfillment-nodejs copied to clipboard

TELEPHONY Transfer response

Open samko635 opened this issue 7 years ago • 13 comments

Is there way I can send back Telephony's "transfer" response using webhook? I cannot find any reference about Telephony platform from document.. It'd be great if you could point me to the guide whitepaper. If not, just let me know how to send back transfer response. I appreciate the help.

samko635 avatar Aug 16 '18 03:08 samko635

I would also like to know this as I want to execute my own code simultaneously.

nathanjliu avatar Aug 16 '18 12:08 nathanjliu

Is there any news on programatically transferring calls using the phone gateway?

nathanjliu avatar Sep 27 '18 13:09 nathanjliu

On this reference page you will see the TelephonyTransferCall method

findzaatar avatar Oct 02 '18 19:10 findzaatar

On this reference page you will see the TelephonyTransferCall method

Is this possible to use in fulfilment code? I can't find a way?

nathanjliu avatar Oct 03 '18 08:10 nathanjliu

I was able to achieve a call transfer from the fulfillment code by:

DESIGNER

  • creating an Intent in the designer for the transfer
  • Set a Default Response text
  • Set a Telephony Response for the Call Transfer with the number
  • Make sure the "Use response from the DEFAULT tab as the first response" is OFF
  • Create an Event on the intent (e.g. "my-transfer-event")

FULFILLMENT

// set a dummy default intent
// the designer response text is used but we need this!? 
// otherwise we get default response errors in the fulfillment code/logs
agent.add("dummy default response that is ignored"); 

// call the event
agent.setFollowupEvent("my-transfer-event");

// call should be transferred using the Intent transfer settings (does for me)

LukeHartcher avatar Nov 21 '18 00:11 LukeHartcher

What version of dialogflow-fulfillment are you using @LukeHartcher - 0.4.1, 0.5.0, 0.6.0?

buffolander avatar Nov 21 '18 00:11 buffolander

What version of dialogflow-fulfillment are you using @LukeHartcher - 0.4.1, 0.5.0, 0.6.0?

package.json

  "dependencies": {
    "actions-on-google": "^2.2.0",
    "firebase-admin": "^5.13.1",
    "firebase-functions": "^2.0.2",
    "dialogflow": "^0.6.0",
    "dialogflow-fulfillment": "^0.5.0"
  }

It was a new agent/intent that I created yesterday, so just the defaults.

LukeHartcher avatar Nov 21 '18 00:11 LukeHartcher

Thanks @LukeHartcher! I've been having some trouble with setFollowupContext. I'll try the steps you've taken.

buffolander avatar Nov 21 '18 03:11 buffolander

Hope I have understood the question correctly but to make a telephony transfer from fulfillment code I use this structure const bodyObject = { "fulfillmentMessages": [ { "platform": "TELEPHONY", "telephonySynthesizeSpeech": { "ssml": "<speak>Whatever message you want to say to the caller<break time=0.2s />Goodbye</speak>" } }, { "platform": "TELEPHONY", "telephonyTransferCall": { "phoneNumber": "+1989XXXXXX" //E.164 format phone number, US only at this point } }, { "text": { "text": [ "Some text if your fulfillment code is called from a text based service" ] } } ] };

This will play the announcement to the caller first and then transfer the call (Only works with PhoneGateway, doesn't work if you SIP trunk into Dialogflow. I send bodyObject back to Dialogflow as part of my response.

Hope that helps, apologies if I missed the point of the question.

jphorsfield avatar Dec 03 '18 15:12 jphorsfield

Using @jphorsfield 's solution, Dialogflow will play the message and then transfer the call. However, the transfer occurs before the message finishes and I hear it overlapping the destination call.

sodle avatar Jun 27 '19 20:06 sodle

Hope I have understood the question correctly but to make a telephony transfer from fulfillment code I use this structure const bodyObject = { "fulfillmentMessages": [ { "platform": "TELEPHONY", "telephonySynthesizeSpeech": { "ssml": "<speak>Whatever message you want to say to the caller<break time=0.2s />Goodbye</speak>" } }, { "platform": "TELEPHONY", "telephonyTransferCall": { "phoneNumber": "+1989XXXXXX" //E.164 format phone number, US only at this point } }, { "text": { "text": [ "Some text if your fulfillment code is called from a text based service" ] } } ] };

This will play the announcement to the caller first and then transfer the call (Only works with PhoneGateway, doesn't work if you SIP trunk into Dialogflow. I send bodyObject back to Dialogflow as part of my response.

Hope that helps, apologies if I missed the point of the question.

Hello, do you use this object with agent.add in the transfer function?

Maksym9669 avatar Sep 06 '19 17:09 Maksym9669

Is it working now?

saileshrepo avatar Dec 22 '19 15:12 saileshrepo

To use this in fulfillment code, do this

  function someIntentHandler() {
    let responseJson = {};
    responseJson.fulfillmentText = "";
    let richResponses = [
      {
        "text": {
          "text": [
            "This text  will be returned to the user if it is not a phone call."
          ]
        }
      },
      {
        "platform": "TELEPHONY",
        "telephonyTransferCall": {
          "phoneNumber": "+19998887777"
        }
      }
    ];

    responseJson.fulfillmentMessages = richResponses;
    response.json(responseJson);
  }

this will transfer the call to +19998887777.

andermoran avatar Jan 15 '20 15:01 andermoran