<?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">
	<var name="test_779_ini" expr="session.id"/>
	<!--
      <conf:fail reason="'Unexpected Event ' + event$.name"/>
-->
	<conf:docsetup/>
	<var name="ConnectionID" expr="undefined"/>
	<var name="VxmlFile2" expr="'TWO_2.vxml'"/>
	<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="cur_event_ID"/>
	<var name="MY_BLANK" expr="''"/>
	<var name="WKR_STRING"/>
	<var name="test_788_uri" expr="TEST_IR_URI+'8_3/8_3_A.ccxml?var_a_1176=1176a&amp;var_b_1176=1176b'"/>
		
	<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 i=0;
assertions[i++] = init_assertion('779');
assertions[i++] = init_assertion('780');
assertions[i++] = init_assertion('781');
 
add_2_assert_trace('782');
add_2_assert_trace('783');
add_2_assert_trace('784');
add_2_assert_trace('788');
add_2_assert_trace('790');
add_2_assert_trace('791');
add_2_assert_trace('1031');
add_2_assert_trace('1033');
add_2_assert_trace('1176');

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>
	<var name="s_782_alert"/>
	<var name="s_782_conn"/>
	<var name="s_779_conn"/>
	<var name="assert_782_conn_id"/>
	<eventprocessor statevariable="current_state">
		<conf:setup type="alerting"/>
		<transition event="connection.alerting" state="init">
			<assign name="assert_782_conn_id" expr="event$.connectionid"/>
			<assign name="s_782_alert" expr="session.connections[assert_782_conn_id].state"/>
			<send targettype="'ccxml'" target="session.id" name="'user.timeout'" delay="TEST_LONG_TIMEOUT"/>
			<accept connectionid="event$.connectionid"/>
		</transition>
		<transition event="connection.connected" state="init">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="ConnectionID" expr="event$.connectionid"/>
			<assign name="s_782_conn" expr="session.connections[assert_782_conn_id].state"/>
			<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 with assertion loop.'"/>
				<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_779" state="ASSERTION_NMBR_779">
			<conf:comment expr="'Event: ' + event$.name"/>
			<!--
779 	
8.3 Session Variables 	
The session variables are defined by the CCXML implementation when the CCXML session is created 	
emily.candell@comverse.com 	Accepted 	

-->
			<if cond="test_779_ini==session.id">
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<else/>
				<script>
			assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'assigned value of session id=' + test_779_ini + ' expected=' + session.id;
			 </script>
			</if>
			<assign name="ASSERTION_NUM" expr="'782'"/>
			<if cond="(s_782_alert==0)&amp;&amp;(s_782_conn==2)">
				<!--
782 	
8.3 Session Variables 	
Session variable values visible to a CCXML application reflect the state of the executing CCXML session, 
current as of the occurrence of the event being processed. 
Regardless of when session variables are updated to reflect changes, 
the CCXML implementation is REQUIRED to provide the correct values when accessed by a CCXML program. 	
emily.candell@comverse.com 	Accepted 	
-->
				<conf:pass/>
				<assign name="ASSERTION_NUM" expr="'791'"/>
				<!--
791 	

8.3 Session Variables 	
session.connections is an array which contains a list of the Connection objects that the session is currently using. 
The array is associative and each key in the array is the connection identifier for the Connection. 	emily.candell@comverse.com 	Accepted 	
-->
				<conf:pass/>
				<else/>
				<assign name="chld_reason" expr="' s_782_alert=' + s_782_alert + ' expected=0; s_782_conn=' +  s_782_conn + ' expected=2'"/>
				<conf:fail reason="chld_reason"/>
			</if>
			<assign name="ASSERTION_NUM" expr="'783'"/>
			<if cond="session.startupmode != undefined">
				<!--
783 	
8.3 Session Variables 	session.startupmode 
indicates the startup mode that the script was started as. 	emily.candell@comverse.com 	Accepted
-->
				<conf:pass/>
				<else/>
				<assign name="chld_reason" expr="' session.startupmode is undefined'"/>
				<conf:fail reason="chld_reason"/>
			</if>
			<assign name="ASSERTION_NUM" expr="'784'"/>
			<if cond="session.startupmode=='newcall'">
				<!--
784 	
8.3 Session Variables 	
For a new incoming call, session.startupmode will be set to 'newcall' 	emily.candell@comverse.com 	Accepted 
-->
				<conf:pass/>
				<else/>
				<assign name="chld_reason" expr="' session.startupmode=' + session.startupmode + ' expected=newcall'"/>
				<conf:fail reason="chld_reason"/>
			</if>
			<assign name="ASSERTION_NUM" expr="'788'"/>
			<if cond="session.uri==test_788_uri">
<!--
788 	
8.3 Session Variables 	
session.uri is a URI that was used when creating the current CCXML session. 	emily.candell@comverse.com 	Accepted 	
-->
				<conf:pass/>
				<assign name="ASSERTION_NUM" expr="'1176'"/>
<!--
1176 	
8.3 Session Variables 	
session.uri includes the query string used when fetching the document, if one is present. 	emily.candell@comverse.com 	Accepted 	
-->
				<conf:pass/>
				<else/>
				<assign name="chld_reason" expr="' session.uri=' + session.uri + ' expected=' + test_788_uri"/>
				<conf:fail reason="chld_reason"/>
				<assign name="ASSERTION_NUM" expr="'1176'"/>
				<conf:fail/>
			</if>
			
			<assign name="ASSERTION_NUM" expr="'790'"/>
			<if cond="session.parentid == undefined">
				<!--
790 
8.3 Session Variables 	
In the case the current session has no parent, the value of session.parentid will be ECMAScript undefined. 	emily.candell@comverse.com 	Accepted 	
-->
				<conf:pass/>
				<else/>
				<assign name="chld_reason" expr="' session.startupmode is undefined'"/>
				<conf:fail reason="chld_reason"/>
			</if>

			<assign name="ASSERTION_NUM" expr="'1031'"/>
			<if cond="session.id == id">
<!--
1031 	
8.3 Session Variables 	
Variables defined in the session scope are subject to the parent scope chain delegation model but do not have a parent scope defined. 	
emily.candell@comverse.com 	Accepted 	
-->
				<conf:pass/>
				<else/>
				<assign name="chld_reason" expr="' session.id=' + session.id + ' and variable id=' + id"/>
				<conf:fail reason="chld_reason"/>
			</if>

			<assign name="ASSERTION_NUM" expr="'1033'"/>
			<if cond="typeof(session.ioprocessors) == 'object'">
<!--
1033 	
8.3 Session Variables 	
session.ioprocessors is an associative Array which contains a list of external event I/O access URIs which are available to the current session. 
The array is associative and each key in the array is the type of the event I/O processor. 	emily.candell@comverse.com 	Accepted 	
-->
				<conf:pass/>
				<else/>
				<assign name="chld_reason" expr="' typeof(session.ioprocessors)=' + typeof(session.ioprocessors)"/>
				<conf:fail reason="chld_reason"/>
			</if>
<!--
1034
8.3 
Session Variables 	
session.values is an associative array which contains a list of session parameters passed on session creation 	
emily.candell@comverse.com 	Accepted 	
-->

<!--
789 	
8.3 Session Variables 	
session.parentid is a string that indicates the session identifier of the parent of the CCXML session that created this session. 	emily.candell@comverse.com 	Accepted -->

<!--
786
8.3 Session Variables 	
For a session that was started due to a <createccxml> request, session.startupmode will be set to 'createccxml' 	emily.candell@comverse.com 	Accepted -->

			<var name="param1" expr="'string_set'"/>
			<var name="sid" expr="session.id"/>
			<createccxml next="'8_3_A_1034.ccxml'" parameters="param1 sid"/> <!-- parameters="param1 sid"/> -->
		</transition>
		
		<transition event="ccxml.created" state="ASSERTION_NMBR_779">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>

		<transition event="ccxml.exit" state="ASSERTION_NMBR_779">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>

		<transition event="user.START_ASSERTION_780" state="ASSERTION_NMBR_780">
			<conf:comment expr="'Event: ' + event$.name"/>
			<!--
780 	
8.3 Session Variables 	
Session variables are read-only to the running script and cannot be modified by the CCXML program. 	emily.candell@comverse.com 	Accepted 	

-->

			<assign name="session.id" expr="'Assign this to session.id'"/>
			<send targettype="'ccxml'" target="session.id" name="'user.780_failed'"/>
		</transition>

		<transition event="user.START_ASSERTION_781" state="ASSERTION_NMBR_781">
			<conf:comment expr="'Event: ' + event$.name"/>
<!--
	781 
	8_3_A	
	8.3 Session Variables 	
	New session variables cannot be declared by CCXML programs. 	emily.candell@comverse.com 	Accepted 
-->
			<var name="session.invalidname" expr="'cantbeassigned'"/>
			<send targettype="'ccxml'" target="session.id" name="'user.781_failed'"/>
		</transition>

		<transition event="error.semantic" state="ASSERTION_NMBR_780">
			<conf:comment expr="'Event: ' + event$.name"/>
			<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="error.semantic" state="ASSERTION_NMBR_781">
			<conf:comment expr="'Event: ' + event$.name"/>
			<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.780_failed" state="ASSERTION_NMBR_780">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>
				assertions[assert_index].P_F = s_FAIL;
				assertions[assert_index].reason = 'error.semantic should have been thrown.';
			</script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>

		<transition event="user.781_failed" state="ASSERTION_NMBR_781">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>
				assertions[assert_index].P_F = s_FAIL;
				assertions[assert_index].reason = 'error.semantic should have been thrown.';
			 </script>
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>

		<transition event="fetch.done" state="GEN">
			<conf:comment expr="'Event: ' + event$.name"/>
			<goto fetchid="event$.fetchid"/>
		</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/>
				<conf:uncond_exit expr="event$.reason"/>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			</if>
		</transition>
	</eventprocessor>
</ccxml>
