#!/bin/bash

CHANS=`rasterisk -x "sip show channelstats" | grep ^[0-9.][0-9.][0-9.][0-9.] | gawk -f /usr/local/astium/cron/zombies.gawk`

for i in $CHANS; do
	echo try to hangup $i
	CHAN1=`rasterisk -x "sip show channel $i" | grep "Owner channel ID" | gawk -f /usr/local/astium/cron/zombie-dev.gawk`
	if test x$CHAN1 != "x"; then
	   rasterisk -x "hangup request $CHAN1"
	fi
done

if test -e /tmp/zombie.dat; then
echo results:
cat /tmp/zombie.dat
rm -f /tmp/zombie.dat
fi

