#!/bin/bash

# Consume all variables sent by Asterisk


checkresults() {
	while read line
	do
	case ${line:0:4} in
	"200 " ) echo $line >&2
	         return;;
	"510 " ) echo $line >&2
	         return;;	
	"520 " ) echo $line >&2
	         return;;
	*      ) echo $line >&2;;	#keep on reading those Invlid command
					#command syntax until "520 End ..."
	esac
	done
}


echo "ANSWER"
checkresults

echo 'EXEC Dial SIP/test004'
checkresults

echo 'EXEC Hangup'
checkresults


exit 0
