LumenVox Pizza Demo
Asterisk Pizza Demo

The LumenVox Pizza Demo is an application written in the Asterisk Dial Plan that uses the LumenVox Speech Engine. It is meant to demonstrate how to use speech recognition functions in Dial Plan. It also makes use of speech recognition in AGI, the Asterisk Gateway Interface. If you would like to see what it sounds like, you may call our demonstration hotline to interact with a version of it.

The LumenVox Pizza Demo assumes you have some knowledge of working with the Asterisk Dial Plan. The Asterisk Web site contains more information about working with extensions.conf and the Dial Plan.

You will need the LumenVox Speech Engine for Asterisk installed in order to use the demo application.

Installing the Pizza Demo

Once you have download the file, uncompress it to a working directory. You will have to place the files in the proper directories.

  • Grammars: All the files that end in .gram are grammar files. They contain the words that will be recognized by the Speech Engine. They need to be placed in the /etc/asterisk/grammars/ directory.
  • Sounds: All the files in the PizzaAudio directory (they end in .ulaw or .wav) contain the audio for the prompts. They need to be placed in the /var/lib/asterisk/sounds/ directory.
  • Dial Plan: The extensions.conf file is the Dial Plan file that contains the application code. Either move the file into /etc/asterisk/ or copy the code into your existing extensions.conf file.
  • LumenVox configuration: The lumenvox.conf file controls settings for the Speech Engine. You will need to copy the [grammars] section into your own lumenvox.conf file, located in the /etc/asterisk/ directory.
  • AGI: The say-ingredients.agi file contains Perl script that parses the ingredients spoken by callers and then reads them back. It needs to be placed in the /var/lib/asterisk/agi-bin/ directory.
  • You also need to make this file executable. From inside of the /var/lib/asterisk/agi-bin/ directory, type chmod +x say-ingredients.agi and press enter. You will need administrative privileges to execute this command.

Pizza Demo on Asterisk Using the Dial Plan

Author: Randal Rand

;This is the entry point for the pizza demo IVR 
;To open a port the the Speech Engine you need 
;to do a SpeechCreate first before you can do any 
;of the other Speech applications 
exten => s,1,Answer 
exten => s,2,Wait(1) 
exten => s,3,SpeechCreate 
exten => s,4,Goto(order-pizza,s,1)

exten => s,1,Playback(GP-Greeting)
;The THRESHOLD is a value compared to the 
;SPEECH_SCORE(x), which is the confidence score 
;returned by the Speech Engine.
exten => s,2,Set(THRESHOLD=500)
exten => s,3,Goto(pizza-delivery,s,1)

;This context will get whether the caller 
;requests delivery or takeout [pizza-delivery] 
exten => s,1,SpeechActivateGrammar(order) 
exten => s,2,SpeechStart 
exten => s,3,SpeechBackground(GP-DeliveryorTakeout)
;If there are no results (no input) then we re-prompt them.
exten => s,4,GotoIf($["${SPEECH(results)}" = "0"]?5:7) 
exten => s,5,Playback(GP-NoDeliveryorTake-out)
exten => s,6,Goto(2)
exten => s,7,Set(TEXT=${SPEECH_TEXT(0)}) 
;If the confidence score is below the threshold then we confirm the intent 
;of the spoken phrase.
exten => s,8,Gotoif($[ "${SPEECH_SCORE(0)}" > "${THRESHOLD}" ]?12:9) 
exten => s,9,Macro(speech-confirm,${SPEECH_TEXT(0)})
exten => s,10,GotoIf($["${CONFIRM}" = "no"]?3:11) 
exten => s,11,Noop(speech_score=${SPEECH_SCORE(0)})
;If the intent has been confirmed then the type of order is fixed 
exten => s,12,Set(TYPE_OF_ORDER=${TEXT}) 
exten => s,13,SpeechDeactivateGrammar(order)
exten => s,14,Noop
exten => s,15,GotoIf($["${ARSO}" = "1"]?16:17) 
exten => s,16,Goto(confirm-order,s,1)
exten => s,17,Goto(pizza-size,s,1)
Download Code

© 2018 LumenVox, LLC. All rights reserved.