<?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-07-05
FIXED: 

ISSUE 703: 
1)-2) changed assertion 854
3) changed assertion 855

Release 1.2 - 2010-07-09
FIXED: Added var to hints on TA 98 (no specific ISSUE)

Release 1.3 - 2010-11-11
FIXED: ISSUE-735 Passed general_connid in createccxml 

Release 1.3 - 2010-12-15
FIXED: NO SPECIFIC ISSUE - Disambiguation of conference.joined event on ASSERTION_NMBR_855_IN_PROGRESS state: cond on id1 and id2 added
-->

	<conf:docsetup/>
	<var name="chld_reason"/>
	
	<!-- these connections stay active for the duration of the test -->
	<var name="general_connid"/>
	<var name="general_connid2"/>
	
	<var name="A83_connid1"/>
	<var name="A83_connid2"/>
	<var name="A83_joined_seen" expr="false"/>
	<var name="A84_connid"/>
	<var name="A85_confid1"/>
	<var name="A85_sessionid1"/>
	<var name="A85_session_one_got_event" expr="false"/>
	<var name="A85_session_two_got_event" expr="false"/>
	<var name="A93_first_join_seen" expr="false"/>
	<var name="A93_second_join_seen" expr="false"/>
	<var name="A93_first_unjoin_seen" expr="false"/>
	<var name="A93_second_unjoin_seen" expr="false"/>
	<var name="A98_joined_event_seen" expr="false"/>
	<var name="A98_unjoined_event_seen" expr="false"/>
	<var name="A854_confid1"/>
	<var name="A854_confid2"/>
	<var name="A855_dialogid1"/>
	<var name="A855_dialogid2"/>
	<var name="A855_connid1"/>
	<var name="A1269_confid1"/>
	<var name="A1269_confid2"/>
	<var name="A1269_connid1"/>
	<var name="A1269_event_counter" expr="0"/>
	<var name="A1269_part_one_timer"/>
	
	<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('83');
// assertions[i++] = init_assertion('84');
assertions[i++] = init_assertion('85');
assertions[i++] = init_assertion('87');
assertions[i++] = init_assertion('89');
assertions[i++] = init_assertion('90');
assertions[i++] = init_assertion('92');
assertions[i++] = init_assertion('93');
assertions[i++] = init_assertion('98');
assertions[i++] = init_assertion('854');
assertions[i++] = init_assertion('855');
assertions[i++] = init_assertion('1269');

add_2_assert_trace('82');
// add_2_assert_trace('86');
add_2_assert_trace('88');
add_2_assert_trace('91');
add_2_assert_trace('95');




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="general_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">
				<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_83" state="ASSERTION_NMBR_83">
<!--
83  	
10.5.7.1  	
The successful execution of <join> MUST result in the generation of a conference.joined event.  	
rachel.muller@aspect.com  	Accepted
-->
<!--
82  	
10.5.7.1  	
<join> instructs the implementation to bridge the connections specified using the id1 and id2 attributes in accordance with media options specified by the other attributes of <join>.  	
rachel.muller@aspect.com  	Accepted
-->
<!--
95  	
10.5.7.2  	
The default value of duplex is "full".  	
rachel.muller@aspect.com  	Accepted
-->
<!--
88  	
10.5.7.2  	
id1 returns a string that is the identifier of a Connection, Dialog or Conference.  	
rachel.muller@aspect.com  	Accepted
-->
<!--
91  	
10.5.7.2  	
id2 returns a string that is the identifier of a Connection, Dialog or Conference.  	
rachel.muller@aspect.com  	Accepted
-->

			<createcall dest="TEST_CREATECALL_DEST_ANSWER_AND_STAY_ACTIVE[0]" connectionid="A83_connid1"/>
		</transition>
		
		<transition event="connection.connected" state="ASSERTION_NMBR_83">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_83_IN_PROGRESS'"/>
			<createcall dest="TEST_CREATECALL_DEST_ANSWER_AND_STAY_ACTIVE[1]" connectionid="A83_connid2"/>
		</transition>
		
		<transition event="connection.connected" state="ASSERTION_NMBR_83_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_83_CALLS_MADE'"/>
			<join id1="'' + A83_connid1" id2="'' + A83_connid2"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_83_CALLS_MADE">
			<if cond="!A83_joined_seen">
				<assign name="A83_joined_seen" expr="'true'"/>
				<conf:comment expr="'Event: ' + event$.name"/>
				
				<script>assertions[assert_index].P_F = s_PASS;</script>
				
				<assign name="ASSERTION_NUM" expr="'82'"/>
				<var name="A82_passed" expr="false"/>
				<script>A82_passed = (session.connections[A83_connid1].input == A83_connid2 &amp;&amp;
                        session.connections[A83_connid2].input == A83_connid1 &amp;&amp;
                        session.connections[A83_connid1].outputs[0] == A83_connid2 &amp;&amp;
                        session.connections[A83_connid2].outputs[0] == A83_connid1);
            		</script>
				<if cond="A82_passed">
					<conf:pass/>
					<assign name="ASSERTION_NUM" expr="'95'"/>
					<conf:pass/>
				<else/>
					<conf:fail reason="'Join element did not bridge connections correctly.'"/>
					<assign name="ASSERTION_NUM" expr="'95'"/>
					<conf:fail reason="'Join element did not bridge connections correctly.'"/>
				</if>
				<assign name="ASSERTION_NUM" expr="'88'"/>
			<conf:pass/>
						<assign name="ASSERTION_NUM" expr="'91'"/>
			<conf:pass/>

				<assign name="current_state" expr="'ASSERTION_NMBR_83_TEARDOWN'"/> 
				<disconnect connectionid="A83_connid1"/>
			</if>
		</transition>
		
		<transition event="error.*" state="ASSERTION_NMBR_83_CALLS_MADE">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
                    assertions[assert_index].reason = 'encountered an error: ' + event$.name + ' : ' + event$.reason + '.' ;</script>
			<assign name="ASSERTION_NUM" expr="'82'"/>
			<conf:fail/>
			<assign name="ASSERTION_NUM" expr="'95'"/>
			<conf:fail/>
			<disconnect connectionid="A83_connid1"/>
		</transition>
		
		<transition event="conference.*" state="ASSERTION_NMBR_83_CALLS_MADE">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
                    assertions[assert_index].reason = 'encountered an event other than conference.joined : ' + event$.name + ' : ' + event$.reason + '.';</script>
			<assign name="ASSERTION_NUM" expr="'82'"/>
			<conf:not_exec reason="'Couldn't tell what &lt;join&gt; element was supposed to do...'"/>
			<disconnect connectionid="A83_connid1"/>
		</transition>
		
		<transition event="connection.disconnected" state="ASSERTION_NMBR_83_TEARDOWN">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_83_DISCONNECTING_CALLS'"/>
			<disconnect connectionid="A83_connid2"/>
		</transition>
		
		<transition event="connection.disconnected" state="ASSERTION_NMBR_83_DISCONNECTING_CALLS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		
		<transition event="user.START_ASSERTION_84" state="ASSERTION_NMBR_84">
			<conf:comment expr="'Event: ' + event$.name"/>
<!--
Taken away, may be rejected.
84  	
10.5.7.1  	
If for any reason the implementation is unable to create the bridge using the specified options it must fail with a error.conference.join event.  	
rachel.muller@aspect.com  	Accepted
-->
<!--
86  	
10.5.7.1  	
If the implementation is unable to join the objects an error.conference.join MUST only be sent to the session that issued the <join>.  	
rachel.muller@aspect.com  	Accepted
-->
			<createcall dest="TEST_CREATECALL_DEST_ANSWER_AND_STAY_ACTIVE[1]" connectionid="A84_connid"/>
		</transition>
		
		<transition event="connection.progressing" state="ASSERTION_NMBR_84">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="connection.connected" state="ASSERTION_NMBR_84">
			<conf:comment expr="'Event: ' + event$.name"/>
			<join id1="general_connid" id2="A84_connid"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_84">
			<conf:comment expr="'Event: ' + event$.name"/>		
			<assign name="current_state" expr="'ASSERTION_NMBR_84_SECOND'"/>
			<join id1="general_connid" id2="A84_connid"/>		
		</transition>		

		
		<transition event="error.conference.join" state="ASSERTION_NMBR_84_SECOND">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_PASS</script>
			<assign name="ASSERTION_NUM" expr="'86'"/>
			<conf:pass/>
			<assign name="current_state" expr="'ASSERTION_NMBR_84_THIRD'"/>
			<disconnect connectionid="A84_connid"/>
		</transition>
		
		
		<transition event="conference.joined" state="ASSERTION_NMBR_84_SECOND">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
                    assertions[assert_index].reason = 'error.conference.join should have been thrown.';</script>
			<assign name="ASSERTION_NUM" expr="'86'"/>
			<conf:fail/>
			<assign name="current_state" expr="'ASSERTION_NMBR_84_THIRD'"/>
			<disconnect connectionid="A84_connid"/>
		</transition>
		
		<transition event="connection.disconnected" state="ASSERTION_NMBR_84_THIRD">
			<conf:comment expr="'Event: ' + event$.name"/>		
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>		
		</transition>
		
		
		<transition event="user.START_ASSERTION_85" state="ASSERTION_NMBR_85">
		
<!--
85  	
10.5.7.1  	
When joining a Connection or Dialog to a Conference, or when joining two Conferences, the 'conference.joined' event MUST be posted to all sessions that are attached to the affected Conference(s).  	
rachel.muller@aspect.com  	Accepted
-->
			<assign name="A85_sessionid1" expr="session.id"/>
			<createconference conferenceid="A85_confid1"/>
		</transition>
		
		<transition event="conference.created" state="ASSERTION_NMBR_85">
			<conf:comment expr="'Event: ' + event$.name"/>
			
			<createccxml 
				next="'10_5_7_A_85.ccxml'" parameters="A85_sessionid1 A85_confid1"/>
			<send name="'user.checkA85'" targettype="'ccxml'" target="session.id" delay="'10s'"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_85">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="A85_session_one_got_event" expr="true"/>
		</transition>
		
		<transition event="user.session_two_joined_conference" state="ASSERTION_NMBR_85">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="A85_session_two_got_event" expr="true"/>
		</transition>
		
		<transition event="user.checkA85" state="ASSERTION_NMBR_85">
			<conf:comment expr="'Event: ' + event$.name"/>
			<if cond="A85_session_one_got_event &amp;&amp; A85_session_two_got_event">
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<else/>
				<script>assertions[assert_index].P_F = s_FAIL;
                        assertions[assert_index].reason = 'conference.join event was not thrown in both sessions that were connected to the conference.';</script>
			</if>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		
		<transition event="user.START_ASSERTION_87" state="ASSERTION_NMBR_87">
			<conf:comment expr="'Event: ' + event$.name"/>
<!--
87  	
10.5.7.2  	
<join> must have an id1 attribute.  	
rachel.muller@aspect.com  	Accepted
-->
			<!-- FIXED: ISSUE-735 Passed general_connid in createccxml -->
			<createccxml next="'10_5_7_A_87.ccxml'" parameters="general_connid"/>
		</transition>
		
		<transition event="error.createccxml" state="ASSERTION_NMBR_87">
			<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_87">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
                assertions[assert_index].reason = 'join tag needs to have an id1 attribute.';
            </script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		
		<transition event="user.START_ASSERTION_89" state="ASSERTION_NMBR_89">
<!--
89  	
10.5.7.2  	
If the id1 attribute value is invalid an error.semantic event will be thrown.  	
rachel.muller@aspect.com  	Accepted
-->

			<join id1="thisisinvalid" id2="general_connid"/>
		</transition>
		
		<transition event="error.semantic" state="ASSERTION_NMBR_89">
			<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="conference.joined" state="ASSERTION_NMBR_89">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
                    assertions[assert_index].reason = 'join tag succeeded with an invalid value for id1 attribute.';
            </script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		
		<transition event="user.START_ASSERTION_90" state="ASSERTION_NMBR_90">
				<conf:comment expr="'Event: ' + event$.name"/>
<!--
90  	
10.5.7.2  	
<join> must have an id2 attribute.  	
rachel.muller@aspect.com  	Accepted
-->
			<!-- FIXED: ISSUE-735 Passed general_connid in createccxml -->
			<createccxml next="'10_5_7_A_90.ccxml'" parameters="general_connid"/>
			
		</transition>
		
		<transition event="error.createccxml" state="ASSERTION_NMBR_90">
			<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_90">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
                assertions[assert_index].reason = 'join tag needs to have an id2 attribute.';
            </script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
				
		<transition event="user.START_ASSERTION_92" state="ASSERTION_NMBR_92">
<!--
92  	
10.5.7.2  	
If the id2 attribute value is invalid an error.semantic event will be thrown.  	
rachel.muller@aspect.com  	Accepted
-->

			<join id1="general_connid" id2="thisisinvalid"/>
		</transition>
				
		<transition event="error.semantic" state="ASSERTION_NMBR_92">
			<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="conference.joined" state="ASSERTION_NMBR_92">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
		            assertions[assert_index].reason = 'join tag succeeded with an invalid value for id1 attribute.';
		    </script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>		
		
		<transition event="user.START_ASSERTION_93" state="ASSERTION_NMBR_93">
<!--
93  	
10.5.7.2  	
<join> may have a duplex attribute. This is an ECMAScript expression that returns a character string equal to "half" or "full" which defines the direction of the media flow between id1 resource and id2 resource.  	
rachel.muller@aspect.com  	Accepted
-->			
			<createcall dest="TEST_CREATECALL_DEST_ANSWER_AND_STAY_ACTIVE[2]" connectionid="general_connid2"/>
		</transition>
			
		<transition event="connection.connected" state="ASSERTION_NMBR_93">
			<conf:comment expr="'Event: ' + event$.name"/>
			<join id1="general_connid" id2="general_connid2" duplex="'full'"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_93">
			<if cond="!A93_first_join_seen">
				<assign name="A93_first_join_seen" expr="true"/>
				<conf:comment expr="'Event: ' + event$.name"/>
				<var name="A93_duplex_full_passed"/>
				<script>
					A93_duplex_full_passed = (session.connections[general_connid].input == general_connid2 &amp;&amp;
	                        session.connections[general_connid2].input == general_connid &amp;&amp;
	                        session.connections[general_connid].outputs[0] == general_connid2 &amp;&amp;
	                        session.connections[general_connid2].outputs[0] == general_connid);
				</script>
				<if cond="!A93_duplex_full_passed">
					<script>
						assertions[assert_index].P_F = s_FAIL;
						assertions[assert_index].reason = 'join tag with full duplex did not handle inputs and outputs correctly.';
					</script>				
					<assign name="current_state" expr="'ASSERTION_NMBR_93_FAILED'"/>
				</if>
				<unjoin id1="general_connid" id2="general_connid2"/>
			</if>
		</transition>
		
		<transition event="conference.unjoined" state="ASSERTION_NMBR_93_FAILED">
			<if cond="!A93_first_unjoin_seen">
				<assign name="A93_first_unjoin_seen" expr="true"/>
				<conf:comment expr="'Event: ' + event$.name"/>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new" delay="'2s'"/>
			</if>
		</transition>
		
		<transition event="conference.unjoined" state="ASSERTION_NMBR_93">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_93_IN_PROGRESS'"/>
			<join id1="general_connid" id2="general_connid2" duplex="'half'"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_93_IN_PROGRESS">
			<if cond="!A93_second_join_seen">
				<assign name="A93_second_join_seen" expr="true"/>
				<conf:comment expr="'Event: ' + event$.name"/>
				<var name="A93_duplex_half_passed"/>
			
				<script>
					A93_duplex_half_passed = (session.connections[general_connid].input == general_connid2 &amp;&amp;
	                        session.connections[general_connid2].input == undefined &amp;&amp;
	                        session.connections[general_connid].outputs.length == 0 &amp;&amp;
	                        session.connections[general_connid2].outputs[0] == general_connid);
				</script>
			
				<if cond="A93_duplex_half_passed">
						<script>assertions[assert_index].P_F = s_PASS;</script>
				<else/>
						<script>assertions[assert_index].P_F = s_FAIL;
						assertions[assert_index].reason = 'join tag with half duplex did not handle inputs and outputs correctly.';
						</script>
				</if>
				<unjoin id1="general_connid" id2="general_connid2"/>
			</if>
		</transition>
		
		<transition event="conference.unjoined" state="ASSERTION_NMBR_93_IN_PROGRESS">
			<if cond="!A93_second_unjoin_seen">
				<assign name="A93_second_unjoin_seen" expr="true"/>
				<conf:comment expr="'Event: ' + event$.name"/>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new" delay="'2s'"/>
			</if>
		</transition>
		
		<transition event="user.START_ASSERTION_98" state="ASSERTION_NMBR_98">
<!--
98  	
10.5.7.2  	
<join> may have a hints attribute which is an ECMAScript object containing information which may be used by the implementing platform or passed to the network when the two specified Connections, Dialogs or Conferences (id1 and id2) are joined.  	
rachel.muller@aspect.com  	Accepted
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<!-- FIXED: added "var" to hints -->
			<script>var hints = new Object();
					hints.string = "thisIsAString"
					hints.string2 = "this may or may not be ignored";
					hints.number = 42;</script>
			<join id1="general_connid" id2="general_connid2" hints="hints"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_98">
			<if cond="!A98_joined_event_seen">
				<assign name="A98_joined_event_seen" expr="true"/>
				<conf:comment expr="'Event: ' + event$.name"/>
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<assign name="current_state" expr="'ASSERTION_NMBR_98_TEARDOWN'"/>
				<unjoin id1="general_connid" id2="general_connid2"/>
			</if>
		</transition>
		
		<transition event="error.*" state="ASSERTION_NMBR_98">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
					assertions[assert_index].reason = 'got an error: ' + event$.name + ' : ' + event$.reason;</script>
			<assign name="current_state" expr="'ASSERTION_NMBR_98_TEARDOWN'"/>
			<unjoin id1="general_connid" id2="general_connid2"/>
		</transition>
		
		<transition event="conference.unjoined" state="ASSERTION_NMBR_98_TEARDOWN">
			<if cond="!A98_unjoined_event_seen">
				<assign name="A98_unjoined_event_seen" expr="true"/> 
				<conf:comment expr="'Event: ' + event$.name"/>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			</if>
		</transition>
		
		<transition event="user.START_ASSERTION_854" state="ASSERTION_NMBR_854">
<!--
854  	
10.5.7.1  	
<join> instructs the implementation to bridge the conferences specified using the id1 and id2 attributes in accordance with media options specified by the other attributes of <join>.  	
rachel.muller@aspect.com  	Accepted
-->
			<createconference conferenceid="A854_confid1" confname="'one'"/>
		</transition>
		
		<transition event="conference.created" state="ASSERTION_NMBR_854">
			<conf:comment expr="'Event: ' + event$.name"/>
			<join id1="general_connid" id2="A854_confid1"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_854">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_854_IN_PROGRESS'"/>
			<createconference conferenceid="A854_confid2" confname="'two'"/>
		</transition>
		
		<transition event="conference.created" state="ASSERTION_NMBR_854_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<join id1="A854_confid1" id2="A854_confid2"/>
		</transition>
		
		
		
		<transition event="conference.joined" state="ASSERTION_NMBR_854_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<!-- FIXED ISSUE-703 1) and 2): changed cond -->
			<if cond="session.conferences[A854_confid1].bridges[A854_confid2] != undefined &amp;&amp; session.conferences[A854_confid2].bridges[A854_confid1] != undefined">
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<else/>
				<script>assertions[assert_index].P_F = s_FAIL;
                        assertions[assert_index].reason = 'Join tag did not bridge conference objects correctly.';</script>
			</if>
			<assign name="current_state" expr="'ASSERTION_NMBR_854_TEARDOWN'"/>
			<unjoin id1="general_connid" id2="A854_confid1"/>
		</transition>
		
		<transition event="error.*" state="ASSERTION_NMBR_854_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;
					assertions[assert_index].reason = 'Got an error: ' + event$.name + ' : ' + event$.reason + '.';</script>
			<assign name="current_state" expr="'ASSERTION_NMBR_854_TEARDOWN'"/>
			<unjoin id1="general_connid" id2="A854_confid1"/>
		</transition>
		
		<transition event="conference.unjoined" state="ASSERTION_NMBR_854_TEARDOWN">
			<conf:comment expr="'Event: ' + event$.name"/>
			<destroyconference conferenceid="A854_confid1"/>
		</transition>
		
		<transition event="conference.destroyed" state="ASSERTION_NMBR_854_TEARDOWN">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_854_DESTROYING_CONFERENCES'"/>
			<destroyconference conferenceid="A854_confid2"/>
		</transition>
		
		<transition event="conference.destroyed" state="ASSERTION_NMBR_854_DESTROYING_CONFERENCES">
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		
		<transition event="user.START_ASSERTION_855" state="ASSERTION_NMBR_855">
<!--
855  	
10.5.7.1  	
<join> instructs the implementation to bridge the dialogs specified using the id1 and id2 attributes in accordance with media options specified by the other attributes of <join>.  	
rachel.muller@aspect.com  	Accepted            
-->
			<conf:comment expr="'Event: ' + event$.name"/>
			<dialogstart dialogid="A855_dialogid1" connectionid="general_connid" src="'dialog.vxml'"/>
		</transition>
		
		<transition event="dialog.started" state="ASSERTION_NMBR_855">
			<conf:comment expr="'Event: ' + event$.name"/>
			<createcall dest="TEST_CREATECALL_DEST_ANSWER_AND_STAY_ACTIVE[0]" connectionid="A855_connid1"/>
		</transition>
		
		<transition event="connection.connected" state="ASSERTION_NMBR_855">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_855_IN_PROGRESS'"/>
			<dialogstart dialogid="A855_dialogid2" connectionid="A855_connid1" src="'dialog.vxml'"/>
		</transition>
		
		<transition event="dialog.started" state="ASSERTION_NMBR_855_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<join id1="A855_dialogid1" id2="A855_dialogid2"/>
		</transition>
		
	<!--
	FIXED: NO SPECIFIC ISSUE - Disambiguation of conference.joined event on ASSERTION_NMBR_855_IN_PROGRESS state: cond on id1 and id2 added
	-->
		<transition event="conference.joined" state="ASSERTION_NMBR_855_IN_PROGRESS" cond="event$.id1==A855_dialogid1 &amp;&amp; event$.id2==A855_dialogid2">
			<conf:comment expr="'Event: ' + event$.name"/>
			<var name="A855_passed" expr="false"/>
			
			<!-- FIXED ISSUE-703 3): changed checks on input and outputs -->			
			<script><![CDATA[
				function outputpresent( haystack, needle, numElements)
				{
					var rc = false;
					for(i=0; i < numElements; i++)
					{
						if( haystack[i] == needle )
						{
							rc = true;
							break;
						}
					}
					return rc;
				}
					
				A855_passed = false;
				if (session.dialogs[A855_dialogid1].outputs.length == 2 && session.dialogs[A855_dialogid2].outputs.length == 2)
				{
					if( session.dialogs[A855_dialogid1].input == A855_dialogid2 && session.dialogs[A855_dialogid2].input == A855_dialogid1 )
					{
						if(outputpresent( session.dialogs[A855_dialogid1].outputs, general_connid, 2 ))
						{
							if(outputpresent( session.dialogs[A855_dialogid1].outputs, A855_dialogid2, 2 ))
							{
								if( outputpresent( session.dialogs[A855_dialogid2].outputs, A855_connid1, 2 ))
								{
									if(outputpresent( session.dialogs[A855_dialogid2].outputs, A855_dialogid1, 2 ))
										A855_passed = true;
									
								}
							}
						}
					}
				}
				]]></script>
				
			
			<if cond="A855_passed">
                <script>assertions[assert_index].P_F = s_PASS;</script>
            <else/>
        		<script>assertions[assert_index].P_F = s_FAIL;
                assertions[assert_index].reason = 'Join tag did not bridge dialogs correctly.';</script>
            </if>
			<dialogterminate dialogid="A855_dialogid1"/>
		</transition>
		
<!--
	In section 10.5.7.1, the w3c spec makes the provision: "Implementations MAY disallow two dialogs from being joined together. If both id1 and id2 specify dialogs and the platform does not support joining together two dialogs, then an error.conference.join event is thrown." If that provision is ever removed, remove this next transition.
-->
		<transition event="error.conference.join" state="ASSERTION_NMBR_855_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<dialogterminate dialogid="A855_dialogid1"/>
		</transition>
		
		<transition event="error.semantic" state="ASSERTION_NMBR_855_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<dialogterminate dialogid="A855_dialogid1"/>
		</transition>
		
		<transition event="dialog.exit" state="ASSERTION_NMBR_855_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_855_TERMINATING_DIALOGS'"/>
			<dialogterminate dialogid="A855_dialogid2"/>
		</transition>
		
		<transition event="dialog.exit" state="ASSERTION_NMBR_855_TERMINATING_DIALOGS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<disconnect connectionid="A855_connid1"/>
		</transition>
		
		<transition event="connection.disconnected" state="ASSERTION_NMBR_855_TERMINATING_DIALOGS">
			<conf:comment expr="'Event: ' + event$.name"/>
<!--
962
10.5.7.1  	
Any Connections or Dialogs referenced by the 'id1' and 'id2' attributes of <join> MUST be owned by the session performing the <join>.  	
rachel.muller@aspect.com  	Accepted 
-->
			<var name="sessionOneConnID" expr="general_connid"/>
			<createccxml next="'10_5_7_A_962.ccxml'" parameters="sessionOneConnID"/> 
		</transition>
		
		<transition event="ccxml.exit" state="ASSERTION_NMBR_855_TERMINATING_DIALOGS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		
		<transition event="user.START_ASSERTION_1269" state="ASSERTION_NMBR_1269">
<!--
	1269  	
	10.5.7.1  	
	When joining a Connection or Dialog to a Conference, or when joining two Conferences, the 'conference.joined' event MUST NOT result in multiple 'conference.joined' events if the session performing the <join> is attached to the conference, nor if any session owns both conferences when two conferences are joined together.  	
	Brandon.Emerson@intervoice.com  	Accepted	
-->
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<createconference conferenceid="A1269_confid1" confname="'three'"/>	
			</transition>
		
		<transition event="conference.created" state="ASSERTION_NMBR_1269">
			<conf:comment expr="'Event: ' + event$.name"/>
			<join id1="general_connid" id2="A1269_confid1"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_1269">
			<conf:comment expr="'Event: ' + event$.name"/>
			<createcall dest="TEST_CREATECALL_DEST_ANSWER_AND_STAY_ACTIVE[0]" connectionid="A1269_connid1"/>
		</transition>
		
		<transition event="connection.connected" state="ASSERTION_NMBR_1269">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_1269_PART_ONE'"/>
			<join id1="A1269_connid1" id2="A1269_confid1"/>
			<send targettype="'ccxml'" target="session.id" name="'user.START_ASSERTION_1269_PART_TWO'" delay="'5s'"
				sendid="A1269_part_one_timer"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_1269_PART_ONE">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>A1269_event_counter++;</script>
		</transition>
		
		<transition event="user.START_ASSERTION_1269_PART_TWO" state="ASSERTION_NMBR_1269_PART_ONE">
			<conf:comment expr="'Event: ' + event$.name"/>
			
			<assign name="current_state" expr="'ASSERTION_NMBR_1269_PART_TWO'"/>
			
			<if cond="A1269_event_counter == 1">
				<assign name="A1269_event_counter" expr="0"/>
				<createconference conferenceid="A1269_confid2"/>
			<else/>
				<script>assertions[assert_index].P_F = s_FAIL;</script>
			
				<if cond="A1269_event_counter >= 2">
					<script>assertions[assert_index].reason = 'multiple conference.joined events were sent to a session when a connection was joined to a conference that the session was a member of.';</script>
				</if>
				
				<if cond="A1269_event_counter == 0">
					<script>assertions[assert_index].reason = 'no conference.joined events were sent to a session when a connection was joined to a conference that the session was a member of.';</script>
				</if>	
				
				<send targettype="'ccxml'" target="session.id" name="'user.TEARDOWN_ASSERTION_1269'"/>
			</if>
		</transition>
		
		<transition event="conference.created" state="ASSERTION_NMBR_1269_PART_TWO">
			<conf:comment expr="'Event: ' + event$.name"/>
			<join id1="A1269_confid1" id2="A1269_confid2"/>
			<send targettype="'ccxml'" target="session.id" name="'user.TEARDOWN_ASSERTION_1269'"
			 delay="'3s'"/>
		</transition>
		
		<transition event="conference.joined" state="ASSERTION_NMBR_1269_PART_TWO">
			<conf:comment expr="'Event: ' + event$.name"/>
			<script>A1269_event_counter++;</script>
		</transition>
		
		<transition event="user.TEARDOWN_ASSERTION_1269" state="ASSERTION_NMBR_1269_PART_TWO">
			<conf:comment expr="'Event: ' + event$.name"/>
			
			<if cond="A1269_event_counter >= 2">
				<script>assertions[assert_index].P_F = s_FAIL;
						assertions[assert_index].reason = 'multiple conference.joined events were sent to a session when a session joined together two conferences, both of which it owned.';</script>
			</if>
			
			<if cond="A1269_event_counter == 0">
				<script>assertions[assert_index].P_F = s_FAIL;
						assertions[assert_index].reason = 'no conference.joined events were sent to a session when a session joined together two conferences, both of which it owned.';</script>
			</if>
			
			<disconnect connectionid="A1269_connid1"/>
		</transition>
		
		<transition event="connection.disconnected" state="ASSERTION_NMBR_1269_PART_TWO">
			<conf:comment expr="'Event: ' + event$.name"/>
			<destroyconference conferenceid="A1269_confid1"/>
		</transition>
		
		<transition event="conference.destroyed" state="ASSERTION_NMBR_1269_PART_TWO">
			<conf:comment expr="'Event: ' + event$.name"/>
			<assign name="current_state" expr="'ASSERTION_NMBR_1269_TEARDOWN_IN_PROGRESS'"/>
			<destroyconference conferenceid="A1269_confid2"/>
		</transition>
		
		<transition event="conference.destroyed" state="ASSERTION_NMBR_1269_TEARDOWN_IN_PROGRESS">
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>	
		
<!-- ***************** General Handlers ***************** -->
		<transition event="connection.progressing">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="connection.disconnected">
			<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="dialog.exit">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="conference.created">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="conference.destroyed">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="conference.joined">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="conference.unjoined">
			<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">
		</transition>
		
		<transition event="cancel.successful">
			<conf:comment expr="'Event: ' + event$.name"/>
		</transition>
		
		<transition event="*">
			<assign name="t_ASSERT_REASON" expr="'UNEXPECTED EVENT ' + event$.name + ' IN STATE ' + current_state"/>
			<conf:comment expr="t_ASSERT_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>
