In the style of the script I would probably do something like
# $MAILTO - recipient
MAILTO=$(grep $5 /etc/asterisk/voicemail.conf|cut -d "," -f3)
if [[ ! $MAILTO =~ .*@.*\.*. ]];then [email protected];fi
Please see the attached file \n\n" | mutt -s "New Call Recording" -a $dtpath$3.mp3 -- $MAILTO
mail does not have an easy attachment syntax, mutt does, you might need to install it.
I am trying to implement this on a system running PIAF Yellow. It works great for calls placed from a local extension, but not for calls from outside to a local extension. I thought it would be a fairly straight-forward modification to expand the if-then statement to include the option of using the extension which was the destination, if the originator extension didn't produce a valid email address. I think I have the code figured out, but I can't find the correct variable to include in the post recording script. I have tried ARG1, which returns "exten" instead of the extension number. I also tried a few other variables that I found in the dial plan extensions_additional.conf under [macro-dial-one] but haven't found anything.
I tried to figure out how to use DumpChan() to list the variables, but haven't been able to get anything to work. It's obvious that I know just enough about dial plans and scripting to be dangerous, but we all have to start somewhere I guess.
Is there anyone who can help with either directions on getting DumpChan() to work, or possibly a list of available variables that can be used in the Post Recording Script fields?
I have also just realized that I may have to modify the code again once I figure out this issue to cover a situation where one extension calls another. In that case, I will need it to be emailed to 2 users.
I do love a challenge though, but am stumped for a bit here with the first issue.