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

Event ECMA Script Variables + More

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jdart
Posts: 17
Joined: Wed Jul 30, 2008 1:09 pm

Event ECMA Script Variables + More

Post by jdart »

I've added a logging system to my vxml application but it only works when a form is filled out correctly (i.e. no nomatch or noinput events thrown). I'm trying to figure out a way to get it logging noinput and nomatch events as well.

I log by calling a subdialog which submits data into a database. I want to use subdialog rather than submit because I would like the existing vxml to continue after the logging is done. Unfortunately the subdialog tag can only occur in a form tag and this is what I'm having trouble working around.

Consider the following vxml snippet

Code: Select all

<form id="form_1">
    <field name="yn" type="boolean">
        <prompt>Say yes or no.</prompt>
        <error>
            <assign name="log_next" expr="'#form_1'" />
            <assign name="log_type" expr="'error'" />
            <assign name="log_name" expr="???" />
            <assign name="log_value" expr="???" />
            <goto next="#log" />
        </error>
        <filled>
            <assign name="log_next" expr="'#form_2'" />
            <assign name="log_type" expr="'normal'" />
            <assign name="log_name" expr="'yn'" />
            <assign name="log_value" expr="yn" />
            <goto next="#log" />
        </filled>
    </field>
</form>

<form id="form_2">
    ...
</form>

<form id="log">
    <subdialog .... />
    <goto expr="log_next" />
</form>
Firstly, in the error tag how do I determine the type of event and how do I determine the count of that event. I would like to put those values in place of the '???'s.

Secondly, this approach to logging errors doesn't really work since the event count will be reset when I leave form_1 to call the log form. If I could put a subdialog tag in the error tag that would be awesome... but since I can't I have to think of another way to do this.

I could maintain my own variables for event counts but I'd rather not duplicate that work. Is there a better way to go about this?

TIA

-Jonathan

jdart
Posts: 17
Joined: Wed Jul 30, 2008 1:09 pm

Post by jdart »

I just discovered the data tag. I've answered the second part of my post with that.

The documentation at http://www.plumvoice.com/docs/dev/ should be stickied! I found it by chance.

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

Use <catch> tag to log noinput and nomatch events on I

Post by support »

Hi Jonathan,

Generally, the IVR tag, <error>, is used for catching all types of IVR errors. So, if you wanted to specifically catch noinput or nomatch events, you should use the <catch> tag. For IVR example:

Code: Select all

 <catch event="noinput">
            <assign name="log_next" expr="'#form_1'" />
            <assign name="log_type" expr="'error'" />
            <assign name="log_name" expr="'noinput" />
            <assign name="log_value" expr="???" />
</catch>
 
This IVR post further shows the specific types of events you can catch so that you can properly log events:

http://support.plumvoice.com/viewtopic.php?t=978

As for keeping count for the events, the IVR tag, <catch>, has a "count" attribute so that you can keep track of how many times the event has happened. Or, alternatively, as you mentioned, you could use your own variables for event counts.

Regards,
Plum Support

Post Reply