2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00
fhem-mirror/fhem/contrib/voip2fhem/voip2fhem_create_telefonlist
martinhaas 12db6bfe8f voip2fhem added to conrib/
git-svn-id: https://svn.fhem.de/fhem/trunk@126 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2007-12-21 12:43:45 +00:00

31 lines
857 B
Bash
Executable File

#!/bin/bash
# this skript creates for e.g. the Siemens C470 IP a telephone book which can be read in by the webinterface of the telephone
# The script reads the /etc/asterisk/extensions.conf and creates the /tmp/teledir.vcf
# Martin Haas 071216
#
# you need the tool unix2dos :-( It is depending on your Distribution included in unix2dos or tofrodos
telefonbook=/tmp/teledir.vcf
rm -f $telefonbook
grep System /etc/asterisk/extensions.conf | grep -v '^;' | \
while read fhemdev
do
number=$(echo $fhemdev | cut -d, -f1 | awk '{print $3}')
name=$(echo $fhemdev | cut -d\" -f2 | sed 's/\./ /g')
echo "BEGIN:VCARD" >>$telefonbook
echo "VERSION:2.1" >>$telefonbook
echo "FN:$name" >>$telefonbook
echo "N:$name" >>$telefonbook
echo "TEL;HOME:$number" >>$telefonbook
echo "END:VCARD" >>$telefonbook
echo >>$telefonbook
done
unix2dos $telefonbook