Fritzbox-tr64 Binding Call Monitor not working

Certainly:

One Shell script called CheckCallIN.sh:

'#!/bin/bash

netcat -d 192.168.1.1 1012 | while read logline;
do
if [[ “$logline” = ;RING; ]]; then
echo “ON” > /data/FritzBox/Call.log
DATE=$( echo $logline | cut -f1 --delimiter=“;”)
echo $DATE > /data/FritzBox/DatumLetzterAnruf.log
NUMBER=$( echo $logline | cut -d’;’ -f4)
echo $NUMBER > /data/FritzBox/NummerLetzterAnruf.log
fi

done

Another one called CheckCallOUT.sh:

'#!/bin/bash

netcat -d 192.168.1.1 1012 | while read logline;
do
if [[ “$logline” = ;DISCONNECT; ]]; then
echo “OFF” > /data/FritzBox/Call.log
fi
done

Shell script in init.d Directory to autostart the client (scripts afore) - (I know it is “dirty”):

'#! /bin/sh

case “$1” in
start)
cd /data/FritzBox
nohup ./CheckCallIN.sh &
nohup ./CheckCallOUT.sh &
;;
stop)
pkill -INT ./CheckCallIN.sh
pkill -INT ./CheckCallOUT.sh
;;
restart)
echo “does not work”
;;
esac

exit 0

Both scripts write their results in the file Call.log. So far everything is Independent of OpenHAB.

A short php script (FritzBoxAuslesen.php) provides the echo of this file to OpenHAB:

<?php $out = file_get_contents('/data/FritzBox/Call.log', true); echo $out; ?>

In items file in OpenHAB (calles the FritzBoxAuslesen.php every second to check the Status):

Switch Ring “Anruf [%s]” (FritzBox) {exec=“<[php /data/FritzBox/FritzBoxAuslesen.php:1000:REGEX((.*?))]”}

Maybe “through the back in the eye”, however it works.
Cheers
Björn
PS: Any suggestions welcome.

2 Likes