more vgetty stuff

Robert Nicholson (robert@steffi.dircon.co.uk)
Mon, 13 Feb 1995 21:56:20 +0100


BTW: I actived the MIME message notification in vm_message and for
some reason it doesn't work. Here's what I have.

#!/bin/sh -xv

VOICE_DIR=/var/spool/voice
BINDIR=/usr/local/bin

FLAG=$VOICE_DIR/incoming/.flag

# This script is called when a message was recorded. 
# It gets the following argument:
#      $1 : filename of the recorded message

# set the flag, this will cause vgetty to turn on the message light
touch $FLAG

#
# Below are some suggestions on ways to use this shell script
#

PATH=/bin:/usr/bin:/usr/local/bin:$BINDIR:/usr/local/bin/mh

MAIL=/usr/lib/sendmail
MAILTO="faxadm,nicholr@gb.swissbank.com"
N=`basename "$1"`
TMP=/tmp/`basename $0`.$$

## Notify user by mail that a message has arrived

(
	echo "Subject: Voice call: $N"
	echo
	echo zplay -s "$1"
) | $MAIL $MAILTO

## convert message to SUN .au, uuencode and mail it
## This could be useful if you have a fast mail connection.
#
#(
#	echo "Subject: Voice message"
#	echo
#	adpcmtopvf <"$1" | pvftoau -ulaw | uuencode "$N".au
#) | $MAIL $MAILTO

##
## MIME format thanks to Marc Evans <marc@Synergytics.Com>
##

LBIN=/usr/local/bin

## mail an audio/basic file via metamail, works only for adpcm
## Use this method if you have /dev/audio support
$(LBIN)/adpcmtopvf <"$1" | $(LBIN)/pvfspeed 1.2 | $(LBIN)/pvftobasic >$TMP
$(LBIN)/metasend -t $MAILTO -b -z -s "Voice-mail message" -e base64 \
         -m audio/basic -f $TMP 
#</dev/null 2>&1 >/dev/null
#rm -f $TMP

## The following section defines new MIME audio formats, they
## will be played on the modem. Use this if you don't have /dev/audio.
##
##  Add the following lines (less the comment characters) to /etc/mailcap:
##   audio/x-adpcm-3; zplay -s %s ; description="ADPCM 3-bit encoded audio"
##   audio/x-adpcm-2; zplay -s %s ; description="ADPCM 2-bit encoded audio"
##   audio/x-celp; zplay -s %s ; description="CELP encoded audio"
##  OR, add the following lines to your ~/.mh_profile (if you use mhn):
##   mhn-show-audio/x-adpcm-3; zplay -s %f
##   mhn-show-audio/x-adpcm-2; zplay -s %f
##   mhn-show-audio/x-celp; zplay -s %f
##
## NOTE: There are many variations on the above lines. Choose what is right
## for your particular configuration and needs.

## set FORMAT to "adpcm-2", "adpcm-3" or "celp", as appropiate.
FORMAT=adpcm-3

## Send the message via MIME mail (using mh as the agent)
#umask 077
#( echo "To: $MAILTO"
#  echo "Subject: Voice-mail"
#  echo "--------"
#  echo "# audio/x-$FORMAT [ Voice-mail message ] $1"
#) >$TMP
#echo 'send' | comp -use -editor /usr/local/bin/mh/mhn -file $TMP >/dev/null
#rm -f $TMP

## Alternative method (using metamail directly)
#metasend -t $MAILTO -b -z -s "Voice-mail message" -e base64 \
#         -m audio/x-$FORMAT -f "$1" </dev/null 2>&1 >/dev/null

-------------------------------------------------------------------------------

Now, the regular mail stuff works fine. ie. I get notification that a
message just arrived which I believe is comming from this
code. However the MIME messaging doesn't work and I really cannot
think why.

When I run this script manually and parse it the name of the voc file
it works fine. However when vgetty runs it the MIME mail just doesn't
get sent.

Any ideas?