scobby
16.07.05, 17:00
Hab mal nen Script geschrieben für vbox.
Es sendet ne Mail mit der Nachricht als mp3 und es löst den Namen via Rückwärtssuche der Telekom auf.
Ich benutzte ssmtp deswegen musste ich mich noch per smtp authentifizieren.
Deswegen habe ich das Script ein wenig umgebaut.
Lässt sich aber auch ohne sstmp verwenden.
dafür muss noch die standard.tcl geändert werden
die standard.tcl
# First we clear the touchtone sequences and remove all entries from
# the callerid breaklist.
vbox_init_touchtones
vbox_breaklist rem all
# If variable VBOX_FLAG_STANDARD is TRUE we must play the standard
# message...
if { "$vbox_flag_standard" == "TRUE" } {
set RC [ vbox_put_message $vbox_msg_standard ]
vbox_pause 500
if { "$RC" == "HANGUP" } {
return
}
}
# If variable VBOX_FLAG_BEEP is TRUE we must play the beep
# message...
if { "$vbox_flag_beep" == "TRUE" } {
set RC [ vbox_put_message $vbox_msg_beep ]
vbox_pause 500
if { "$RC" == "HANGUP" } {
return
}
}
# If variable VBOX_FLAG_RECORD is TRUE we must record a new
# message...
if { "$vbox_flag_record" == "TRUE" } {
set VBOX_NEW_MESSAGE "$vbox_var_spooldir/incoming/$vbox_var_savename"
set RC [ vbox_get_message $VBOX_NEW_MESSAGE $vbox_var_rectime ]
vbox_pause 1000
exec -- /usr/local/bin/vbox_to_mail "$VBOX_NEW_MESSAGE" \
"$vbox_caller_name" "$vbox_caller_id" "$vbox_user_name" \
"$vbox_var_spooldir" "$vbox_var_savename"
if { "$RC" == "HANGUP" } {
return
}
if { "$RC" == "TIMEOUT" } {
vbox_put_message $vbox_msg_timeout
vbox_pause 500
}
}
die vbox_to_mail.sh
#! /bin/sh
##
## vboxmail v2.0.0BETA5 (17-NOV-98)
##
## Changed for mail delivering by
## Julian Pawlowski 08/22/01, <julian.pawlowski@jp-solution.de>
MSNAME="${1}"
CALLER="${2}"
CALLID="${3}"
MAILTO=scobby@gmx.de
SPOOLDIR="${5}"
SAVENAME="${6}"
## hierfür muss ssmtp angepasst werden und der mailserver des providers angegeben werden
Uname=XXXX #email account
Pword=XXXXX #email password
##### TELEFONBUCHABFRAGE #########
#pfad zum cachefile
CACHE="/tmp/invsuche"
#pfad zur svdrpsend.pl
SVDRPSEND="/myusr/webserver/svdrpsend.pl"
#pfad um das tempfile anzulegen
TMPFILE="/tmp/tmpsuche"
LOG="/tmp/invlog"
echo "Param1: $CALLID " >> $LOG
echo "Param2: $2 " >> $LOG
# Anzahl der Sekunden zwischen den Nachrichten
WAIT=5
NUMMER=`echo 0$CALLID | sed -e "s/\ //g" -e "s/+49/0/"`
NAME=`awk -F '\t' '{ if ($1 == "'$NUMMER'") print $2 }' $CACHE`
DETAILS=`awk -F '\t' '{ if ($1 == "'$NUMMER'") print $3 }' $CACHE`
if [ "$NAME" == "" ]; then
echo "Suche nach $NUMMER in www.dasoertliche.de"
lynx "http://www.dasoertliche.de/DB4Web/es/oetb2suche/home.htm?kw_invers=$NUMMER&main=Antwort&s=2" \
-dump -nolist -connect_timeout=3> $TMPFILE
NAME=`grep printselected.gif -A 2 $TMPFILE | awk '{ if (FNR == 2)
print $0 }' | sed -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
DETAILS=`grep printselected.gif -A 2 $TMPFILE | awk '{ if (FNR == 3)
print $0 }' | sed -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
if [ "$NAME" == "" ]; then
if grep "Kein Teilnehmer gefunden" $TMPFILE > /dev/null; then
NAME="Telefonnummer $NUMMER"
DETAILS="Kein Eintrag $2"
fi;
fi;
if [ "$NAME" == "" ]; then
NAME="Telefonnummer $NUMMER"
DETAILS="Fehler $2"
else
echo -e "$NUMMER\t$NAME\t$DETAILS" >> $CACHE
fi;
fi
######## EMAIL VORBEREITEN UND ABSENDEN ###########
if (test -f "${MSNAME}")
then
echo "umwandeln"
/usr/bin/vboxtoau < ${SPOOLDIR}/incoming/${SAVENAME} > /tmp/${SAVENAME}.au
/usr/bin/sox /tmp/${SAVENAME}.au /tmp/${SAVENAME}.wav
/usr/bin/lame -m m -b 32 -f /tmp/${SAVENAME}.wav /tmp/${SAVENAME}.mp3
datum=`date | cut -d' ' -f1,2,3,4,7`
uhrzeit=`date | cut -d' ' -f5,6`
echo "mimecode erstellen"
datei=(mimencode /tmp/$SAVENAME.mp3)
echo $datei
(echo "From: scobby@gmx.de"
echo "To: Felix Haverkamp < scobby@gmx.de >"
echo "Subject:[Anrufbeantworter] Neu Nachricht von ${CALLER} (${CALLID})"
echo "Mime-Version: 1.0"
echo "Content-Type: Multipart/Mixed; Boundary=\"audio/x-mp3\""
echo "Content-Transfer-Encoding: 7bit"
echo ""
echo "This is a multi-part message in MIME format."
echo ""
echo "--audio/x-mp3"
echo "Content-Type: text/plain;"
echo "charset=\"us-ascii\""
echo "Hallo du,"
echo ""
echo "Nachricht erhalten am: $datum"
echo ""
echo "Telefonbuchauskunft:"
echo ""
echo "Name: $NAME"
echo "Details: $DETAILS"
echo ""
echo " Have a nice day..."
echo ""
echo "--audio/x-mp3"
echo "Content-Type: audio/x-mp3; name=\"$SAVENAME.mp3\""
echo "Content-Description: Nachricht"
echo "Content-Transfer-Encoding: base64"
echo "Content-Disposition: attachment; filename=\"$SAVENAME.mp3\""
echo ""
mimencode /tmp/$SAVENAME.mp3
echo "--audio/x-mp3--" ) | sendmail -au$Uname -ap$Pword $MAILTO
rm /tmp/$SAVENAME.*
rm $MSNAME
fi
bei problemen oder anregungen bitte melden
Es sendet ne Mail mit der Nachricht als mp3 und es löst den Namen via Rückwärtssuche der Telekom auf.
Ich benutzte ssmtp deswegen musste ich mich noch per smtp authentifizieren.
Deswegen habe ich das Script ein wenig umgebaut.
Lässt sich aber auch ohne sstmp verwenden.
dafür muss noch die standard.tcl geändert werden
die standard.tcl
# First we clear the touchtone sequences and remove all entries from
# the callerid breaklist.
vbox_init_touchtones
vbox_breaklist rem all
# If variable VBOX_FLAG_STANDARD is TRUE we must play the standard
# message...
if { "$vbox_flag_standard" == "TRUE" } {
set RC [ vbox_put_message $vbox_msg_standard ]
vbox_pause 500
if { "$RC" == "HANGUP" } {
return
}
}
# If variable VBOX_FLAG_BEEP is TRUE we must play the beep
# message...
if { "$vbox_flag_beep" == "TRUE" } {
set RC [ vbox_put_message $vbox_msg_beep ]
vbox_pause 500
if { "$RC" == "HANGUP" } {
return
}
}
# If variable VBOX_FLAG_RECORD is TRUE we must record a new
# message...
if { "$vbox_flag_record" == "TRUE" } {
set VBOX_NEW_MESSAGE "$vbox_var_spooldir/incoming/$vbox_var_savename"
set RC [ vbox_get_message $VBOX_NEW_MESSAGE $vbox_var_rectime ]
vbox_pause 1000
exec -- /usr/local/bin/vbox_to_mail "$VBOX_NEW_MESSAGE" \
"$vbox_caller_name" "$vbox_caller_id" "$vbox_user_name" \
"$vbox_var_spooldir" "$vbox_var_savename"
if { "$RC" == "HANGUP" } {
return
}
if { "$RC" == "TIMEOUT" } {
vbox_put_message $vbox_msg_timeout
vbox_pause 500
}
}
die vbox_to_mail.sh
#! /bin/sh
##
## vboxmail v2.0.0BETA5 (17-NOV-98)
##
## Changed for mail delivering by
## Julian Pawlowski 08/22/01, <julian.pawlowski@jp-solution.de>
MSNAME="${1}"
CALLER="${2}"
CALLID="${3}"
MAILTO=scobby@gmx.de
SPOOLDIR="${5}"
SAVENAME="${6}"
## hierfür muss ssmtp angepasst werden und der mailserver des providers angegeben werden
Uname=XXXX #email account
Pword=XXXXX #email password
##### TELEFONBUCHABFRAGE #########
#pfad zum cachefile
CACHE="/tmp/invsuche"
#pfad zur svdrpsend.pl
SVDRPSEND="/myusr/webserver/svdrpsend.pl"
#pfad um das tempfile anzulegen
TMPFILE="/tmp/tmpsuche"
LOG="/tmp/invlog"
echo "Param1: $CALLID " >> $LOG
echo "Param2: $2 " >> $LOG
# Anzahl der Sekunden zwischen den Nachrichten
WAIT=5
NUMMER=`echo 0$CALLID | sed -e "s/\ //g" -e "s/+49/0/"`
NAME=`awk -F '\t' '{ if ($1 == "'$NUMMER'") print $2 }' $CACHE`
DETAILS=`awk -F '\t' '{ if ($1 == "'$NUMMER'") print $3 }' $CACHE`
if [ "$NAME" == "" ]; then
echo "Suche nach $NUMMER in www.dasoertliche.de"
lynx "http://www.dasoertliche.de/DB4Web/es/oetb2suche/home.htm?kw_invers=$NUMMER&main=Antwort&s=2" \
-dump -nolist -connect_timeout=3> $TMPFILE
NAME=`grep printselected.gif -A 2 $TMPFILE | awk '{ if (FNR == 2)
print $0 }' | sed -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
DETAILS=`grep printselected.gif -A 2 $TMPFILE | awk '{ if (FNR == 3)
print $0 }' | sed -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
if [ "$NAME" == "" ]; then
if grep "Kein Teilnehmer gefunden" $TMPFILE > /dev/null; then
NAME="Telefonnummer $NUMMER"
DETAILS="Kein Eintrag $2"
fi;
fi;
if [ "$NAME" == "" ]; then
NAME="Telefonnummer $NUMMER"
DETAILS="Fehler $2"
else
echo -e "$NUMMER\t$NAME\t$DETAILS" >> $CACHE
fi;
fi
######## EMAIL VORBEREITEN UND ABSENDEN ###########
if (test -f "${MSNAME}")
then
echo "umwandeln"
/usr/bin/vboxtoau < ${SPOOLDIR}/incoming/${SAVENAME} > /tmp/${SAVENAME}.au
/usr/bin/sox /tmp/${SAVENAME}.au /tmp/${SAVENAME}.wav
/usr/bin/lame -m m -b 32 -f /tmp/${SAVENAME}.wav /tmp/${SAVENAME}.mp3
datum=`date | cut -d' ' -f1,2,3,4,7`
uhrzeit=`date | cut -d' ' -f5,6`
echo "mimecode erstellen"
datei=(mimencode /tmp/$SAVENAME.mp3)
echo $datei
(echo "From: scobby@gmx.de"
echo "To: Felix Haverkamp < scobby@gmx.de >"
echo "Subject:[Anrufbeantworter] Neu Nachricht von ${CALLER} (${CALLID})"
echo "Mime-Version: 1.0"
echo "Content-Type: Multipart/Mixed; Boundary=\"audio/x-mp3\""
echo "Content-Transfer-Encoding: 7bit"
echo ""
echo "This is a multi-part message in MIME format."
echo ""
echo "--audio/x-mp3"
echo "Content-Type: text/plain;"
echo "charset=\"us-ascii\""
echo "Hallo du,"
echo ""
echo "Nachricht erhalten am: $datum"
echo ""
echo "Telefonbuchauskunft:"
echo ""
echo "Name: $NAME"
echo "Details: $DETAILS"
echo ""
echo " Have a nice day..."
echo ""
echo "--audio/x-mp3"
echo "Content-Type: audio/x-mp3; name=\"$SAVENAME.mp3\""
echo "Content-Description: Nachricht"
echo "Content-Transfer-Encoding: base64"
echo "Content-Disposition: attachment; filename=\"$SAVENAME.mp3\""
echo ""
mimencode /tmp/$SAVENAME.mp3
echo "--audio/x-mp3--" ) | sendmail -au$Uname -ap$Pword $MAILTO
rm /tmp/$SAVENAME.*
rm $MSNAME
fi
bei problemen oder anregungen bitte melden