Page 1 of 1
Says the number by peer
Posted: Thu Jun 18, 2009 3:34 am
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.
Use of javascript in IVR code
Posted: Thu Jun 18, 2009 3:28 pm
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.
Posted: Fri Jun 19, 2009 4:46 am
by soso
Ok, thanks.
Can you tell me what are this instructions :
(i % 2 ? '' : pause)
Thanks.
clarification of IVR code
Posted: Fri Jun 19, 2009 9:24 am
by support
This part of the IVR code essentially means: If i modulus 2 is equal to 0, insert a pause.