dialogflow-esvoximplant

Voximplant sendDigits method returning error in scenario


I have a scenario in my Voximplant application in which I am trying to use the sendDigits method to navigate touch tone menus.

I am not sure I am implementing it right in the scenario as the log returns an error - JS error: sendDigits is not defined.

Here is the code I am using in the scenario, everything works great up to sendDigits:

    // Navigate TouchTone Menu
    if (AI.Events.DialogflowResponse !== undefined)
     dialogflow.addEventListener(AI.Events.DialogflowResponse, (event) => {
       if (event.response.queryResult !== undefined) {
        let result = event.response.queryResult
        if (result.queryText === undefined) {
          if (result.languageCode !== undefined) startASR();
           return
         }
        if (result.parameters.TouchToneNumber !== undefined) {
            sendDigits({
              digits: result.parameters.TouchToneNumber
            })
         }
         }
      })
      // End TouchTone Code Section

Solution

  • Try:

    if (result.parameters.TouchToneNumber !== undefined) {
                 call.sendDigits({
                   digits:result.parameters.TouchToneNumber
                 })
    

    sendDigits() method send DTMF digits to the remote peer. You should specify which object you are applying this method to, the call in the Voximplant scenario is the object.