Hi folks,

I am working on a shell script that I can use with the externnotify command in voicemail.conf. All is well and seems ready to rock, except I can't figure out how to tell the script what e-mail address to send the mail messages to. I warn you ahead of time that I am no scripting guru.

Basically, I have 14 after-hours mailboxes that all have different e- mail addresses. I want this script to parse the mailbox number from the original command ($2), and then somehow look that up mailbox's address and send an e-mail. It then checks every five minutes to see if the message has been retrieved, and escalates things as necessary. I don't mind the messy solution of defining all 14 addresses in the script itself, though it would be nice to look it up from voicemail.conf or something eventually.

I started out using /bin/sh for the scripting, but I assume that this is limiting me with what I can do with variables, etc. The only way I can think of off the top of my head is to use some sort of nested variable, like this subset of my script:

Tmpmail=/tmp/dispatch$$.mail
[EMAIL PROTECTED]

# Send an e-mail to the appropriate address for this mailbox:
echo "724-6066 $2" > $Tmpmail
echo "New Voicemail Message #$3 in mailbox $2" >>$Tmpmail
cat $Tmpmail | mail -s "$mailsubject" $ext$2

now, the "$ext$2" is what I mean by nested variable. Basically, if I can find a way to make this evaluate as $ext108, and then as [EMAIL PROTECTED], I would be a happy camper. Is there any way to do this?

I know that this is technically not an Asterisk question, but then again, it is. If anyone has wrestled with this in their own externnotify scripts, please let me know

Tom

PS: I know that perl and other scripting languages would be better for this, but this seemed simpler to me at the time I started. If it can't be done using sh, then I'll start over in perl, but if there's a way to make this work, it's the only thing standing between me and a script that works exactly as I want.

--------------------
Tom Rymes
Cascade Link Systems
www.cascadelinksystems.com
(603) 375-1414

"Intelligent technology solutions for small businesses."


_______________________________________________
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to