Email notification if the status of an extension is "UNKNOWN"

I found a solution in previous posts, but unfortunately not worked for me:

-I created a file: /usr/13.sh
-It has this:

#!/bin/bash
email="[email protected]"
A=/usr/sbin/asterisk -x 'sip show peer 13' | grep -i status | cut -d' ' -f11
if [ “$A” != “OK” ]; then
(
echo “Subject: Extension 13 is down”
printf ‘Extension 13 is down"…’
) | /usr/sbin/sendmail ${email}
fi

If I run 13.sh, I don’t get any emails, even though the status of extension 13 is “UNKNOWN”.
What could be wrong?

In this thread I suggest a synchronous method over the asynchronous cron method

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.