MT#8721 run sipp on background to get the proper pid on responder scenario

mr3.5
Victor Seva 12 years ago
parent 968175b1c9
commit 637eb0521f

@ -281,6 +281,7 @@ function run_sipp
local base=""
local pid=""
local responder_pid=""
# test LOG_DIR
# we dont want to remove "/*" don't we?
@ -324,13 +325,13 @@ function run_sipp
PORT="5060"
fi
echo "$(date) - Running ${base} $ip:${PORT}-${MPORT}"
if [ -f ${SCEN_CHECK_DIR}/${base}_reg.xml ]; then
echo "$(date) - Register ${base} $ip:${PORT}-${MPORT}"
${BIN_DIR}/sipp.sh -T $transport -i $ip -p ${PORT} -r ${SCEN_CHECK_DIR}/${base}_reg.xml
fi
${BIN_DIR}/sipp.sh -T $transport -i $ip -p ${PORT} -m ${MPORT} -r ${SCEN_CHECK_DIR}/${base}.xml &
responder_pid="${responder_pid} ${base}:$!"
pid=$(${BIN_DIR}/sipp.sh -b -T $transport -i $ip -p ${PORT} -m ${MPORT} -r ${SCEN_CHECK_DIR}/${base}.xml)
echo "$(date) - Running ${base}[${pid}] ${ip}:${PORT}-${MPORT}"
responder_pid="${responder_pid} ${base}:${pid}"
if [ "${foreign_dom}" == "no" ]; then
check_port ${PORT}
@ -367,7 +368,7 @@ function run_sipp
ps_status=$?
if [ ${ps_status} -eq 0 ]; then
echo "$(date) - sipp responder $base pid $pid not finished yet. Killing it"
kill -9 ${pid}
kill -SIGUSR1 ${pid}
fi
fi
done

@ -27,11 +27,13 @@ function usage
echo -e "\t-t: timeout. default 10/25(responder)"
echo -e "\t-i: IP. default 127.0.0.1"
echo -e "\t-T: transport [UDP|TCP] default UDP"
echo -e "\t-r: responder"
echo -e "\t-b: run sipp in background (responder)"
echo "Arguments:"
echo -e "\t sipp_scenario.xml file"
}
while getopts 'hrp:m:t:i:T:' opt; do
while getopts 'hrp:m:t:i:T:b' opt; do
case $opt in
h) usage; exit 0;;
r) RESP=1;;
@ -40,6 +42,7 @@ while getopts 'hrp:m:t:i:T:' opt; do
t) TIMEOUT=$OPTARG;;
i) IP=$OPTARG;;
T) TRANSPORT=${OPTARG,,};;
b) BACK="-bg";;
esac
done
shift $(($OPTIND - 1))
@ -86,13 +89,24 @@ else
PORT=${PORT:-"50603"}
TIMEOUT=${TIMEOUT:-"25"}
sipp -max_socket $MAX ${TRANSPORT_ARG}\
-inf ${BASE_DIR}/callee.csv -inf ${BASE_DIR}/caller.csv \
-sf $1 -i $IP -p $PORT \
-nr -nd -t ul -m 1 ${MPORT_ARG} \
-timeout ${TIMEOUT} -timeout_error -trace_err \
$IP_SERVER &> /dev/null
status=$?
if [ -z ${BACK} ]; then
sipp -max_socket $MAX ${TRANSPORT_ARG}\
-inf ${BASE_DIR}/callee.csv -inf ${BASE_DIR}/caller.csv \
-sf $1 -i $IP -p $PORT \
-nr -nd -t ul -m 1 ${MPORT_ARG} \
-timeout ${TIMEOUT} -timeout_error -trace_err \
$IP_SERVER &> /dev/null
status=$?
else
tmp=$(sipp $BACK -max_socket $MAX ${TRANSPORT_ARG}\
-inf ${BASE_DIR}/callee.csv -inf ${BASE_DIR}/caller.csv \
-sf $1 -i $IP -p $PORT \
-nr -nd -t ul -m 1 ${MPORT_ARG} \
-timeout ${TIMEOUT} -timeout_error -trace_err \
$IP_SERVER)
echo $(echo $tmp | cut -d= -f2 | sed -e 's_\[__' -e 's_\]__')
status=0
fi
fi
exit $status

Loading…
Cancel
Save