This tag creates a variable which can be used later in the dial plan. The contents of the variable created by <setvar> is a data string. This data string may be referenced (e.g.,${call.lastinput}) or defined (e.g., "Elvis Presley"). The <setvar> tag also supports basic math and Boolean expressions in JavaScript. NOTE: you can reference the uploaded spreadsheet data by using column letters, such as ${call.field.a} which could reference Column A containing the customer name.


Example values: "${call.lastinput}" or "Elvis Presley" or "${answer8} + 10":


Attribute Required Values Description
name N any text A unique name for the tag
varname Y any text The name given to the variable to reference it later in the dial plan.


New York
${answer8} + 10

Useage Scenario - Exploding a number for correct TTS playback

The setvar tag can be used to open up a long number string entered by the user, so that it can be read back by the text-to-speech engine as individual integers rather than as a whole number. The following example shows the user input (keypress tag), using setvar to open up the input string (setvar tag), and the playback of the number as integers (play tag):

    "${call.lastinput}".split("").join(" ");
    You entered ${ExplodedInput}. 
                                     If this is correct, please press one...