SIGN UP

How to Connect Watson Voice Agent with Voximplant

How to Connect Watson Voice Agent with Voximplant

Initially a cognitive system, IBM Watson has become an entire ecosystem of services based on advanced NLP (Natural Language Processing) algorithms. One of the recent blocks of this ecosystem is the Watson Voice Agent which allows Watson to speak with people. Since IBM Watson’s capabilities are already proven in terms of accuracy, we could not ignore this brand new functionality so we tested it with our platform. The integration is not complicated in technical terms and is based on a SIP call to the agent. Learn how to create a Watson Voice Agent and connect it with Voximplant right now, using this tutorial.

What you need

  • A Voximplant developer account. If you don’t have one, sign up here.
  • An IBM Cloud account. If you don’t have one, sign up here.
  • A phone number that is purchased from Voximplant.
  • A JS scenario, which we will create in this tutorial.

1. Creating an IBM resource

Go to your IBM Cloud account and click Create resource in the upper right corner. Choose the Web and Application category, then click Voice Agent with Watson.

You can leave all fields as default and click Create at the bottom of the page. In a few moments, you will get to the dashboard of a newly created resource with an agent menu in the left part of the screen. There is a Manage section on the menu that we will get to later in this tutorial.

2. Phone number

The agent requires a phone number to be available for calls. To purchase a number, do the following: in the Voximplant control panel, on the left menu, select Numbers and click Buy new phone number in the upper right corner.

The Buy new phone number dialog page will be displayed. Switch to Test numbers, select a number in the list, and click Buy selected to buy a virtual phone number.

You will immediately see the purchased number in your numbers list. Copy this number and go back to the Voice Agent resource.

3. Creating an agent

In order to navigate through your resources, you can click Services on the main dashboard of https://cloud.ibm.com/.

Click Voice Agent with Watson in the unfolded Services list to open the recently created resource. That’s it!

Next, open Manage on the left menu and click the Create a voice agent button in the upper right corner. Here, you will need to enter a name for the agent and paste the Voximplant phone number purchased in step 2.

You will see a message that a new agent with three added services has been successfully created.

4. Implementing a dialog skill

Click the hamburger icon in the upper left corner, then click Resources list. In the unfolded Services list, select VoiceAgent-WatsonAssistant (the last one in the list); then click Launch tool and switch to the Skills tab. There is already a VoiceGatewayConversation skill implemented by default, which you can use, but we will go over creating your own dialog skill for a better understanding of how this functionality works.


While on the Skills tab, click Create skill. Write simple-skill for the name, leave the default language as English (US), and click Create dialog skill.

There are three tabs inside a skill:

  • Intents – customer phrases and their variations
  • Entities – keywords for recognition and their synonyms
  • Dialog – a dialog flowchart

Add the #whatcanido intent under Intents and add a couple of variants for it (“What can I do?”, “Show me the options”, etc.).

Inside of Entities, add the following:

  • @continue with the synonyms, “go on”, “proceed”
  • @options with the synonyms, “variants”, “option”, “choices”
  • @stop with the synonyms, “stopped”, “quit”

Next, go the Dialog tab and click Create dialog; the flowchart with the Welcome and Anything else blocks will appear. Open Anything else and adjust its settings according to the screenshot below. Pay attention that we also added a keyword (an entity) as an additional condition to increase chances for correct recognition. The text is: “You can choose to continue this meaningless conversation or stop it. Say ‘continue’ or ‘stop’. ”

Then use the three dots in the Anything else block to reveal more options. One of them is Add child node. Use it to create 2 blocks, the settings of which  are shown below:

This way, the agent would either loop the conversation or end it if a customer said “stop”.

QUICK TIP
Instead of creating this dialog skill manually, you can download a JSON file and import it as a skill. To do so, click Create skill, then switch to the Import skill tab, click Choose JSON file, specify the downloaded file, and click Import.

 Last but not least, go back to https://cloud.ibm.com/, open Resource list, choose Voice Agent with Watson, and switch to the Manage tab. Use the three dots to Edit agent. In the Conversation section, change a skill to simple-skill. The Watson part is done and now, the agent can speak with people. It’s time to get back to your Voximplant developer account.

5. Application and scenario

Go to the Applications section of the Voximplant Control Panel to create a watson application. Note that all further steps should be performed in this section.

Switch to the Scenarios tab of a newly created watson application and create a watson-scenario with the following code:

require(Modules.ASR)

VoxEngine.addEventListener(AppEvents.CallAlerting, (e) => {
  let call2 = VoxEngine.callSIP("sip:699100484@us-east.voiceagent.cloud.ibm.com")

  const recognition = VoxEngine.createASR({
    lang: ASRLanguage.ENGLISH_US
  })
  let botSpeech = ""

  recognition.addEventListener(ASREvents.Result, e => {
    botSpeech += e.text
    botSpeech.includes("goodbye") ? VoxEngine.terminate() : Logger.write("There is no 'goodbye' yet.")
  })

  call2.addEventListener(CallEvents.Connected, () => call2.sendMediaTo(recognition))

  VoxEngine.easyProcess(e.call, call2)

})
attention
Don’t forget to substitute your purchased number for the callSIP function call!

 Next, go to the Routing tab to create a watson-rule. Specify the watson-scenario as an assigned scenario:

Finally, open the Numbers tab with the Attached (yet empty) and Available sections. Switch to Available, select your number, and click Attach.

In the window opened, specify the watson-rule, then click Attach.

From now on, the purchase number is in the Attached section. Here, you can also see the instructions on how to call your virtual number to start a sophisticated conversation with an IBM bot.

Tags:ainlpmachine learningvoice botibm watson
B6A24216-9891-45D1-9D1D-E7359CEB8282 Created with sketchtool.

Comments(0)

Add your comment

Please complete this field.

Recommended

Sign up for a free Voximplant developer account or talk to our experts
SIGN UP