We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Says the number by peer

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
soso
Posts: 62
Joined: Tue Apr 22, 2008 8:11 am

Says the number by peer

Post by soso »

Hi,

I would like to reapeat a field by peer.

Like example: I've the field "253754", and I want to say :

You say '25' '37' 54'.

If the number is : 1253754, I want to say '1' '25' '37' '54'.

How do I make this function?

Thanks by advance.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Use of javascript in IVR code

Post by support »

You can do this kind of IVR manipulation in javascript and say the result using an IVR tag, <value>. More specifically, <value expr=""/>.

Say the original field or variable was named "number".

You could do something like what you are asking with

Code: Select all

<script>
  var pause = ' ... ';
  var split = number.split('');
  if (split.length % 2) { split.unshift(' '); }
  var number_split = '';
  for (var i in split) {
    number_split +=  (i % 2 ? '' : pause) + split[i];
  }
</script>
<prompt>
  <value expr="number_split"/>
</prompt>
To change the length of the pause, change the value of the "pause" variable in the IVR script to some other string.
Last edited by support on Wed Feb 24, 2010 12:36 pm, edited 7 times in total.

soso
Posts: 62
Joined: Tue Apr 22, 2008 8:11 am

Post by soso »

Ok, thanks.

Can you tell me what are this instructions :

(i % 2 ? '' : pause)

Thanks.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

clarification of IVR code

Post by support »

This part of the IVR code essentially means: If i modulus 2 is equal to 0, insert a pause.

Post Reply