blob: 706541b09c001fc8885d2ccf7578bc1827fdcecb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
<?xml version="1.0"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:vxml="http://www.w3.org/2001/vxml" datamodel="ecmascript">
<!-- get dump() function into datamodel -->
<script src="file:///Users/sradomski/Desktop/dump.js"/>
<script>
vxmlTargetURL = "http://localhost:9090/mmi";
</script>
<state id="prompts">
<transition event="error" target="done">
<log expr="'An error occured:' + _event" />
</transition>
<state id="vxmlPrompt1">
<!-- Test that rendering a prompt sends start and done events -->
<invoke type="vxml" id="vxml">
<param name="target" expr="vxmlTargetURL"/>
<content>
<vxml:prompt>Testing start and done events</vxml:prompt>
</content>
<finalize>
<script>dump(_event);</script>
</finalize>
</invoke>
<state id="waitForPrompt1Start">
<transition event="vxml.output.start" target="waitForPrompt1Done"/>
</state>
<state id="waitForPrompt1Done">
<transition event="vxml.output.done" target="vxmlPrompt2"/>
</state>
</state>
<state id="vxmlPrompt2">
<!-- Test prompts in form with goto -->
<invoke type="vxml" id="vxml">
<param name="target" expr="vxmlTargetURL"/>
<content>
<vxml:vxml version="2.1">
<vxml:form id="say_hello">
<vxml:block>
Testing prompts in form
<vxml:goto next="#say_goodbye"/>
</vxml:block>
</vxml:form>
<vxml:form id="say_goodbye">
<vxml:block>
<vxml:prompt>with goto</vxml:prompt>
</vxml:block>
</vxml:form>
</vxml:vxml>
</content>
<finalize>
<script>dump(_event);</script>
</finalize>
</invoke>
<state id="waitForPrompt2HelloStart">
<transition event="vxml.output.start" target="waitForPrompt2HelloDone"/>
</state>
<state id="waitForPrompt2HelloDone">
<transition event="vxml.output.done" target="waitForPrompt2ByeStart"/>
</state>
<state id="waitForPrompt2ByeStart">
<transition event="vxml.output.start" target="waitForPrompt2ByeDone"/>
</state>
<state id="waitForPrompt2ByeDone">
<transition event="vxml.output.done" target="waitForPrompt2HelloDone"/>
</state>
</state>
</state>
<state id="forms">
<transition event="error" target="done">
<log expr="'An error occured:' + _event" />
</transition>
<invoke type="vxml" id="vxml">
<param name="target" expr="vxmlTargetURL"/>
<content>
<vxml:vxml version="2.1">
<vxml:form id="launch_missiles">
<vxml:field name="user_id" type="digits">
<vxml:prompt>What is your username</vxml:prompt>
</vxml:field>
<vxml:field name="password">
<vxml:prompt>What is the code word?</vxml:prompt>
<vxml:grammar version="1.0" root="root">
<vxml:rule id="root" scope="public">rutabaga</vxml:rule>
</vxml:grammar>
<vxml:help>It is the name of an obscure vegetable.</vxml:help>
<vxml:catch event="nomatch noinput" count="3">
<vxml:prompt>Security violation!</vxml:prompt>
</vxml:catch>
</vxml:field>
</vxml:form>
</vxml:vxml>
</content>
<finalize>
<script>dump(_event);</script>
</finalize>
</invoke>
<state id="waitForMissileEvents">
<transition event="vxml.input.field.user_id" target="done">
<log expr="'Welcome ' + _event.data.value + ' please provide credentials!'" />
</transition>
<transition event="vxml.input.field.password" />
</state>
</state>
<final id="done" />
</scxml>
|