From 5145ff73679ea26416d30a840e579d8a770320c0 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 15 Jul 2013 10:56:42 +0200 Subject: [PATCH] bin/check.sh: different port and media port for each responder. bin/sipp.sh: MPORT has no default --- bin/check.sh | 19 +++++++++++++------ bin/sipp.sh | 19 ++++++++++++++----- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/bin/check.sh b/bin/check.sh index 425e9d4d..a9db4209 100755 --- a/bin/check.sh +++ b/bin/check.sh @@ -85,6 +85,8 @@ function error_sipp # $1 sipp xml scenario file function run_sipp { + PORT=50603 + MPORT=6003 # test LOG_DIR # we dont want to remove "/*" don't we? if [ -z ${LOG_DIR} ]; then @@ -96,15 +98,19 @@ function run_sipp ${BIN_DIR}/restart_log.sh for res in $(find ${SCEN_CHECK_DIR} -type f -name 'sipp_scenario_responder[0-9][0-9].xml'| sort); do base=$(basename $res .xml) - ${BIN_DIR}/sipp.sh -d ${DOMAIN} -r ${SCEN_CHECK_DIR}/${base}_reg.xml - ${BIN_DIR}/sipp.sh -d ${DOMAIN} -r ${SCEN_CHECK_DIR}/${base}.xml & - responder_pid="${responder_pid} ${base}:$!" + echo "Running ${base} ${PORT}-${MPORT}" + ${BIN_DIR}/sipp.sh -d ${DOMAIN} -p ${PORT} -r ${SCEN_CHECK_DIR}/${base}_reg.xml + ${BIN_DIR}/sipp.sh -d ${DOMAIN} -p ${PORT} -m ${MPORT} -r ${SCEN_CHECK_DIR}/${base}.xml & + responder_pid="${responder_pid} ${base}:$!:${PORT}:${MPORT}" + let PORT=${PORT}+1 + let MPORT=${MPORT}+2 done status=0 # let's fire sipp scenarios for send in $(find ${SCEN_CHECK_DIR} -type f -name 'sipp_scenario[0-9][0-9].xml'| sort); do - echo "Run sipp with $send" - ${BIN_DIR}/sipp.sh -d ${DOMAIN} $send + base=$(basename $send .xml) + echo "Running ${base} 50602-7002" + ${BIN_DIR}/sipp.sh -d ${DOMAIN} -p 50602 -m 7002 $send if [[ $? -ne 0 ]]; then status=1 fi @@ -113,13 +119,14 @@ function run_sipp for res in ${responder_pid}; do base=$(echo $res| cut -d: -f1) pid=$(echo $res| cut -d: -f2) + port=$(echo $res| cut -d: -f3) ps -p${pid} &> /dev/null ps_status=$? if [ ${ps_status} -eq 0 ]; then echo "sipp responder $base pid $pid not finished yet. Waiting 5 secs" sleep 5 fi - ${BIN_DIR}/sipp.sh -d ${DOMAIN} -r ${SCEN_CHECK_DIR}/${base}_unreg.xml + ${BIN_DIR}/sipp.sh -d ${DOMAIN} -p ${PORT} -r ${SCEN_CHECK_DIR}/${base}_unreg.xml done # copy the kamailio log diff --git a/bin/sipp.sh b/bin/sipp.sh index 68a091c8..1e7ee043 100755 --- a/bin/sipp.sh +++ b/bin/sipp.sh @@ -23,7 +23,7 @@ function usage echo "Options:" echo -e "\t-d: DOMAIN. default: spce.test" echo -e "\t-p: sip port. default 50602/50603(responder)" - echo -e "\t-m: media port. default 6002/6003(responder)" + echo -e "\t-m: media port" echo -e "\t-t: timeout. default 10/25(responder)" echo "Arguments:" echo -e "\t sipp_scenario.xml file" @@ -58,18 +58,27 @@ MAX="5000" set_domain 1 if [ -z ${RESP} ]; then - MPORT=${PORT:-"6002"} + if [ ! -z ${MPORT} ]; then + MPORT_ARG="-mp ${MPORT}" + fi PORT=${PORT:-"50602"} TIMEOUT=${TIMEOUT:-"10"} + #echo "Running sipp SCENARIO=$1 IP=${IP} PORT=${PORT} MPORT_ARG=${MPORT_ARG} TIMEOUT=${TIMEOUT}" sipp -max_socket $MAX -inf ${BASE_DIR}/../callee.csv -inf ${BASE_DIR}/../caller.csv -sf $1 -i $IP \ - -nd -t ul -p $PORT $IP -m 1 -mp ${MPORT} -timeout ${TIMEOUT} -timeout_error -trace_err &> /dev/null + -nd -t ul -p $PORT $IP -m 1 ${MPORT_ARG} -timeout ${TIMEOUT} -timeout_error -trace_err &> /dev/null + status=$? else - MPORT=${PORT:-"6003"} + if [ ! -z ${MPORT} ]; then + MPORT_ARG="-rtp_echo -mp ${MPORT}" + fi PORT=${PORT:-"50603"} TIMEOUT=${TIMEOUT:-"25"} + #echo "Running RESP sipp SCENARIO=$1 IP=${IP} PORT=${PORT} MPORT_ARG=${MPORT_ARG} TIMEOUT=${TIMEOUT}" sipp -max_socket $MAX -inf ${BASE_DIR}/../callee.csv -sf $1 -i $IP \ - -nd -t ul -p $PORT $IP -m 1 -rtp_echo -mp ${MPORT} -timeout ${TIMEOUT} -timeout_error -trace_err &> /dev/null + -nd -t ul -p $PORT $IP -m 1 ${MPORT_ARG} -timeout ${TIMEOUT} -timeout_error -trace_err &> /dev/null + status=$? fi set_domain 0 +exit $status #EOF