#!/bin/sh
# This regression test is a part of SIPp.
# -message_overwrite false without -message_file appends to the log of
# the default name, rather than to one with no name, which failed.
. "`dirname "$0"`/../functions"; init

rm -f uac_*_messages.log
sippbg -sn uas -i 127.0.0.1 -p 26530 -m 1 -timeout 10
sippfg -sn uac -i 127.0.0.1 -p 26531 -m 1 127.0.0.1:26530 \
    -trace_msg -message_overwrite false -timeout 8 -timeout_error \
    >/dev/null 2>&1
status=$?
invites=`cat uac_*_messages.log 2>/dev/null | grep -c '^INVITE'`
rm -f uac_*_messages.log

if test $status -ne 0; then
    fail "UAC failed with $status"
elif test "${invites:-0}" -eq 0; then
    fail "no INVITE in the message log"
else
    ok
fi
