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

Dynamic replay-ability

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
werner.coetzee
Posts: 5
Joined: Wed Dec 10, 2014 8:24 am

Dynamic replay-ability

Post by werner.coetzee »

Hi

We currently give in our voiceXML a prompt after the message to press any key to replay the messages. The listener currently has the option to replay the message 2 times, in other words, the message can be played 3 times in total.
At the moment, each replay is hard-coded in the voiceXML, with the goto tag to jump to the next replay.

Below is an example of what we currently do.
My question is, is there any other way of doing this so that the replays are not hard-coded? So in the future if the business wants more replay options, we only need to make a small change instead of adding more hard-coded voiceXML?

Code: Select all

<vxml version="2.0">
    <property name="inputmodes" value="dtmf"/>
    <property name="termtimeout" value="6s"/>
    <property name="timeout" value="6s"/>
    <property name="termmaxdigits" value="true"/>
    <property name="voicename" value="Ray"/>
    <form id="form1">
        <block>
            <prompt>Hello my friend, welcome to our service.</prompt>
        </block>
        <field name="play1" type="digits?length=1">
            <prompt bargein="true">Press any key to replay the message.</prompt>
            <filled>
                <goto next="#form2"/>
            </filled>
            <noinput>
                <prompt>Goodbye</prompt>
                <exit/>
            </noinput>
        </field>
    </form>
    <form id="form2">
        <block>
            <prompt>Hello my friend, welcome to our service.</prompt>
        </block>
        <field name="play2" type="digits?length=1">
            <prompt bargein="true">Press any key to replay the message.</prompt>
            <filled>
                <goto next="#form3"/>
            </filled>
            <noinput>
                <prompt>Goodbye</prompt>
                <exit/>
            </noinput>
        </field>
    </form>
    <form id="form3">
        <block>
            <prompt>Hello my friend, welcome to our service.</prompt>
        </block>
    </form>
</vxml>
Thanks
Werner

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

Re: Dynamic replay-ability

Post by support »

Hi Werner,

If you want to give the user the option of replaying the message indefinitely, you can simply goto the beginning of the same form:

Code: Select all

<vxml version="2.0">
    <property name="inputmodes" value="dtmf"/>
    <property name="termtimeout" value="6s"/>
    <property name="timeout" value="6s"/>
    <property name="termmaxdigits" value="true"/>
    <property name="voicename" value="Ray"/>
    <form id="form1">
        <block>
            <prompt>Hello my friend, welcome to our service.</prompt>
        </block>
        <field name="play1" type="digits?length=1">
            <prompt bargein="true">Press any key to replay the message.</prompt>
            <filled>
                <goto next="#form1"/>
            </filled>
            <noinput>
                <prompt>Goodbye</prompt>
                <exit/>
            </noinput>
        </field>
    </form>
</vxml>
If you want to only allow the caller to replay the prompt a certain number of times, you can use a counter variable to keep track of how many times the prompt has been played. Here is an example of using two forms: one to play the message and evaluate the replay counter threshold and another to prompt the user whether or not they would like to replay the message and handle incrementing the counter variable:

Code: Select all

<vxml version="2.0">
    <property name="inputmodes" value="dtmf"/>
    <property name="termtimeout" value="6s"/>
    <property name="timeout" value="6s"/>
    <property name="termmaxdigits" value="true"/>
    <property name="voicename" value="Ray"/>
    <var name="replay_counter" expr="1"/>
    <var name="replay_max" expr="3"/>
    <form id="message">
        <block>
            <prompt>Hello my friend, welcome to our service.</prompt>
            <if cond="replay_counter < replay_max">
                <goto next="#replay_message"/>
            <else/>
                <goto next="#move_on"/>
            </if>
        </block>
    </form>
    <form id="replay_message">
        <field name="play1" type="digits?length=1">
            <prompt bargein="true">Press any key to replay the message.</prompt>
            <filled>
                <assign name="replay_counter" expr="++replay_counter"/>
                <goto next="#message"/>
            </filled>
            <noinput>
                <prompt>Goodbye</prompt>
                <exit/>
            </noinput>
        </field>
    </form>
    <form id="move_on">
        <block>
            <prompt>Replay count exceeded. Goodbye.</prompt>
            <exit/>
        </block>
    </form>
</vxml>
Using this method, if you ever wanted to change the number of times the message can be replayed, you would only need to change the replay_max variable.

Hope that helps!

Regards,
Plum Support

werner.coetzee
Posts: 5
Joined: Wed Dec 10, 2014 8:24 am

Re: Dynamic replay-ability

Post by werner.coetzee »

Thanks!

The counter variable example works perfectly.

Thanks for the helpful assistance.

Post Reply