Collect Input tools don’t listen for Speech :revisted:

Has anything come of the above?

If there are no functions to use speech recognition with the collect input block then...

Does anyone have a decent example of being able to produce a task that can capture speech recognised instructions (and/or) dtmf? with the existing objects available to menu's but in conjunction with a task flow?

Cheers,

Bundy :metal:

The collect input action only listens to DTM not speech. You can listen for speech by using a menu instead of the collect input action. Task 1 listens for "one" or DTMF 1, Task 2 listens for "two" or DTMF 2, etc.

Thanks @MelissaBailey for providing the above example.

How does one include that type of menu in the task in place of the collect input for instance in a flow like this:

Furthermore, what would an architect script example look like to include a menu that has speech recognition in it followed by a switch case to appropriately route each choice?

Cheers,

Bundy :metal:

Hi @MelissaBailey and others,

So I didn't get a response example of how to achieve a similar flow in menu driven style using architect script sdk and ended up fumbling my way through how to do it with my attempt below:

const   architectScripting = require('purecloud-flow-scripting-api-sdk-javascript'),
        clientId = '<<insert client id here>>',
        clientSecret = '<<insert client secret here>>',
        authToken = '<<insert auth token here>>',
        flowName = 'Test Menu with Submenu',
        flowDescription = 'This is the basic phone system',
        scriptingActionFactory = architectScripting.factories.archFactoryActions, // Factory to create actions
        scriptingEnums         = architectScripting.enums.archEnums,              // Enum support
        scriptingFlowFactory   = architectScripting.factories.archFactoryFlows,   // Factory to create flows
        scriptingLanguages     = architectScripting.languages.archLanguages,      // Language support
        scriptingSession       = architectScripting.environment.archSession,      // Session support
        scriptingTaskFactory   = architectScripting.factories.archFactoryTasks,   // Factory to create tasks
        scriptingLogger        = architectScripting.services.archLogging,         // Logging support
        scriptingMenuFactory   = architectScripting.factories.archFactoryMenus,   // Factory to create menus
        location               = scriptingEnums.LOCATIONS.prod_us_east_1;
        scriptingLogger.logNotesVerbose = true;
    const main = (scriptSession) => {
            scriptingLogger.logNote(`#########################EXECUTE MAIN#########################-${new Date().toDateString() + ' ' + new Date().toLocaleTimeString()}`);
            return scriptingFlowFactory.createFlowInboundCallAsync(flowName, flowDescription, scriptingLanguages.englishAustralia, (archInboundCallFlow) => {
                archInboundCallFlow.initialAudio.setDefaultCaseExpressionToAudioTTS('');
                archInboundCallFlow.settingsSpeechRec.asrCompanyDir = scriptingEnums.SPEECH_REC_COMPANY_MODES.entireFlow;
                archInboundCallFlow.settingsSpeechRec.asrEnabledOnFlow = true;                
               const startMenu = scriptingMenuFactory.addMenu(archInboundCallFlow, 'Start Menu','Hello', true),
                      welcomeMenu = scriptingMenuFactory.addMenuSubMenu(startMenu,'Welcome Prompt','#','Thank you for calling, Please select from the main menu'),
                      mainMenu = scriptingMenuFactory.addMenuSubMenu(welcomeMenu,'Main Menu','#','This is the Main Menu. Press one or say accounts.'),
                      accountsMenu = scriptingMenuFactory.addMenuSubMenu(mainMenu,'Accounts Menu','1','Thank you, you have selected accounts'),
                      accountsAcd = scriptingMenuFactory.addMenuTransferToAcd(accountsMenu,'Accounts Queue','#','We will put you through to the accounts team now.');
                      accountsAcd.actionTransferToAcd.failureTransferAudio.setDefaultCaseExpressionToAudioTTS('We are sorry a system issue has occurred, please try calling us again in sixty minutes, goodbye..');
                      accountsAcd.actionTransferToAcd.targetQueue.setLiteralByQueueNameAsync('Basic Queue');
                      startMenu.settingsMenu.repeatCount.setLiteralInt(0);
                      startMenu.settingsMenu.menuSelectionTimeout.setLiteralMs(1000);
                      startMenu.settingsMenu.listenForExtensionDialing.setLiteralFalse();
                      welcomeMenu.settingsMenu.repeatCount.setLiteralInt(0);
                      welcomeMenu.settingsMenu.menuSelectionTimeout.setLiteralMs(1000);
                      welcomeMenu.settingsMenu.listenForExtensionDialing.setLiteralFalse();
                      mainMenu.settingsMenu.repeatCount.setLiteralInt(1);
                      mainMenu.settingsMenu.menuSelectionTimeout.setLiteralMs(5000);
                      mainMenu.settingsMenu.listenForExtensionDialing.setLiteralFalse();
                      mainMenu.addSpeechRecTerm(scriptingLanguages.englishAustralia,'Accounts');
                      accountsMenu.settingsMenu.repeatCount.setLiteralInt(0);
                      accountsMenu.settingsMenu.menuSelectionTimeout.setLiteralMs(1000);
                      accountsMenu.settingsMenu.listenForExtensionDialing.setLiteralFalse();
                      /*
                       * Set the default menu choice for each menu.
                       * Only the starting menu gets set!!!
                       */
                      startMenu.menuDefault = welcomeMenu;
                      welcomeMenu.menuDefault = mainMenu;
                      mainMenu.menuDefault = accountsMenu;
                      accountsMenu.menuDefault = accountsAcd;
                return archInboundCallFlow.validateAsync()
                    .then((validationResults) => {
                        if (validationResults.hasErrors) {
                            scriptingLogger.logError('There is at least one validation error in the created flow.  Not publishing.');
                        }
                        else if (validationResults.hasWarnings) {
                            scriptingLogger.logWarning('There is at least one validation warning in the created flow.  Not publishing.');
                        }
                        else {
                            scriptingLogger.logNote('The flow has no validation errors or warnings.  Time to publish it.');
                            return archInboundCallFlow.publishAsync()
                                .then(() => {
                                    scriptingLogger.logNote();
                                    scriptingLogger.logNote('****************************************************************************');
                                    scriptingLogger.logNote('The flow \'' + archInboundCallFlow.name + '\' is now published in and available in Architect.');
                                    scriptingLogger.logNote('Flow URL: ' + archInboundCallFlow.url);
                                    scriptingLogger.logNote('****************************************************************************');
                                    scriptingLogger.logNote(`LastError(${scriptingLogger.lastError})`);
                                scriptingLogger.logNote(`#########################EXIT MAIN#########################-${new Date().toDateString() + ' ' + new Date().toLocaleTimeString()}`);
                                }
                            );
                        }
                    }
                );
            });
    }
scriptingSession.startWithAuthToken(location, main, authToken);
//scriptingSession.startWithClientIdAndSecret(location, main, clientId, clientSecret);

While the commander processes the default menu choice for each menu in console like so:

But then when you view the flow all but the initial one has actually taken affect?

Any chance you can take my example script for a spin and work out what I have done wrong or is this actually a bug?

Cheers,

Bundy

I ran your code and it created a valid flow. Can you explain what you want it do instead?

@MelissaBailey

Did you read the following section? When you execute the default menu choices using architect scripting the console outputs that your request has been executed however once you open the actual flow you will notice that only the very first default menu choice has been assigned??????

Is this a bug?

Sorry, I didn't read your response carefully enough. This is a bug, and we'll get it fixed.

Hi @Bundy,

We identified and have fixed the problem setting the menuDefault property on an ArchMenuSubMenu instance.

The fix for this will go out in our next deploy of Architect Scripting to npm. Currently this fix, along with some other fixes and internal updates, is being tested. As of now there is no ETA on when the fix will be available on npm but I wanted to let you know we're working on it.

Thanks,

Jim

Thanks for the update guys, I appreciate it. :smiley:

@Bundy, I wanted to let you know we published version 0.2.7 of Architect Scripting to npm today which has the menuDefault property setter fix in it.

Link -> https://www.npmjs.com/package/purecloud-flow-scripting-api-sdk-javascript

Thanks again for reporting that issue,

Jim

@Ullyot_Jim, @MelissaBailey,

Thanks guys :metal::grinning::metal:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.