<?xml version="1.0"?>
<!DOCTYPE fax-tests SYSTEM "./fax-tests.dtd">
<fax-tests>
<config>
    <path type="IMAGE" value="../test-data/etsi/fax"/>
</config>
<messages>
    <!-- TCF = 2700 bytes at 14400, 2250 at 12000, 1800 at 9600, 1350 at 7200, 900 at 4800 or 450 at 2400 -->
    <!-- Bad TCF == 10101010.... -->
    <!-- slow HDLC preamble == 37 flag bytes -->
    <!-- slow HDLC inter-frame flag sequence == 1 flag byte -->
    <!-- slow HDLC end flag sequence == 5 flag bytes -->
    <!-- synchronisation sequence == 250ms of zeros. = 450 bytes at 14400, 375 at 12000, 300 at 9600, 225 at 7200, 150 at 4800 or 75 at 2400 -->
    <!-- fast HDLC inter-frame flag sequence == 1 flag byte -->
    <!-- fast HDLC end flag sequence == 10 flag bytes -->
    <!-- STAIRSTEP image is 1728x1728 pixels. Its is about 15k, so an average of 68.2 bits per row. To
         cook it as a 31k page requires a min_bits of 141. To cook it as a 63k page requires a min_bits of
         286. To cook it as a 64k page requires a min_bits of 291 -->
</messages>
<test-group name="Supplementary">
    <test name="PPS-MPS-lost-PPS">
        <!-- Tester calls DUT and sends one 31k byte STAIRSTEP page and one 15k byte STAIRSTEP page. -->
        <step type="CALL"/>

        <!--<step dir="T" type="CNG"/>-->

        <step dir="R" type="CED"/>
        <step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 1F 30"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="TCF" modem="V.27ter/4800" value="900"/>

        <step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" min_bits="141"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-NULL" value="FF C8 7D 00 00 00 08"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <!-- Repeat the last chunk, as though we missed the MCF -->
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_white.tif"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 80 00 08"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/>
        <step dir="T" type="POSTAMBLE"/>
        <step dir="T" type="CLEAR"/>
        <step dir="R" type="CLEAR" timein="0" timeout="100"/>
        <step type="STATUS" value="RX_DCNDATA"/>
    </test>
    <test name="V17-12000-V29-9600">
        <!-- Tester calls, trying to provoke a crash seen in some versions of spandsp, when
             an initial renegotiation to lower speed occurs for an ECM FAX -->
        <step type="CALL"/>

        <!--<step dir="T" type="CNG"/>-->

        <step dir="R" type="CED"/>
        <step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 54 1F 20"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="TCF" modem="V.17/12000" value="2250"/>

        <step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 60 1F 20"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="TCF" modem="V.29/9600" value="1800"/>

        <step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.29/9600"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" min_bits="141"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-NULL" value="FF C8 7D 00 00 00 08"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.29/9600"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
        <step dir="T" type="POSTAMBLE"/>

        <possible-step>
            <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
            <step dir="R" type="SILENCE"/>

            <step type="WAIT" value="75"/>
            <step dir="T" type="PREAMBLE" modem="V.21"/>
            <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
            <step dir="T" type="POSTAMBLE"/>
        </possible-step>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.29/9600"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_white.tif" frame_size="64"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 80 00 10"/>
        <step dir="T" type="POSTAMBLE"/>

        <possible-step>
            <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
            <step dir="R" type="SILENCE"/>

            <step type="WAIT" value="75"/>
            <step dir="T" type="PREAMBLE" modem="V.21"/>
            <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
            <step dir="T" type="POSTAMBLE"/>
        </possible-step>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/>
        <step dir="T" type="POSTAMBLE"/>
        <step dir="T" type="CLEAR"/>
        <step dir="R" type="CLEAR" timein="0" timeout="100"/>
        <step type="STATUS" value="OK"/>
    </test>
    <test name="Phase-D-collision">
        <!-- DUT calls tester and sends 1 IMPRESS and 1 WHITE page. The MCF after the first
             page is delayed enough to cause a collision with a retry of the MPS from the DUT. -->
        <step type="ANSWER" value="etsi_300_242_a4_impress_white.tif"/>
        <step dir="T" type="SET" tag="IDENT" value="+0123456789"/>

        <step dir="R" type="CNG"/>

        <step dir="T" type="CED"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DIS" value="FF C8 01 00 50 00"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="TSI+" value="FF C0 C2 9C 1C EC 6C AC 2C CC 4C 8C 0C D4 04 04 04 04 04 04 04 04 04 ..."/>
        <step dir="R" type="HDLC" tag="DCS+" value="FF C8 C1 ..."/>
        <step dir="R" type="TCF" modem="V.27ter/4800" timeout="60000"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="CFR" value="FF C8 21"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="MSG" modem="V.27ter/4800" timeout="180000"/>
        <step dir="R" type="HDLC" modem="V.21" tag="MPS+" value="FF C8 F2"/>

        <step type="WAIT" value="3500"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="MSG" modem="V.27ter/4800"  timeout="60000"/>
        <step dir="R" type="HDLC" modem="V.21" tag="EOP+" value="FF C8 F4"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="DCN+" value="FF C8 DF"/>
        <step dir="R" type="CLEAR" timein="800" timeout="1200"/>
        <step type="STATUS" value="OK"/>
    </test>
    <test name="Modem-change-at-CTC">
        <!-- Similar test to TSB85/OREN03, but there is a modem change at the CTC -->
        <!-- Tester calls DUT and sends one 15k byte STAIRSTEP page. -->
        <step type="CALL"/>

        <!--<step dir="T" type="CNG"/>-->

        <step dir="R" type="CED"/>
        <step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 60 1F 20"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="TCF" modem="V.29/9600" value="1800"/>

        <step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.29/9600"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
        <step dir="T" type="POSTAMBLE"/>

        <possible-step>
            <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
            <step dir="R" type="SILENCE"/>

            <step type="WAIT" value="75"/>
            <step dir="T" type="PREAMBLE" modem="V.21"/>
            <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
            <step dir="T" type="POSTAMBLE"/>
        </possible-step>

        <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.29/9600"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
        <step dir="T" type="POSTAMBLE"/>

        <possible-step>
            <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
            <step dir="R" type="SILENCE"/>

            <step type="WAIT" value="75"/>
            <step dir="T" type="PREAMBLE" modem="V.21"/>
            <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
            <step dir="T" type="POSTAMBLE"/>
        </possible-step>

        <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.29/9600"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
        <step dir="T" type="POSTAMBLE"/>

        <possible-step>
            <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
            <step dir="R" type="SILENCE"/>

            <step type="WAIT" value="75"/>
            <step dir="T" type="PREAMBLE" modem="V.21"/>
            <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
            <step dir="T" type="POSTAMBLE"/>
        </possible-step>

        <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.29/9600"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
        <step dir="T" type="POSTAMBLE"/>

        <possible-step>
            <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
            <step dir="R" type="SILENCE"/>

            <step type="WAIT" value="75"/>
            <step dir="T" type="PREAMBLE" modem="V.21"/>
            <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
            <step dir="T" type="POSTAMBLE"/>
        </possible-step>

        <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="CTC + V.27ter/4800" value="FF C8 48 00 10"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="R" type="HDLC" modem="V.21" tag="CTR" value="FF C8 23"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64"/>
        <step dir="T" type="POSTAMBLE"/>
        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 6B"/>
        <step dir="T" type="POSTAMBLE"/>

        <possible-step>
            <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
            <step dir="R" type="SILENCE"/>

            <step type="WAIT" value="75"/>
            <step dir="T" type="PREAMBLE" modem="V.21"/>
            <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
            <step dir="T" type="POSTAMBLE"/>
        </possible-step>

        <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
        <step dir="R" type="SILENCE"/>

        <step type="WAIT" value="75"/>
        <step dir="T" type="PREAMBLE" modem="V.21"/>
        <step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/>
        <step dir="T" type="POSTAMBLE"/>

        <step dir="T" type="CLEAR"/>
        <step dir="R" type="CLEAR" timein="0" timeout="100"/>
        <step type="STATUS" value="OK"/>
    </test>
</test-group>
</fax-tests>
