openbsd-ports/comms/mgetty+sendfax/files/new_voice
ajacoutot 65f918ecea Missing new_fax @sample spotted by Guy Daniel guy at pctechs dot com dot au
While here, also add a sample voice script.

Some cleanups and remove antique comment.
2010-03-21 11:04:29 +00:00

43 lines
1.1 KiB
Bash

#!/bin/sh
#
# $OpenBSD: new_voice,v 1.1 2010/03/21 11:04:29 ajacoutot Exp $
extension="wav"
contenttype="audio/x-wav"
fn=$1
tempfn=/tmp/voice.temp
email=root
seperator="========== $$fn =========="
echo To: $email > $tempfn
echo From: ${email}@`hostname` >> $tempfn
echo Subject: Voicemail: `/bin/date +%Y-%m-%d` - `/bin/date +%Hh%M` >> $tempfn
echo Mime-Version: 1.0 >> $tempfn
echo Content-Type: multipart/mixed\; boundary=\"$seperator\" >> $tempfn
echo "" >> $tempfn
pagefn=voice.$$.$extension
outputfn=$fn.$extension
${TRUEPREFIX}/bin/rmdtopvf $fn | ${TRUEPREFIX}/bin/pvftowav 2>/dev/null > $outputfn
echo --$seperator >> $tempfn
echo Content-Type: application/octet-stream; name=\"$pagefn\" >> $tempfn
echo Content-Type: $contenttype\; name=\"$pagefn\" >> $tempfn
echo Content-Transfer-Encoding: base64 >> $tempfn
echo Content-Disposition: attachment\; filename=\"$pagefn\" >> $tempfn
echo "" >> $tempfn
cat $outputfn | /usr/sbin/openssl base64 >> $tempfn
rm -f $outputfn
echo --$seperator >> $tempfn
/usr/sbin/sendmail < $tempfn $email
rm -f $tempfn
rm -f $1