1#!/bin/bash 2 3source config.sh 4 5# some basic checking for dependencies 6if [[ `whoami` != "root" ]]; then 7 echo "you must be root to run the suite..." 8 exit $EXIT_FAILURE; 9fi 10if [[ ! `which sipp` ]]; then 11 echo "you do not have sipp installed..." 12 exit $EXIT_FAILURE; 13fi 14 15if [[ ! `which ngrep` ]]; then 16 echo "you do not have ngrep installed..." 17 exit $EXIT_FAILURE; 18fi 19 20if [[ ! $1 ]]; then 21 echo "please choose the number of subscribers..." 22 exit $EXIT_FAILURE; 23else 24 subscribers_no=$1 25fi 26 27echo "starting suite..." 28 29# truncating log file 30cat /dev/null > ${NGREP_LOG_FILE} 31# killing sipp 32killall -9 sipp &> /dev/null 33# running ngrep 34ngrep -d any -W byline port 5060 &> ${NGREP_LOG_FILE} & 35 36./clean_subscribers.sh && ./send_subscribe.sh ${subscribers_no} && ./send_publish.sh 37 38sleep ${SUBSCRIBE_WAIT_SECONDS} 39 40# killing ngrep 41killall -9 ngrep &> /dev/null 42 43# get the number of notifies sent 44notify_response=`grep 'NOTIFY sip' ${NGREP_LOG_FILE} | wc -l` 45 46echo received ${notify_response} responses... 47 48let responses=${subscribers_no}*${subscribers_no}+${subscribers_no} 49if [[ $responses == ${notify_response} ]]; then 50 echo that look\'s ok... 51else 52 echo should have received $responses responses... 53fi 54 55# cleaning up the sipp stderr output file 56sed s/'Resolving remote host.*'// -i errors.txt 57sed s/'Done.$'// -i errors.txt 58sed '/^$/d' -i errors.txt 59