<?xml version="1.0" encoding="UTF-8"?>
	<!--
    Test: 10.2 276, 277
    require 'ALERTING'
	-->
	
<ccxml xmlns="http://www.w3.org/2002/09/ccxml" xmlns:conf="http://www.w3.org/2005/ccxml-conformance" version="1.0">

   <conf:docsetup/>
   <var name="ConnectionID" expr="undefined"/>

  <var name="TEST_CREATECALL_DEST_ANSWER_AND_JOIN" expr="'18005551011'"/>
  <var name="OutboundID"/>
  
  <script>
<![CDATA[
		var i=0;
		assertions[i++] = init_assertion('276');

		
		var assert_last = i - 1;
		var assert_index = -1;

		// Children of 276
		add_2_assert_trace('277');
		
		s_ASSERTIONS_LEFT = show_remained_assertions();
		var b_in_test = false;
	
]]> 
</script>
    
  <eventprocessor statevariable="current_state">
    <conf:setup type="connected"/>
		<transition event="connection.connected" state="init">
			<assign name="ConnectionID" 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>assertions[assert_index].reason = t_ASSERT_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"/>
			</if>
		</transition>

	<transition event="user.START_ASSERTION_276" state="ASSERTION_NMBR_276">
		<!--
276 	
10.2 &lt;assign&gt; and &lt;var&gt; 	
Each Connection has one input by which it receives a media stream from another Connection or Conference.	rachel.muller@aspect.com 	Accepted 
-->
		<log label="s_TA+ASSERTION_NUM" expr="'Comment: '+ 'Current state : ' + current_state + ' , Event: ' + event$.name"/>	
		<createcall dest="TEST_CREATECALL_DEST_ANSWER_AND_STAY_ACTIVE[1]"/>
	</transition>

	<transition state="ASSERTION_NMBR_276" event="connection.progressing">
	</transition>

	<transition state="ASSERTION_NMBR_276" event="connection.connected">
		<log label="s_TA+ASSERTION_NUM" expr="'Comment: '+ 'Current state : ' + current_state + ' , Event: ' + event$.name"/>
		<assign name="OutboundID" expr="event$.connectionid"/>
      		<join id1="OutboundID" id2="ConnectionID" duplex="'full'"/>
	</transition>

	
	<transition state="ASSERTION_NMBR_276" event="conference.joined">
		<script>assertions[assert_index].P_F = s_PASS;</script>
		<!-- Child management -->
		<assign name="ASSERTION_NUM" expr="'277'"/>
		<!--
277 	
10.2 &lt;assign&gt; and &lt;var&gt; 	
Each Connection has one output media stream that can be directed to the inputs of multiple Connections and/or Conferences.	rachel.muller@aspect.com 	Accepted -->
		<conf:pass/>
		<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
	</transition>

	<!--  ***************** COMMON ******************************** -->

	<transition event="send.successful">
	</transition>
	
	<transition event="connection.disconnected">
			<conf:uncond_exit expr="'CONNECTION-DISCONNECTED'"/>
		</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>
	
  </eventprocessor>
</ccxml>
