SIGN UP

Voicemail detection powered by AI

Voicemail detection powered by AI

 

There is a number of different scenarios when you would like to know if you've reached voicemail or live person during the call, and if voicemail was reached it's a good thing to know when you can play a pre-recorded voice message to leave it in the inbox. Keeping in mind that Voximplant is a perfect choice for building power dialer or predictive dialer app it makes a lot of sense to offer this functionality to our developers. We've substantially updated our voicemail detection using the machine learning approach. The AI-based voicemail is highly precise in detecting pre-recorded audio messages which allows to handle reaching a voicemail or answering machine.

To have an access to this functionality, you should use the AI module in scenarios (see the further examples).

Power dialer

Let's start with a simpler scenario – agent calls customers using some call list and while he reaches voicemail he sends some pre-recorded mp3 message to the inbox. In terms of VoxEngine scenario this code will look like as follows:

require(Modules.AI)

const call = VoxEngine.callPSTN('phone number to call', 'rented or verified phone number')

// Keeping in mind that some voicemail systems can work in pre-connected state (early media),
// it's better to use AudioStarted event
call.addEventListener(CallEvents.AudioStarted, (e) => {
  // Enable voicemail detection 
  AI.detectVoicemail(call)
    .then(e => {
      Logger.write(`Voicemail detected (${e.confidence}%)`)
      call.startPlayback('URLtoMP3')
      // Hangup call after mp3 message was played to the inbox
      call.addEventListener(CallEvents.PlaybackFinished, (e) => {
        call.hangup()
      })
    })
    .catch(e => Logger.write("Voicemail not detected!"))
})

Predictive Dialer

In case of predictive dialing, we don't rely on a live person to detect voicemail, since it's an automated process and we don't want to spend call center agents' time. Since voicemail systems behave differently it's not possible to offer 100% warranty in case of automated voicemail detection, but we made our best and implemented number of adjustable subsystems that help with the process. We will use the same detectVoicemail function to analyze audio stream in both pre-connected and connected states of a call. The handlers themselves will be the same as in the Power dialer example:

require(Modules.AI)

let callconnected = false
let voicemail = false

const call = VoxEngine.callPSTN('phone number to call', 'rented or verified phone number')
// Start from detecting voicemail tone in the pre-connected state
call.addEventListener(CallEvents.AudioStarted, (e) => {
  // Enable voicemail detection
  AI.detectVoicemail(call)
    .then(e => {
      // Voicemail found
      if (!callconnected) {
        Logger.write(`Voicemail tone detected while earlyMedia. (${e.confidence})`)
        voicemail = true
      } else {
        Logger.write(`Voicemail tone detected after call connected. (${e.confidence})`)
      }
    })
    .catch(e => {
      // No voicemail found
      if (!callconnected) {
        Logger.write('Voicemail tone wasn\'t detected while earlyMedia')
      } else {
        Logger.write('Voicemail tone wasn\'t detected after call connected')
      }
    })
})

// If we haven't detected voicemail yet,
// start voicemail detection in the connected state
call.addEventListener(CallEvents.Connected, (e) => {
  callconnected = true
  if (!voicemail) {
    AI.detectVoicemail(call)
      .then(e => {
        // Voicemail found
        Logger.write(`Voicemail tone detected during a call. (${e.confidence})`)
        voicemail = true
      })
      .catch(e => {
        // No voicemail found
        // We can assume that we have reached a live person
        Logger.write('Live person detected.')
      })
  }
})

So when voicemail is reached, the corresponding variable will be set to true, otherwise, it will be set to false. A developer can make a decision depending on the data while forwarding a call to a free operator using ACD and CallList modules for predictive dialing.

Tags:voicemail
B6A24216-9891-45D1-9D1D-E7359CEB8282 Created with sketchtool.

Comments(0)

Add your comment

Please complete this field.

Recommended

Get your free developer account or talk with our sales team to learn more about Voximplant solutions
SIGN UP