#!/bin/sh
# This regression test is a part of SIPp.
# A WAV file with a header and no audio plays nothing: its play looped
# forever in the playback thread, and sipp hung at exit waiting for it.
. "`dirname "$0"`/../functions"; init

# RIFF, WAVE, a 16-byte fmt chunk of 8 kHz mono PCMU, and a data chunk
# of no bytes.
printf 'RIFF\044\000\000\000WAVEfmt \020\000\000\000\007\000\001\000\100\037\000\000\100\037\000\000\001\000\010\000data\000\000\000\000' >empty.wav
sippbg -sf uas.xml -i 127.0.0.1 -p 31900 -m 1 \
    -min_rtp_port 32000 -max_rtp_port 32099
timeout -sKILL 20 "`get_sipp`" -nostdin -sf uac.xml -i 127.0.0.1 \
    -p 31901 -m 1 -min_rtp_port 32100 -max_rtp_port 32199 \
    127.0.0.1:31900 -timeout 10 -timeout_error >/dev/null 2>&1
status=$?
rm -f empty.wav

if test $status -ne 0; then
    fail "UAC exited with $status"
else
    ok
fi
