My office very often closes after the time set in the TimeGroup, and I would like to override it using a cron script that monitors a softphone status installed on a pc that is surely online until the office closes
I wrote this bash script to monitor the status of the that extension (12) and the status of the time condition (feature code *275), but I cannot "dial" this feature code from the script.
I tried "originate SIP/12 extension *275@from-internal", but it doesn't work
Can some help me please?
Thank you in advance for any answer
this is the script
- Code: Select all
#!/bin/bash
#Check softphone status whose estension is 12
PC=`/usr/sbin/asterisk -r -x "sip show peers" | grep "12/12" |awk '{print $2}'`;
#if online is: 192.168.1.10
#if offline is: (Unspecified)
#Check Time Condition status whose feature code is *275
STATO=`/usr/sbin/asterisk -r -x "core show hint *275" |awk 'NR==1{split($3,a,":");print a[2]}'`;
#if activated is: InUse
#if deactivated is: Idle
echo $PC
echo $STATO
if [ "$PC" != "192.168.1.10" ] && [ "$STATO" == "Idle" ]; then
#pc is off-line
echo "try to set NightTime"
/usr/sbin/asterisk -r -x "originate SIP/12 extension *275@from-internal"
elif [ "$PC" == "192.168.1.10" ] && [ "$STATO" == "InUse" ]; then
echo "try to set DayTime"
/usr/sbin/asterisk -r -x "originate SIP/12 extension *275@from-internal"
else
echo ""
fi