Ich habe einfach eines für die 7170 erstellen lassen und 29.04.40
das wars..eingespielt und gefreut!
#write calllog
cat > /var/calllog << 'ENDCALLLOG'
#!/bin/sh
CALLER=${1}
LINE=${3}
if [ -z "${LINE}" ]
then
LINE=${2}
fi
if [ "${LINE}" = "ISDN" ]
then
LINE=${2}
fi
if [ -z "${LINE}" ]
then
LINE=${1}
CALLER=""
fi
sh /var/tmp/parse_telefon.sh "${LINE}" "${CALLER}" &
ENDCALLLOG
# save /var/calllog
mknod /var/flash/calllog c $tffs_major $((0x77))
cp /var/calllog /var/flash/calllog
#CONTACTSEND
#LINES
#line=:anonym;
#line=xxxx
#line=SIP0: xxxx
#line=SIP1: xxx
#LINESEND
# write reverse lookup script to file
cat > /var/tmp/invers.sh << 'ENDINVERS'
#!/bin/sh
number=$1
wget -q -O /var/tmp/page "http://www2.dasoertliche.de/?form_name=detail&lastFormName=search_inv&ph=${number}&recFrom=1&hitno=0" 2>/dev/null
while read reverse
do
case ${reverse} in
*detail_top*)
name=${reverse#*\>}
name=${name%%\<*}
break
;;
esac
done < /var/tmp/page
echo "${name}" > /var/tmp/name
# get address
while read reverse
do
if [ -n "${gotaddress}" ]
then
address=${reverse#*\>}
address=${address%\<*}
break
fi
case ${reverse} in
*da_adresse*)
gotaddress=1
;;
esac
done < /var/tmp/page
echo "${address}" | sed -e '{s/ / /g;s/<br \/>/;/g;}' > /var/tmp/address
ENDINVERS
# make it executable
chmod +x /var/tmp/invers.sh
# write send script to file
cat > /var/tmp/callmessage.sh << 'ENDCALLMESSAGE'
#!/bin/sh
caller=${2}
called=${1}
# search name in contact list
entry=`cat /var/flash/debug.cfg 2>/dev/null | fgrep "#contact=${caller}:" | sed "s/#contact=${caller}://"`
name=${entry%%\;*}
address=${entry#*\;}
address=${address%\;*}
street=${address%%\;*}
zip=${address##*\;}
# name not found?
if [ -z "${name}" ]
then
# do reverse lookup at www.dasoertliche.de
/var/tmp/invers.sh ${caller}
name=`cat /var/tmp/name`
# found name?
if [ -n "${name}" ]
then
# add found contact to debug.cfg
address=`cat /var/tmp/address`
street=${address%%\;*}
zip=${address##*\;}
cat /var/flash/debug.cfg | sed -e "s/^#CONTACTSEND$/#contact=${caller}:${name};${address};#CONTACTSEND/g" | sed -e 's/#CONTACTSEND$/\
#CONTACTSEND/g' > /var/tmp/debug.cfg
else
# add anonymous for contact to debug.cfg
cat /var/flash/debug.cfg | sed -e "s/^#CONTACTSEND$/#contact=${caller}:${caller};#CONTACTSEND/g" | sed -e 's/#CONTACTSEND$/\
#CONTACTSEND/g' > /var/tmp/debug.cfg
fi
cat /var/tmp/debug.cfg > /var/flash/debug.cfg
rm /var/tmp/debug.cfg
fi
# name not found?
if [ -z "${name}" ]
then
name=${caller}
fi
httpname=`echo "${name}" | sed -e '{s/ /%20/g;s/Ä/Ae/g;s/Ö/Oe/g;s/Ü/Ue/g;s/ä/ae/g;s/ö/oe/g;s/ü/ue/g;s/ß/ss/g;s/&/%26/g;}'`
httpstreet=`echo "${street}" | sed -e '{s/ /%20/g;s/Ä/Ae/g;s/Ö/Oe/g;s/Ü/Ue/g;s/ä/ae/g;s/ö/oe/g;s/ü/ue/g;s/ß/ss/g;s/&/%26/g;}'`
httpzip=`echo "${zip}" | sed -e '{s/ /%20/g;s/Ä/Ae/g;s/Ö/Oe/g;s/Ü/Ue/g;s/ä/ae/g;s/ö/oe/g;s/ü/ue/g;s/ß/ss/g;s/&/%26/g;}'`
echo "Name: ${name}"
echo "Strasse: ${street}"
echo "PLZ: ${zip}"
# search line in line list
theline=`cat /var/flash/debug.cfg 2>/dev/null | fgrep "#line=${called}:" | sed "s/#line=${called}://"`
theline=${theline%%\;*}
# line not found?
if [ -z "${theline}" ]
then
theline=${called}
fi
httptheline=`echo "${theline}" | sed -e '{s/ /%20/g;s/Ä/Ae/g;s/Ö/Oe/g;s/Ü/Ue/g;s/ä/ae/g;s/ö/oe/g;s/ü/ue/g;s/ß/ss/g;s/&/%26/g;}'`
# Send information to all DHCP clients
while read x x IP x
do
wget -O /dev/null "http://${IP}:23232/?caller=${caller}&called=${called}&name=${name}&line=${theline}" >/dev/null 2>&1 &
done < /var/flash/multid.leases
# send information to DBoxes -> TV popup
#if [ ${called} = "SIP0" ]
#then
wget -O /dev/null "http://cccccccccc/control/message?Anrufer%3A%0A${httpname}%0A${httpstreet}%0A${httpzip}%0A%0ALeitung%3A%20${httptheline}" >/dev/null 2>&1 &
#fi
sleep 3
killall wget
ENDCALLMESSAGE
# make it executable
chmod +x /var/tmp/callmessage.sh
# write dummy WakeOnCall script
echo "#!/bin/sh" > /var/tmp/woc.sh
# make it executable
chmod +x /var/tmp/woc.sh
# write parse_telefon script to file
cat > /var/tmp/parse_telefon.sh << 'ENDPARSETEL'
#!/bin/sh
trap "" SIGCHLD
prefix=
caller="$2"
called="$1"
called=${called%%#*}
# normalize caller
case ${caller} in
0049*)
caller=0${caller#*0049}
;;
49????????*)
caller=0${caller#*49}
;;
[1-9]????????*)
caller=0${caller}
;;
[1-9]*)
caller=${prefix}${caller}
;;
esac
# exec woc.sh
/var/tmp/woc.sh ${called} ${caller} &
# exec callmessage.sh
/var/tmp/callmessage.sh ${called} ${caller} &
ENDPARSETEL
# write reverse lookup script to file
cat > /var/tmp/invers.sh << 'ENDINVERS'
#!/bin/sh
number=$1
wget -q -O /var/tmp/page "http://www2.dasoertliche.de/?form_name=detail&lastFormName=search_inv&ph=${number}&recFrom=1&hitno=0" 2>/dev/null
while read reverse
do
case ${reverse} in
*detail_top*)
name=${reverse#*\>}
name=${name%%\<*}
break
;;
esac
done < /var/tmp/page
echo "${name}" > /var/tmp/name
# get address
while read reverse
do
if [ -n "${gotaddress}" ]
then
address=${reverse#*\>}
address=${address%\<*}
break
fi
case ${reverse} in
*da_adresse*)
gotaddress=1
;;
esac
done < /var/tmp/page
echo "${address}" | sed -e '{s/ / /g;s/<br \/>/;/g;}' > /var/tmp/address
ENDINVERS
wget -q -O /var/tmp/page "http://www2.dasoertliche.de/?form_name=detail&lastFormName=search_inv&ph=${number}&recFrom=1&hitno=0" 2>/dev/null
dann kommt diese Fehlerseite
ÖTB-Relaunch Exception:
String index out of range: 53
bekomme ich ein Ergebnis. Ob das Script aber damit was anfangen kann, habe ich noch nicht getestet.
# write reverse lookup script to file
cat > /var/tmp/invers.sh << 'ENDINVERS'
#!/bin/sh
number=$1
rm /var/tmp/page 2>/dev/null
#wget -q -O /var/tmp/page "http://www2.dasoertliche.de/?form_name=detail&lastFormName=search_inv&ph=${num ber}&recFrom=1&hitno=0" 2>/dev/null
wget -q -O /var/tmp/page "http://www2.dasoertliche.de/?form_name=search_inv&ph=${number}&recFrom=1&hitno=0" 2>/dev/null
let cnt=0;
while read reverse
do
if [ "$gotname" = "1" ];
then
# get address
let cnt=cnt+1;
if [ "$cnt" = "6" ]; then
address=${reverse}
address=${address%%\<*}
[COLOR="Red"]#address=`echo "$address" | sed -e 's/ / /g'`;[/COLOR]
break;
fi
fi
# get name
case ${reverse} in
*entry*)
name=${reverse#*\>}
name=${name%%\<*}
gotname=1
;;
esac
done < /var/tmp/page
echo "${name}" > /var/tmp/name
[COLOR="Red"]#echo "${address}" > /var/tmp/address
echo "${address}" | sed -e '{s/ / /g;s/,/;/g;}' > /var/tmp/address[/COLOR]
ENDINVERS
wget -q -O /var/tmp/page "http://www2.dasoertliche.de/?form_name=detail&lastFormName=search_inv&ph=${num ber}&recFrom=1&hitno=0" 2>/dev/null
wget -q -O /var/tmp/page "http://www2.dasoertliche.de/?form_name=search_inv&ph=${number}&recFrom=1&hitno=0" 2>/dev/null