<?xml version="1.0" encoding="UTF-8"?>
<ccxml xmlns="http://www.w3.org/2002/09/ccxml" xmlns:conf="http://www.w3.org/2005/ccxml-conformance" version="1.0">
	<!--
      <conf:fail reason="'Unexpected Event ' + event$.name"/>
-->
	<conf:docsetup/>
	<var name="ConnectionID" expr="undefined"/>
	<var name="param1" expr="1"/>
	<var name="param2" expr="'hello'"/>
	<var name="chld_reason"/>
	<var name="send_id_1"/>
	<var name="DialogID"/>
	<var name="i_success"/>
	<var name="TEST_509_false" expr="false"/>
	<var name="TEST_509_true" expr="true"/>
	<var name="assert_1223_conn_id"/>
	<var name="assert_1226_N" expr="1234"/>
	<var name="assert_1226_S" expr="'^%1234$'"/>
	<var name="assert_1226_eventID"/>
	<var name="assert_1226_TestVal"/>
	<var name="assert_512" expr="0"/>
	<var name="n_ZERO" expr="0"/>
	<var name="n_ONE" expr="1"/>

	<var name="cur_event_ID"/>
	<var name="MY_BLANK" expr="''"/>
	<var name="WKR_STRING"/>
	<var name="event_source_type_ccxml" expr="'ccxml'"/>
	<script><![CDATA[
	   function GetMilliseconds() {
     var d = new Date();
     return d.getTime();  // ms from midnight on Jan 1, 2000.
   }

var t_start, t_end, t_delay = 2000, t_delta, t_delta_e = 0.05 * t_delay;
		   ]]></script>
	<script><![CDATA[
	var assert_1226_X = new Object();
	var assert_1226_Y = new Object();
	assert_1226_X.var_1 = 567;
	assert_1226_X.var_2 = 'foo bar';
	assert_1226_Y.var_3 = 'Y_var_3';
var i=0;
assertions[i++] = init_assertion('1221');
assertions[i++] = init_assertion('1223');
assertions[i++] = init_assertion('1256');

assertions[i++] = init_assertion('505');
assertions[i++] = init_assertion('1257');

assertions[i++] = init_assertion('507');
assertions[i++] = init_assertion('508');
assertions[i++] = init_assertion('511');
assertions[i++] = init_assertion('513');
assertions[i++] = init_assertion('509');
assertions[i++] = init_assertion('1226');
assertions[i++] = init_assertion('1227');
assertions[i++] = init_assertion('512');
assertions[i++] = init_assertion('1246');
assertions[i++] = init_assertion('534');


add_2_assert_trace('497');
add_2_assert_trace('1224');
add_2_assert_trace('510');
add_2_assert_trace('514');
add_2_assert_trace('515');
add_2_assert_trace('1225');
add_2_assert_trace('1231');
add_2_assert_trace('1248');
add_2_assert_trace('1249');
add_2_assert_trace('1250');
add_2_assert_trace('1251');
add_2_assert_trace('592');
add_2_assert_trace('588');
add_2_assert_trace('589');
add_2_assert_trace('590');
add_2_assert_trace('591');
add_2_assert_trace('594');


var assert_last = i - 1;
var assert_index = -1;
//
// out of the loop assertions (children?)
//
//
s_ASSERTIONS_LEFT = show_remained_assertions();
var b_in_test = false;


]]></script>
	<eventprocessor statevariable="current_state">
		<conf:setup type="alerting"/>
		<transition event="connection.alerting" state="init">
			<send targettype="'ccxml'" target="session.id" name="'user.timeout'" delay="TEST_LONG_TIMEOUT"/>
			<accept connectionid="event$.connectionid"/>
		</transition>
		<transition event="connection.connected" state="init">
			<assign name="ConnectionID" expr="event$.connectionid"/>
			<assign name="assert_1223_conn_id" expr="event$.connectionid"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.PREPARE_NEW">
			<conf:comment expr="'Event: ' + event$.name"/>
			<if cond="assert_index &gt;= 0">
				<assign name="ASSERTION_NUM" expr="assertions[assert_index].number"/>
				<assign name="t_ASSERT_RESULT" expr="assertions[assert_index].P_F"/>
				<script>t_ASSERT_REASON = assertions[assert_index].reason</script>
				<if cond="t_ASSERT_RESULT == s_PASS">
					<conf:pass reason="t_ASSERT_REASON"/>
					<elseif cond="t_ASSERT_RESULT == s_FAIL"/>
					<conf:fail reason="t_ASSERT_REASON"/>
					<else/>
					<conf:not_exec reason="t_ASSERT_REASON"/>
				</if>
			</if>
			<assign name="assert_index" expr="assert_index + 1"/>
			<if cond="assert_index &gt; assert_last">
				<log label="s_TA" expr="s_ASSERTIONS_LEFT"/>
				<conf:uncond_exit expr="'DONE'"/>
				<else/>
				<log label="s_TA" expr="s_ASSERTIONS_LEFT"/>
				<assign name="ASSERTION_NUM" expr=" assertions[assert_index].number"/>
				<assign name="t_ASSERT_REASON" expr="''"/>
				<script>assertions[assert_index].P_F = s_FAIL;</script>
				<assign name="current_state" expr="state_prefix + ASSERTION_NUM"/>
				<send targettype="'ccxml'" target="session.id" name="start_name_prefix + ASSERTION_NUM" sendid="cur_event_ID"/>
				<log label="s_TA" expr="'Loop event: SendID=' + cur_event_ID"/>
			</if>
		</transition>
		<transition event="user.START_ASSERTION_1221" state="ASSERTION_NMBR_1221">
			<!--
588  	
9.4.2 Standard Event Attributes  	
All events MUST contain a name attribute containing a string name of the event  	mscott@voicegenie.com  	Accepted  	
-->
			<var name="event_name" expr="'user.START_ASSERTION_1221'"/>
			<assign name="ASSERTION_NUM" expr="'588'"/>
			<if cond="event$.name == undefined">
				<assign name="chld_reason" expr="'event$.name undefined'"/>
				<conf:fail reason="chld_reason"/>
				<elseif cond="event$.name != event_name"/>
				<assign name="chld_reason" expr="'event$.name=' + event$.name + ' expectd=' + event_name"/>
				<conf:fail reason="chld_reason"/>
				<else/>
				<conf:pass/>
			</if>
			<!--
1249 	
9.2.3 &lt;send&gt; 	
Events generated by <send> MUST have their the eventid attribute set to the identifier generated and returned via sendid.
 	mscott@voicegenie.com 	Accepted 	

589 	
9.4.2 Standard Event Attributes 	
All events MUST contain an eventid attribute containing a unique identifier for the event 	mscott@voicegenie.com 	Accepted 	


590 	
9.4.2 Standard Event Attributes 	
If an event was sent using <send>, then the eventid attribute of the event MUST match the value returned via the sendid attribute of <send> (if specified) 	mscott@voicegenie.com 	Accepted 	


-->
			<assign name="ASSERTION_NUM" expr="'1249'"/>
			<if cond="event$.eventid == undefined">
				<assign name="chld_reason" expr="'event$.eventid undefined'"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'589'"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'590'"/>
				<conf:fail reason="chld_reason"/>
				<elseif cond="event$.eventid != cur_event_ID"/>
				<assign name="chld_reason" expr="'event$.eventid=' + event$.eventid + ' expectd cur_event_ID=' + send_id_1"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'590'"/>
				<conf:fail reason="chld_reason"/>

				<assign name="ASSERTION_NUM" expr="'589'"/>
				<conf:pass/>
				<else/>
				<conf:pass/>
				<assign name="ASSERTION_NUM" expr="'589'"/>
				<conf:pass/>
				<assign name="ASSERTION_NUM" expr="'590'"/>
				<conf:pass/>
			</if>
			<!--
1250 	
9.2.3 &lt;send&gt; 	
Events generated by <send> MUST have their eventsource 
attribute set to the session ID of the CCXML session performing the <send>. 	mscott@voicegenie.com 	Accepted 	

591 	
9.4.2 Standard Event Attributes 	
All events MUST contain an eventsource attribute containing a unique identifier for the event source 	mscott@voicegenie.com 	Accepted 	


-->
			<assign name="ASSERTION_NUM" expr="'1250'"/>
			<if cond="event$.eventsource == undefined">
				<assign name="chld_reason" expr="'event$.eventsource undefined'"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'591'"/>
				<conf:fail reason="chld_reason"/>

				<elseif cond="event$.eventsource != session.id"/>
				<assign name="chld_reason" expr="'event$.eventsource=' + event$.eventsource + ' expectd session.id=' + session.id"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'591'"/>
				<conf:pass/>
				<else/>
				<conf:pass/>
				<assign name="ASSERTION_NUM" expr="'591'"/>
				<conf:pass/>
			</if>
			<!--
1251 	9.2.3 &lt;send&gt; 	
Events generated by <send> MUST have their eventsourcetype attribute set to the string 'ccxml'. 	
mscott@voicegenie.com 	Accepted 	

592  	
9.4.2 Standard Event Attributes 	
All events MUST contain an eventsourcetype attribute containing the name of the Event I/O processor that sent the event 	mscott@voicegenie.com 	Accepted

-->
			<assign name="ASSERTION_NUM" expr="'1251'"/>
			<if cond="event$.eventsourcetype == undefined">
				<assign name="chld_reason" expr="'event$.eventsourcetype undefined'"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'592'"/>
				<conf:fail reason="chld_reason"/>
				<elseif cond="event$.eventsourcetype != event_source_type_ccxml"/>
				<assign name="chld_reason" expr="'event$.eventsourcetype=' + event$.eventsourcetype + ' expectd ' + event_source_type_ccxml"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'592'"/>
				<conf:fail reason="chld_reason"/>
				<else/>
				<conf:pass/>
				<assign name="ASSERTION_NUM" expr="'592'"/>
				<conf:pass/>
			</if>
			<assign name="ASSERTION_NUM" expr="'1221'"/>
			<!--
1221 		
9.1 Overview 	Events sent using <send> which specify a delay are not delivered 
to the target queue until the specified delay has elapsed. 	mscott@voicegenie.com 	Accepted 	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="t_start" expr="GetMilliseconds()"/>
			<send targettype="'ccxml'" target="session.id" name="'user.DELAYED_ASSERTION_1221'" delay="t_delay +'ms'"/>
		</transition>
		<transition event="user.DELAYED_ASSERTION_1221" state="ASSERTION_NMBR_1221">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="ASSERTION_NUM" expr="'1225'"/>
			<!--
1225 	
9.1 Overview 	
An <eventprocessor> MAY declare a state variable attribute that corresponds 
to a variable declared at CCXML scope. 	mscott@voicegenie.com 	Accepted 	
Case NO-var in <eventprocessor> is covered by tests in SEND_SUCS doc, which is a must for execution before this one
Case WIT-var in <eventprocessor> is covered here
-->
			<conf:pass/>
			<assign name="t_end" expr="GetMilliseconds()"/>
			<assign name="t_delta" expr="Math.abs(t_end - t_start)"/>
			<if cond="Math.abs(t_delta - t_delay) &gt; t_delta_e">
				<script>
			assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Delay time discrapancy: expected=' + t_delay + ' , actual=' + t_delta
			 </script>
				<else/>
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<assign name="current_state" expr="'GEN'"/>
			</if>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_1223" state="ASSERTION_NMBR_1223">
			<!--
1223 	
9.1 Overview 	
During the processing of an event by the EHIA, 
the state of any ECMAScript objects exposed by a platform, such as the Connection object, 
MUST reflect the state of the CCXML session immediately following the occurrence of the event. 
a 'connection.alerting' event is being processed against a connection with ID 1234, then session.connections['1234'].state would have a value of 'ALERTING'

-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<disconnect connectionid="assert_1223_conn_id"/>
		</transition>
		<transition event="connection.disconnected" state="ASSERTION_NMBR_1223" cond="(session.connections[assert_1223_conn_id].state  == Connection.DISCONNECTED) &amp;&amp; (session.connections[assert_1223_conn_id].connectionid == assert_1223_conn_id)">
			<conf:comment expr="'Event: ' + event$.name + ' state=' + current_state"/>
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<assign name="ASSERTION_NUM" expr="'497'"/>
			<!--
497 	(9_1_A)
SUGGESTED to REMOVE: covered by other SEND tests.	
9.1 Overview 	
The EHIA removes the event at the front of the event queue of a CCXML session and selects the <transition> 
(if any) that accepts the type of the event, accepts the current value of the ECMAScript state variable, 
has a satisfied conditional expression, 
and appears first in the <eventprocessor> document order. 	
-->
			<conf:pass/>
			<assign name="ASSERTION_NUM" expr="'1224'"/>
			<!--
1224 	
9.1 Overview 	
It is REQUIRED that the ECMAScript context for the session is updated to reflect state 
changes caused by an event prior to the selection of a matching <transition>. 	mscott@voicegenie.com 	Accepted 	

-->
			<conf:pass/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="connection.disconnected" state="ASSERTION_NMBR_1223">
			<conf:comment expr="'Event: ' + event$.name + ' state=' + current_state"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Session object is ' + session.connections[assert_1223_conn_id].state + ' Expected=' + Connection.DISCONNECTED;  
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_505" state="ASSERTION_NMBR_505">
			<!--
505 	
9.2.1 &lt;eventprocessor&gt; 	
A valid CCXML document MUST only have a single <eventprocessor>  	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<createccxml  next="'../../two_eventproc.xml'"/>
		</transition>
		<transition event="error.createccxml" state="ASSERTION_NMBR_505">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_PASS;
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="ccxml.created" state="ASSERTION_NMBR_505">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'fetch of the document ' + event$.uri + ' with 2 eventprocessors should have failed.'  

				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>

		<transition event="user.START_ASSERTION_1257" state="ASSERTION_NMBR_1257">
			<!--
1257 	
9.5.1 Fetching &amp; compilation errors 	
Errors that occur in the loading/compilation of a CCXML page triggered by a running CCXML document using 
<fetch> MUST generate an error.fetch event. 	mscott@voicegenie.com 	Accepted 	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<fetch next="'../../invalid_ccxml.xml'"/>
		</transition>
		<transition event="error.fetch" state="ASSERTION_NMBR_1257">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_PASS;
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="fetch.done" state="ASSERTION_NMBR_1257">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'fetch of the document ' + event$.uri + ' should have failed.'  

				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_1256" state="ASSERTION_NMBR_1256">
			<!--
1256  	
9.5.1 Fetching &amp; 
compilation errors  	Errors that occur in the loading/compilation of a CCXML page triggered by a running CCXML document using <createccxml> MUST generate an 
error.createccxml event.  	mscott@voicegenie.com  	Accepted  	

-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<createccxml next="'../../invalid_ccxml.xml'"/>
		</transition>
		<transition event="error.createccxml" state="ASSERTION_NMBR_1256">
			<conf:comment expr="'Event: ' + event$.name + ' reason=' + event$.reason"/>
<!--
594 	
9.4.5 Error Events 	
All error events MUST have a reason property set to a printable 
error message associated with the error 	mscott@voicegenie.com 	Accepted
-->
			<assign name="ASSERTION_NUM" expr="'594'"/>
			<if cond="event$.reason == undefined">
				<assign name="chld_reason" expr="'event$.reason undefined'"/>
				<conf:fail reason="chld_reason"/>
				<else/>
				<conf:pass/>
			</if>
			<assign name="ASSERTION_NUM" expr="'1256'"/>

			<script>assertions[assert_index].P_F = s_PASS;
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="ccxml.created" state="ASSERTION_NMBR_1256">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'createccxml of the document ' + event$.uri + ' should have failed.'  

				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>


		<transition event="user.START_ASSERTION_507" state="ASSERTION_NMBR_507">
			<!--
507 	
9.2.1 &lt;eventprocessor&gt; 	
If an <eventprocessor> defines a state variable, then the named state variable MUST be declared in the ccxml scope using a <var> or <script> 	mscott@voicegenie.com 	Accepted 	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<createccxml next="'../../udeclared_state_var.xml'"/>
		</transition>
		<transition event="error.createccxml" state="ASSERTION_NMBR_507">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_PASS;
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="ccxml.created" state="ASSERTION_NMBR_507">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'fetch of the document ' + event$.uri + ' with undeclared state variable should have failed.'  

				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_508" state="ASSERTION_NMBR_508">
			<!--
508 	
9.2.1 &lt;eventprocessor&gt; 	An <eventprocessor> MUST contain only <transition> elements 
	mscott@voicegenie.com 	Accepted 	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<createccxml next="'../../non_transition_in_eventproc.xml'"/>
		</transition>
		<transition event="error.createccxml" state="ASSERTION_NMBR_508">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_PASS;
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="ccxml.created" state="ASSERTION_NMBR_508">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'fetch of the document ' + event$.uri + ' with elemensts other than TRANSITION should have failed.'  

				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_511" state="ASSERTION_NMBR_511">
			<!--
511 	
9.2.2 &lt;transition&gt; 	
The state attribute of a <transition> matches an event if the current value of the <eventprocessor> 
state variable is identical to one of the states listed in the state attribute, or if the state attribute is not present 
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="'user.MY_ASSERTION_511'"/>
		</transition>
		<transition event="user.MY_ASSERTION_511" state="ASSERTION_NMBR_511 FOO BAR VAR_1">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="ASSERTION_NUM" expr="'510'"/>
			<!--
510 		(9_1_A)
9.2.2 &lt;transition&gt; 	
A <transition> element MAY contain a state attribute that lists, separated by whitespace, the values of the <eventprocessor> state variable that are accepted 	mscott@voicegenie.com 	-->
			<conf:pass/>
			<script>assertions[assert_index].P_F = s_PASS;
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.MY_ASSERTION_511">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Event shold have been handled by previous transition '

				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_513" state="ASSERTION_NMBR_513">
			<!--
513 	
9.2.2 &lt;transition&gt; 	
The event attribute of a <transition> matches an event only if it matches the name of the event, or if the event attribute is not present. In matching the event attribute to the event name, the character '*' is a wild-card and matches zero or more characters of the event's name. 	mscott@voicegenie.com 	Accepted 	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="t_start" expr="GetMilliseconds()"/>
			<send targettype="'ccxml'" target="session.id" name="'user.MY_ASSERTION_513'"/>
		</transition>
		<transition event="send.successful" state="ASSERTION_NMBR_513">
			<conf:comment expr="'Event: ' + event$.name  + ' ASSERTION_NMBR_513'"/>
		</transition>
		<transition state="ASSERTION_NMBR_513">
			<conf:comment expr="'Event: ' + event$.name  + ' Transition with cond attribute'"/>
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.MY_ASSERTION_513" state="ASSERTION_NMBR_513">
			<conf:comment expr="'Event: ' + event$.name + ' Transition with event attribute'"/>
			<script>
				assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Event shold have been handled by previous transition '
				</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_509" state="ASSERTION_NMBR_509">
			<!--

509
9.2.2 &lt;transition&gt;  	
In order to be selected, a <transition> MUST satisfy criteria on its state, cond, and name attributes.

-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="'user.MY_ASSERTION_509'"/>
		</transition>
		<transition event="user.MY_ASSERTION_509" state="ASSERTION_NMBR_509" cond="TEST_509_false">
			<conf:comment expr="'Event: ' + event$.name + ' '"/>
			<script>
				assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Event was handled by a transition with cond=fales  '
				</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.MY_ASSERTION_509" state="ASSERTION_NMBR_509" cond="TEST_509_true">
			<conf:comment expr="'Event: ' + event$.name + ' Transition with event attribute'"/>
			<assign name="ASSERTION_NUM" expr="'514'"/>
			<!--
514 	
9.2.2 &lt;transition&gt; 	
A <transition> element MAY contain a cond attribute that specifies an ECMAScript Boolean expression. 	mscott@voicegenie.com 	Accepted 	
-->
			<conf:pass/>
			<assign name="ASSERTION_NUM" expr="'515'"/>
			<!--
515       
9.2.2 &lt;transition&gt;    

The cond attribute of a <transition> matches an event only if it evaluates to true, or if it is not present             mscott@voicegenie.com             Accepted          

Make it verified after 509  done.

 
-->
			<conf:pass/>
			<script>
				assertions[assert_index].P_F = s_PASS;
				</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.MY_ASSERTION_509" state="ASSERTION_NMBR_509">
			<conf:comment expr="'Event: ' + event$.name + ' '"/>
			<script>
				assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Event shold have been handled by previous transition with cond attribute '
				</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_1226" state="ASSERTION_NMBR_1226">
			<!--
1226
9.2.2 &lt;transition&gt; 	
The contents of the received event object MUST be made available via the transition scoped ECMAScript variable named "event$" 	mscott@voicegenie.com 	Accepted 	


1231 	
9.2.3 &lt;send&gt; 	
When <send> is used with name and namelist, 
and the targettype is ccxml, variables specified in namelist, 
which may themselves be ECMAScript objects, are added as properties of the event object.

1248 	
9.2.3 &lt;send&gt; 	
The <send> element MAY contain a namelist attribute, 
which is a list of zero or more whitespace separated CCXML variable names to be included with the event.
 	mscott@voicegenie.com 	Accepted 	

-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="WKR_STRING" expr="'user.MY_ASSERTION_1226'"/>
			<send targettype="'ccxml'" sendid="assert_1226_eventID" target="session.id" name="WKR_STRING" namelist="assert_1226_N assert_1226_S assert_1226_X assert_1226_Y.var_3"/>
			<assign name="assert_1226_TestVal" expr="WKR_STRING + 'ccxml' + assert_1226_N + assert_1226_S + assert_1226_X.var_1 + assert_1226_X.var_2 +  assert_1226_Y.var_3"/>
		</transition>
		<transition event="user.MY_ASSERTION_1226" state="ASSERTION_NMBR_1226">
			<assign name="WKR_STRING" expr="event$.name + event$.eventsourcetype  + event$.assert_1226_N + event$.assert_1226_S + event$.assert_1226_X.var_1 + event$.assert_1226_X.var_2 + event$.assert_1226_Y.var_3"/>
			<conf:comment expr="'Event: ' + event$.name + ' ' + event$.assert_1226_eventID  + event$.assert_1226_N + ' ' + event$.assert_1226_S + ' ' + event$.assert_1226_X.var_1 + ' ' + event$.assert_1226_X.var_2 + ' ' +  assert_1226_Y.var_3"/>
			<if cond="WKR_STRING == assert_1226_TestVal">
				<assign name="ASSERTION_NUM" expr="'1231'"/>
				<conf:pass/>
				<script>
				assertions[assert_index].P_F = s_PASS;
				</script>
				<else/>
				<assign name="ASSERTION_NUM" expr="'1231'"/>
				<conf:fail/>
				<script>
				assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Expected Test string:' + assert_1226_TestVal + ' Got:' + WKR_STRING;
				</script>
			</if>
			<assign name="current_state" expr="'GEN'"/>
			<assign name="ASSERTION_NUM" expr="'1248'"/>
			<conf:pass/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_1227" state="ASSERTION_NMBR_1227">
			<!--
1227 	
9.2.2 &lt;transition&gt; 	
The event$ variable is accessible from the <transition> cond attribute to allow CCXML Applications to conditionally select <transition>'s based on the contents of the event. 	mscott@voicegenie.com 	Accepted 	

-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="WKR_STRING" expr="'user.MY_ASSERTION_1227'"/>
			<send targettype="'ccxml'" target="session.id" name="WKR_STRING" namelist="assert_1226_N"/>
		</transition>
		<transition event="user.MY_ASSERTION_1227" state="ASSERTION_NMBR_1227" cond="event$.assert_1226_N == assert_1226_N">
			<script>
				assertions[assert_index].P_F = s_PASS;
				</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.MY_ASSERTION_1227" state="ASSERTION_NMBR_1227">
			<script>
				assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'transition with cond attribute should have been taken';
				</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_512" state="ASSERTION_NMBR_512">
			<!--
512 	
9.2.2 &lt;transition&gt; 	
A <transition> element MAY contain an event attribute that specifies a pattern used to match an event's name 	mscott@voicegenie.com 	Accepted 
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="'user.count.512.A'" delay="'100ms'"/>
			<send targettype="'ccxml'" target="session.id" name="'user.count.512.B'" delay="'200ms'"/>
			<send targettype="'ccxml'" target="session.id" name="'user.count.512.1B'" delay="'400ms'"/>
			<send targettype="'ccxml'" target="session.id" name="'user.count.512.ALL'" delay="'1500ms'"/>
		</transition>
		<transition event="user.count.512.ALL">
			<conf:comment expr="'Event: ' + event$.name"/>
			<if cond="assert_512 == 3">
				<script>
				assertions[assert_index].P_F = s_PASS;
				</script>
				<else/>
				<script>
				assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = ' Generic handler for user.count.* was visited only' + assert_512 + ' Expected: 3';
				</script>
			</if>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.count.512.*">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="assert_512" expr="assert_512 + 1"/>
		</transition>
		<transition event="user.START_ASSERTION_1246" state="ASSERTION_NMBR_1246">
			<!--
1246 	
9.2.2 &lt;transition&gt; 	
If a <transition> specifies a state attribute but its parent <eventprocessor> does not contain a statevariable attribute, the interpreter MUST fail to load the document. 	mscott@voicegenie.com 	Accepted
	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<createccxml next="'../../1246_state_var_in_transition_not_eventproc.xml'"/>
		</transition>
		<transition event="error.createccxml" state="ASSERTION_NMBR_1246">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_PASS;
				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="ccxml.created" state="ASSERTION_NMBR_1246">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'fetch of the document ' + event$.uri + ' with transition, containing state, but eventprocessor without state defined should have failed.'  

				</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.START_ASSERTION_534" state="ASSERTION_NMBR_534">
			<!--
534  
9.2.3 &lt;send&gt; 	
The queue of delayed events MUST be maintained locally and purged if the session 
issuing the request terminates before the event is sent. 	mscott@voicegenie.com 	Accepted 	
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<conf:comment expr="'If NO FAIL message, assertion PASS.'"/>
			<assign name="current_state" expr="current_state + 'a'"/>
			<send targettype="'ccxml'" target="session.id" name="'user.failed.534a'" delay="'150000ms'"/>
			<send targettype="'ccxml'" target="session.id" name="'user.failed.534b'" delay="'200000ms'"/>
		</transition>
		<transition event="user.failed.534*">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>
			assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Received an event which was supposed to be delayed and discarded '  
			
			</script>
			<script>t_ASSERT_REASON = assertions[assert_index].reason</script>
			<conf:fail reason="t_ASSERT_REASON"/>
			<exit/>
		</transition>
		<transition event="send.successful" state="ASSERTION_NMBR_534a">
			<conf:comment expr="'Event: ' + event$.name + ' state=' + current_state"/>
			<if cond="event$.sendid != cur_event_ID">
				<script>
			assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Received an event which was supposed to be delayed and discarded '  
			
			</script>
				<script>t_ASSERT_REASON = assertions[assert_index].reason</script>
				<conf:fail reason="t_ASSERT_REASON"/>
				<exit/>
			</if>
		</transition>
		<transition event="user.timeout"  state="ASSERTION_NMBR_534a">
			<conf:comment expr="'Event: ' + event$.name + ' state=' + current_state"/>
			<assign name="ASSERTION_NUM" expr="'534'"/>
			<conf:pass/>
			<conf:uncond_exit expr="show_remained_assertions()"/>
		</transition>
		
		<transition event="user.timeout">
			<assign name="current_state" expr="'GEN'"/>
			<conf:uncond_exit expr="'TEST-TIMEOUT.' + show_remained_assertions()"/>
		</transition>
		<transition event="send.successful">
			<conf:comment expr="'Event: ' + event$.name + ' (generic handler) state=' + current_state"/>
		</transition>
		<transition event="*">
			<assign name="t_ASSERT_REASON" expr="'UNEXPECTED EVENT ' + event$.name + ' IN STATE ' + current_state"/>
			<conf:comment expr="t_ASSERT_REASON"/>
			<if cond="current_state == 'init'">
				<conf:uncond_exit expr="'Did not come out from init state.'"/>
				<else/>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			</if>
		</transition>
		<!-- END Loquendo mod -->
	</eventprocessor>
</ccxml>
