Skip to content
sipp-test 1.54 KiB
Newer Older
Olav Kvittem's avatar
Olav Kvittem committed
#!/bin/bash

# start a test series of sipp-calls with specs from a config file
# log data about the tests so that files can be combined to edible reports
# by qstream-sipp-check

if test .$1 = .-cf ; then
  source $2
  shift;shift
else
  source /etc/sipshaman/sipshaman.cf
fi
Olav Kvittem's avatar
Olav Kvittem committed

hdir=`date +$DATA/%Y/%m/%d/%H`
mkdir -p $hdir
cd $hdir  || exit -1   # better not to do anything
Olav Kvittem's avatar
Olav Kvittem committed

port=$SIP_PORT   # sip service port start
mport=$MEDIA_PORT # rtp service port start
export IFS=";"

addr=`/sbin/ifconfig eth0| perl -ne 'print $1 if /inet addr:(\d+\.\d+\.\d+\.\d+)/'`
Olav Kvittem's avatar
Olav Kvittem committed

while read server service outproxy function machine calls; do
    if test -z "$server"; then
	continue
    fi
    if test -z "$outproxy"; then
	outproxy="outgoing-proxy-missing"	
    fi
    if test -z "$calls" ; then
	calls=1
    fi
Olav Kvittem's avatar
Olav Kvittem committed

  echo $server | egrep -q '^\s*#'
  if test $? = 1 ; then # no comment
      /usr/bin/sipp $server -s $service -i $addr -sf $CONF/$CLIENT_SCENARIO -p $port -mp $mport -m $calls -rp 200000 -l 1 -trace_stat  -fd 99999 -trace_logs -trace_msg -trace_err -bg -nofork -rsa $outproxy 2>> sipp.err >> sipp.log &
Olav Kvittem's avatar
Olav Kvittem committed
      pid=$!
      adr=$service@$server
      server_ip=`echo $server| sed -e 's/:.*//'`
#      echo server_ip $server_ip
      echo `date "+%F %T"` $pid $port $mport $service@$server   $function $machine `ping -c 10 -i 0.5 -q $server_ip | awk -F / '/^rtt /{print $5}'`>> task.log
#      time=$y-$m-$d-$h
#      perl -e "dbmopen(%tests, 'sip-test.dbm',0622); \$tests\{$time,$pid\}=$adr;dbmclose(%tests)"
Olav Kvittem's avatar
Olav Kvittem committed

      port=$(($port+2))
      mport=$(($mport+4))
Olav Kvittem's avatar
Olav Kvittem committed
  fi
done