<?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">
<!--
Release 1.1 - 2010-06-09
FIXED: 
ISSUE-696 #1 , TA 1033; 
ISSUE-696 #2 , TA 1033; 
ISSUE-686, TA  1033.
-->
	<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="fid"/>
	<var name="WKR_STRING"/>
	<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('792');
assertions[i++] = init_assertion('1033');

add_2_assert_trace('787');
add_2_assert_trace('793');
add_2_assert_trace('1175');

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="cid1"/>
	<var name="cid2"/>
	<var name="confObj1"/>
	<var name="confObj2"/>		
	<var name="dID"/>
	<var name="connid"/>
	<assign name="application.sessid1" expr="session.id"/>
		<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">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="connid" 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">
				<fetch next="'redirect.ircgi'"/>
				<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_792" state="ASSERTION_NMBR_792">
			<conf:comment expr="'Event: ' + event$.name"/>
			<!--
792 	
8.3 
Session Variables 	
session.conferences is an associative array which contains a list of Conference objects with which the session is attached using 
<createconference> 	emily.candell@comverse.com 	Accepted 	
-->
			<createconference conferenceid="cid1" confname="'one'"/>
			<createconference conferenceid="cid2" confname="'two'"/>			
		</transition>

		<transition event="conference.created" state="ASSERTION_NMBR_792">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_792_IN_PROGRESS'"/>
		</transition>
		
		<transition event="conference.created" state="ASSERTION_NMBR_792_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>

			<if cond="session.conferences[cid1].conferencename =='one' &amp;&amp; session.conferences[cid2].conferencename=='two'">
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<else/>
			<script>
			assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Objects in session.conferences do not represent proper conference objects; ' +
				'first object has name ' + session.conferences[cid1].conferencename + ', second object has name ' +
				session.conferences[cid2].conferencename + '; names should be one and two, respectively.';
			 </script>
			</if>
			
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>		
		</transition>
		
		<transition event="error.semantic" state="ASSERTION_NMBR_792_IN_PROGRESS">
			<script>
			assertions[assert_index].P_F = s_FAIL;
			assertions[assert_index].reason = 'Session object has not been populated with the appropriate ' +
				'conference objects for conference ids ' + cid1 + ' and ' + cid2 + '.';
			 </script>
			 	
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>

		<transition event="user.START_ASSERTION_1033" state="ASSERTION_NMBR_1033">
<!-- 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 -->

			<if cond="typeof(session.ioprocessors['basichttp']) == 'string' &amp;&amp; typeof(session.ioprocessors['createsession']) == 'string'">
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<else/>
				<!-- FIXED ISSUE-686: typeof(session.ioprocessors['ccxml']) replaced by typeof(session.ioprocessors['createsession']) in script -->

				<script>
				assertions[assert_index].P_F = s_FAIL;
				assertions[assert_index].reason = 'Objects in session.ioprocessors are improperly typed;' +
				'first object has type ' + typeof(session.ioprocessors['basichttp']) + ', second object has type ' +
				typeof(session.ioprocessors['createsession']) + '; both should be of type string.';
				 </script>
			</if>		
<!--
787 	
8.3 
Session Variables 	
session.id is a globally unique string that indicates the session identifier of the executing CCXML session. 	emily.candell@comverse.com 	
-->
			<assign name="ASSERTION_NUM" expr="'787'"/>
			<createccxml next="'8_3_B_787.ccxml'"/>
			
			
<!--
793 	
8.3 Session Variables 	
session.dialogs is an associative Array which contains a list of the Dialog objects that the session is currently using. 
The array is associative and each key in the array is the dialog identifier for the Dialog. 	emily.candell@comverse.com 	Accepted 	
-->

			<assign name="ASSERTION_NUM" expr="'793'"/>

			<!-- When using Prophecy, this will not work unless Prophecy's VoiceXML browser is running. -->
			<dialogstart src="'dialog.vxml'" type="'application/voicexml+xml'" 
				dialogid="dID" connectionid="connid"/>
		</transition>
		
		<transition event="dialog.started" state="ASSERTION_NMBR_1033">
			<!-- FIXED ISSUE-696, #1:  wrong regular expression replaced by another one -->
			<if cond=" session.dialogs[dID].src.search(/dialog.vxml/) &gt; -1 ">
				<conf:pass/>
			<else/>
				<assign name="chld_reason" expr="'Dialog object was not instantiated correctly: source for dialog [' +
					dID + '] was ' + session.dialogs[dID].src + '; should have been ' +
					'dialog.vxml;'"/>
					<conf:fail reason="chld_reason"/>
			</if>
			
			<dialogterminate dialogid="dID"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		
		<!-- FIXED ISSUE-696, #2:  conference.unjoined added -->
		<transition event="conference.unjoined">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>		
		
		
		<transition event="ccxml.created">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>

		<transition event="ccxml.exit">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="fetch.done">
			<conf:comment expr="'Event: ' + event$.name"/>
			<goto fetchid="event$.fetchid"/>
		</transition>

		<transition event="error.fetch">
			<conf:comment expr="'Event: ' + event$.name"/>
			<conf:comment expr="'Reason: ' + event$.reason"/>
			<conf:uncond_exit/>
		</transition>
		
		<transition event="dialog.exit">
			<conf:comment expr="'Event: ' + event$.name"/>
		</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"/>
			<conf:comment expr="'Reason: ' + event$.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>
	</eventprocessor>
</ccxml>