cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TTS - Callouts, say something after returning my runMenu

beaver
New Contributor

Given for example this menu

%{
   id: "menu_id",
   mainPrompt: "..",
    options: [
      %{dtmf: 1, action: "menu(some_menu)"},
      %{dtmf: 2, action: "return(other)"}
    ]
}


What is the best way to add a TTS segment if the callee chooses 2 in this menu? Currently, the call simply hangs up.

3 REPLIES 3

Alex_Sberna
Employee
Employee

Hi beaver,

 

It depends on what behavior you want to happen. You could have a say instruction with some other action, such as hanging up, or placing the call on hold or something like that. Otherwise if you want another choice to be presented, you could have another submenu, which could have its own prompt with TTS and present more choices.

This tutorial uses our Java SDK to create an IVR, but the principles are the same and should explain how to set up submenus or other actions.

Please let me know if you have any other questions.

Thanks!

Alex Sberna, Documentation Engineer

I would like a simple say instruction before hang up, I'm juste not sur how to trigger the instruction if the callee, in that case, press 2. I'll take a look at the Java exemple if I find anything.

So essentially what you do is set up another SVAML object with the say instruction you want and the hangup action, then you call that SVAML object as the return action.

You need to handle the incoming menu result PIE and map it to the action you want to take. This example uses Javascript:

 

function handleMenuResult(menuResult){
  switch (menuResult){
    case 'sip':
      return sipResponse();
    case 'non-sip':
      return nonSipResponse();
    default:
      return defaultResponse();
  }
}

function humanResponse(){
  return {
    action: {
      name: 'runMenu',
      barge: false,
      menus: [
        { id: 'main',
          mainPrompt: '#tts[Hi, you awesome person! Press 1 if you have performed this tutorial using a sip infrastructure. Press 2 if you have not used a sip infrastructure. Press any other digit to end this call.]',
          repeatPrompt: '#tts[Again, simply press 1 if you have used sip, press 2 if you have not, or press any other digit to end this call.]',
          repeats: 2,
          options: [
            {
              dtmf: 1,
              action: 'return(sip)'
            },
            {
              dtmf: 2,
              action: 'return(non-sip)'
            }
          ]
        }
      ]
      }
  };
}

 

 

Alex Sberna, Documentation Engineer