#!/bin/sh

# for details see http://www.sineapps.com/news.php?rssid=1647

ASTERISKDIR=/etc/asterisk


# extensions
for i in Cut Sort DBGet DBPut SetCIDNum SetCIDName SetRDNIS AbsoluteTimeout DigitTimeout ResponseTimeout \
	SetLanguage GetGroupCount GetGroupMatchCount SetVar;do
	if grep -i $i $ASTERISKDIR/extensions.conf > /dev/null
		then
		echo "Error: Deprecated (removed) dialplan function $i used in extensions.conf"
		fi
	done


for i in SetGlobalVar CHECK_MD5 QUEUEAGENTCOUNT; do
	if grep -i $i $ASTERISKDIR/extensions.conf > /dev/null
		then
		echo "Warning: Deprecated dialplan function $i used in extensions.conf (will be removed in future versions of asterisk)"
		fi
	done

for i in '${CALLERID}'  '${CALLERIDNAME}'  '${CALLERIDNUM}'  '${CALLERANI}'  '${DNID}'  '${RDNIS}'  '${DATETIME}'  '${TIMESTAMP}'  '${ACCOUNTCODE}'  '${LANGUAGE}' '${SIPUSERAGENT}' 'ALERT_INFO'; do
	if grep -i -F $i $ASTERISKDIR/extensions.conf > /dev/null
		then
		echo "Warning: Deprecated dialplan variable $i used in extensions.conf (will be removed in future versions of asterisk)"
		fi
	done

# iax
for i in mailboxdetail;do

	if grep -i $i $ASTERISKDIR/iax.conf > /dev/null
		then
		echo "Error: Deprecated (removed) option $i used in iax.conf"
		fi
	done

# sip
for i in incominglimit;do

	if grep -i $i $ASTERISKDIR/sip.conf > /dev/null
		then
		echo "Error: Deprecated (removed) option $i used in sip.conf"
		fi
	done


if grep -i rfc2833compensate $ASTERISKDIR/sip.conf > /dev/null;then true; else \
	echo "Warning: you do not use rfc2833compensate in sip.conf. If you are communicating with pre-1.4 asterisk,"
	echo "DTMF reception may act poorly"
	fi



