cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
755
Views
0
Helpful
0
Replies

Where is Fetch Audio Cut Off in Yes No Menu

shayanahmad96
Level 1
Level 1

I am playing the initial menu prompt through fetchaudio before sending the call to a custom class which checks certain parameters. If the result is false, the call is sent to a custom Menu element where i have disabled audio groups. This was done to ensure that the fetchaudio is not cut off. However, even now the fetchaudio is immediately cut off when call enters the custom YesNoMenu class. I have provided the code for the class below. Can someone please help me identify which part causes the audio to be cut off so i can remove that as well. Thank you.

 

package com.audium.server.voiceElement.menu;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;

import com.audium.core.vfc.VException;
import com.audium.core.vfc.VPreference;
import com.audium.core.vfc.form.VBlock;
import com.audium.core.vfc.form.VBuiltInField;
import com.audium.core.vfc.form.VForm;
import com.audium.core.vfc.util.VAction;
import com.audium.core.vfc.util.VEvent;
import com.audium.core.vfc.util.VGrammar;
import com.audium.core.vfc.util.VLink;
import com.audium.core.vfc.util.VMain;
import com.audium.core.vfc.util.VProperty;
import com.audium.server.session.VoiceElementData;
import com.audium.server.voiceElement.AudioGroup;
import com.audium.server.voiceElement.AudiumElement;
import com.audium.server.voiceElement.Dependency;
import com.audium.server.voiceElement.ElementData;
import com.audium.server.voiceElement.ElementException;
import com.audium.server.voiceElement.ExitState;
import com.audium.server.voiceElement.Setting;
import com.audium.server.voiceElement.VoiceElementBase;
import com.audium.server.voiceElement.util.HelpPrompt;
import com.audium.server.voiceElement.util.NoInputPrompt;
import com.audium.server.voiceElement.util.NoMatchPrompt;
import com.audium.server.voiceElement.util.VoiceElementUtil;
import com.audium.server.xml.VoiceElementConfig;

public class MyCustomMenu extends VoiceElementBase implements AudiumElement {
protected static final String FORM_NAME = "yesNoMainForm";
protected static final String YES_FORM_NAME = "yesNoDoneForm";
private static String FIELD_NAME = "yesNo_fld";
private static final String SUBMIT_MAIN_FIELD_NAME_SCRATCH = "the_main_field_name";
private static String DEFAULT_CONFIDENCE = "0.5";
private static String DEFAULT_NOINPUT_TIMEOUT = "5s";

public MyCustomMenu() {
}

public String getElementName() {
return "Yes_No_Menu";
}

public String getDescription() {
return "The Yes_No_Menu voice element presents a yes/no menu. The voice element can be configured to allow spoken input or DTMF (touchtone) entry which will automatically map the button 1 to yes and the button 2 to no.";
}

public String getDisplayFolderName() {
return "Menu";
}

public Setting[] getSettings() throws ElementException {
Setting[] settingArray = new Setting[]{new Setting(10), new Setting(15), new Setting(14), new Setting(13), new Setting("confidence_level", "Confidence Level", "The confidence level threshold to use during input capture. Possible values: decimal (0.0 - 1.0). Default = 0.50. ", true, true, true, new Float(0.0F), new Float(1.0F)), new Setting("replay", "Replay", "This setting indicates whether or not the caller can say 'replay' to hear the initial audio group again. Default = false.", true, true, true, 4), new Setting("modal", "Disable Hotlinks", "Whether or not to disable all Hotlink elements and Local Hotlinks for the duration of this element.", true, true, true, 4)};
settingArray[0].setDefaultValue("both");
settingArray[1].setDefaultValue("5s");
settingArray[2].setDefaultValue("3");
settingArray[3].setDefaultValue("3");
settingArray[4].setDefaultValue("0.50");
settingArray[5].setDefaultValue("false");
settingArray[6].setDefaultValue("false");
Dependency d1 = new Dependency(settingArray[0].getRealName(), "both", 1);
Dependency d2 = new Dependency(settingArray[0].getRealName(), "voice", 1);
Dependency[] depArray1 = new Dependency[]{d1, d2};
settingArray[4].setDependencies(depArray1);
return settingArray;
}

public String[] getAudioGroupDisplayOrder() {
//String[] displayOrder = new String[]{"YesNo Capture", "End"};
//return displayOrder;
return null;
}

public HashMap getAudioGroups() throws ElementException {
//HashMap groups = new HashMap(2);
// AudioGroup[] audioGroupArray = new AudioGroup[]{new AudioGroup(1), new AudioGroup(2), new AudioGroup(3), new AudioGroup(4)};
// AudioGroup[] endArray = new AudioGroup[]{new AudioGroup("yes_audio_group", "Yes", "This audio group will be played when the caller says yes.", false, true)};
// groups.put("YesNo Capture", audioGroupArray);
// groups.put("End", endArray);
// Setting[] settingArray = this.getSettings();
// Dependency d1 = new Dependency(settingArray[0].getRealName(), "both", 1);
// Dependency d2 = new Dependency(settingArray[0].getRealName(), "voice", 1);
// Dependency[] depArray1 = new Dependency[]{d1, d2};
// audioGroupArray[3].setDependencies(depArray1);
return null;
}

public ExitState[] getExitStates() throws ElementException {
ExitState[] exitStateArray = new ExitState[]{new ExitState("yes", "yes", "This exit state will be returned if the caller said yes."), new ExitState("no", "no", "This exit state will be returned if the caller said no."), new ExitState(2), new ExitState(3)};
return exitStateArray;
}

public ElementData[] getElementData() throws ElementException {
ElementData[] elementDataArray = new ElementData[]{new ElementData(1), new ElementData(3)};
return elementDataArray;
}

public String addXmlBody(VMain vxml, Hashtable reqParameters, VoiceElementData md) throws VException, ElementException {
VoiceElementConfig config = md.getVoiceElementConfig();
VPreference pref = md.getPreference();
String submittedMainFieldName = (String)md.getScratchData("the_main_field_name");
String yesNoField = null;
if (submittedMainFieldName != null) {
yesNoField = (String)reqParameters.get(submittedMainFieldName);
}

String confidence = (String)reqParameters.get("confidence");
VProperty prop = vxml.getProperties();
String timeout = config.getSettingValue("noinput_timeout", md);
if (timeout == null) {
prop.add(9, DEFAULT_NOINPUT_TIMEOUT);
} else {
prop.add(9, timeout);
}

if (reqParameters.get("maxNoMatch") != null) {
return "max_nomatch";
} else if (reqParameters.get("maxNoInput") != null) {
return "max_noinput";
} else {
String returnValue = new String();
if (yesNoField == null) {
VForm form = VForm.getNew(pref, "start");
if (form.getUniqueFormNameFormat() != null) {
form.setName("yesNoMainForm");
}

String replay = config.getSettingValue("replay", md);
Boolean replayBool = new Boolean(false);
if (replay != null && replay.equalsIgnoreCase("true")) {
replayBool = new Boolean(true);
}

String inputmode = config.getSettingValue("inputmode", md);
if (inputmode == null) {
inputmode = config.getSettingValue("recognition", md);
}

VoiceElementUtil.addConfidenceProperty(vxml, inputmode, config.getSettingValue("confidence_level", md), DEFAULT_CONFIDENCE);
VBuiltInField field = null;
VGrammar gram = VGrammar.getNew(pref, true);
VEvent event = VEvent.getNew(pref, "replay_event");
event.addCount(1);
event.setReprompt(1, false);
event.addItem(1, VAction.getNew(pref, 1, form.getCompleteFormName()));
VLink link;
if (!"voice".equalsIgnoreCase(inputmode) && !"asr".equalsIgnoreCase(inputmode)) {
if ("dtmf".equalsIgnoreCase(inputmode)) {
field = VBuiltInField.getNew(pref, 0, FIELD_NAME, 1);
if (replayBool != null) {
// gram.setDtmfInline(new String[]{"3"});
link = VLink.getNew(pref, 3, "replay_event", gram);
field.setLinks(link);
field.add(event);
}
} else {
field = VBuiltInField.getNew(pref, 0, FIELD_NAME, 3);
if (replayBool != null) {
// gram.setSpeechInline(new String[]{"replay"});
// gram.setDtmfInline(new String[]{"3"});
link = VLink.getNew(pref, 3, "replay_event", gram);
field.setLinks(link);
field.add(event);
}
}
} else {
field = VBuiltInField.getNew(pref, 0, FIELD_NAME, 2);
if (replayBool != null) {
// gram.setSpeechInline(new String[]{"replay"});
link = VLink.getNew(pref, 3, "replay_event", gram);
field.setLinks(link);
field.add(event);
}
}

boolean modal = config.getBooleanSettingValue("modal", false, md);
field.setModal(modal);
field.setParentFormName(form.getCompleteFormName());
String completeFieldName = field.getCompleteFormItemName();
//VoiceElementConfig.AudioGroup initialPrompt = config.getAudioGroup("initial_audio_group", 1);
//if (initialPrompt == null) {
//throw new ElementException("The initial_audio_group is required for " + md.getCurrentElement() + ".");
//System.out.println("No Prompt Needed");
//int i = 1;
//}

//field.setPromptCount(1, initialPrompt.constructAudio(md));
//NoMatchPrompt nomatch = new NoMatchPrompt(md, "nomatch_audio_group", "max_nomatch_count", this.getSubmitURL(), 3);
//field.add(nomatch.getEvent());
NoInputPrompt noinput = new NoInputPrompt(md, "noinput_audio_group", "max_noinput_count", this.getSubmitURL(), 3);
field.add(noinput.getEvent());
//List var24 = config.getAudioGroupList("help_audio_group");
//if (var24.size() > 0) {
//HelpPrompt help = new HelpPrompt(md, "help_audio_group");
//field.add(help.getEvent());
//}

field.add(VoiceElementUtil.getUtteranceInteractionAssignment(completeFieldName + "$.utterance", completeFieldName + "$.inputmode", completeFieldName, completeFieldName + "$.confidence", pref));
VAction finalAction = VAction.getNew(pref, 18, "confidence", completeFieldName + "$.confidence", false);
finalAction.add(this.getSubmitURL(), "audium_vxmlLog confidence");
field.add(finalAction);
//form.add(VoiceElementUtil.getInitialAudioGroupLogBlock(pref, (String)null, "initial_audio_group", completeFieldName));
form.add(field);
vxml.add(form);
returnValue = null;
md.setScratchData("the_main_field_name", completeFieldName);
} else if (yesNoField.equalsIgnoreCase("true")) {
returnValue = "yes";
md.setElementData("value", returnValue, 0, true);
md.setElementData("confidence", confidence, 2, true);
md.setElementData("value_confidence", confidence, 2, true);
VoiceElementConfig.AudioGroup yesPrompt = config.getAudioGroup("yes_audio_group", 1);
if (yesPrompt != null) {
VForm form = VForm.getNew(pref, "start");
if (form.getUniqueFormNameFormat() != null) {
form.setName("yesNoDoneForm");
}

VBlock block = VBlock.getNew(pref);
block.add(yesPrompt.constructAudio(md));
VAction action = VoiceElementUtil.getAudioGroupInteractionAssignment("yes_audio_group", pref);
action.add(this.getSubmitURL(), "audium_vxmlLog");
block.add(action);
form.add(block);
vxml.add(form);
}
} else if (yesNoField.equalsIgnoreCase("false")) {
returnValue = "no";
md.setElementData("value", returnValue, 0, true);
md.setElementData("confidence", confidence, 2, true);
md.setElementData("value_confidence", confidence, 2, true);
}

return returnValue;
}
}
}

0 Replies 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: