»
»
»
»
»
»
»
»
»
»
»
»
»
|
Andrew
»
»
»
»
»
»
»
»
»
»
»
»
»
»
»
|
» » » » » » » » » » » » » » » » » » » » »
»
»
|
 |
Summary
Modem is plugged into computer
mgetty-voice answers phone and takes messages, calls new_voice or new_fax depending.
new_voice and new_fax process files out of /var/spool and deposit into /home/mage/voicemail
voicemail/index.php Lists voice messages and faxes and lets users listen to/view. Also lets users desribe voice messages.
Software
the script that lets users use the output is 16kb so I'm not posting as part of this.
cat /etc/mgetty/new_voice
####
#!/bin/bash
#
# new_voice
#
OWNERSHIP=mage:users
VOICEMAILSTO=root
telecomdir=/home/mage/voicemail
VOICE_NAME=$1
echo `date +%F-%H.%M` $@ >> /tmp/voice_variables.txt
TIMESTAMP=`date +%F-%H.%M`
#rmdtopvf v-27004-1062727301.rmd | pvfspeed -s 8000 | pvftowav > v-27004-1062727301.wav
# v-$PID-$unixtimestamp.rmd
rmdtopvf $VOICE_NAME | pvfspeed -s 8000 | pvftowav > /home/mage/voicemail/$TIMESTAMP.wav
chown $OWNERSHIP /home/mage/voicemail/$TIMESTAMP.wav
rmdtopvf $VOICE_NAME | pvfspeed -s 11000 | pvftowav | lame - $telecomdir/$TIMESTAMP.mp3
chown $OWNERSHIP $telecomdir/$TIMESTAMP.mp3
chown $OWNERSHIP $VOICE_NAME
mv $VOICE_NAME $telecomdir/$TIMESTAMP.rmd
#GSM_NAME=/tmp/`basename $VOICE_NAME .rmd`.gsm
#cp $VOICE_NAME $GSM_NAME
#/usr/local/bin/mutt -F /dev/null -s "New voice message `date`" \
# -a $GSM_NAME $VOICEMAILSTO <
#New voice message on `date`
#EOF
#rm -f $GSM_NAME
exit 0
##########################################################
I very recently added mp3 playback via a flash movie to the web portion of this, so I had to make mp3s, I converted from the rmd files that mgetty outputs instead of from the wav files because I had to change the sample rate. With the wav's I used 8kHz which is how many samples the modem kicked out, and flash requires a multiple of 11kHz. Lame actually resamples it to 11.025kHz so maybe I should change the value in the pvfspeed command. It took my P3 533 17 minutes 22 seconds to encode 371 mp3's
cat make-mp3s.sh
#!/bin/bash
for ITEM in `ls /home/mage/voicemail/*.rmd`; do
FILE=`basename $ITEM .rmd`
if [ ! -e $FILE.mp3 ] ; then
#echo $FILE.mp3
rmdtopvf $ITEM | pvfspeed -s 11000 | pvftowav | lame - $FILE.mp3
fi
done
Heres a script I used to change the resolution of the images available to web browsers. It doesn't check if the gif is already there like the make-mp3s script does. 18 fax pages took 3 minutes and 24 seconds to be processed which is an average of 26 seconds.
cat make-fax-gifs.sh
#!/bin/bash
for ITEM in `ls /home/mage/voicemail/g3.dump/ | grep -v txt | grep -v gif | grep -v pbm | grep -v xwd`; do
echo $ITEM
#g3toxwd -aspect 2.0 g3.dump/$ITEM | convert - $ITEM.gif
g32pbm g3.dump/$ITEM | convert -resize 800x2400 - $ITEM.gif
DIMENSIONS=`identify $ITEM.gif | cut -d " " -f 3`
HEIGHT=`echo $DIMENSIONS | cut -d "x" -f 2`
if [ $HEIGHT -ge 1100 ]; then
#echo its too big
convert -sample 100%x50% $ITEM.gif $ITEM.gif
fi
echo `ls -l --time-style=+%y%m%d%H%M g3.dump/$ITEM `
echo `ls -l --time-style=+%y%m%d%H%M g3.dump/$ITEM | cut -d " " -f 7`
touch -t `ls -l --time-style=+%y%m%d%H%M g3.dump/$ITEM | cut -d " " -f 7` $ITEM
.gif
#echo h=$HEIGHT
done
Hardware
Hardware is very simple and boring, I use an external USRobotics 56k Voice/Fax modem hooked up to COM1 (/dev/ttyS0) This modem has served me well since 1999
|
|