Last active
May 28, 2018 19:48
-
-
Save lgaetz/f5d2ad453c381856b1b7e00d99ed0ecb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Script: lgaetz-rec2email.sh automatically send all call recordings to email for FreePBX | |
| # | |
| # Latest version: https://gist.github.com/lgaetz/f5d2ad453c381856b1b7e00d99ed0ecb | |
| # | |
| # Usage: Save to /var/lib/asterisk/bin/lgaetz-rec2email.sh, owner asterisk:asterisk 777 perms. | |
| # In FreePBX, Advanced Settings, Post Call Recording Script sub actual email send address and populate with: | |
| # | |
| # /var/lib/asterisk/bin/lgaetz-rec2email.sh <email@address.com> ^{MIXMONITOR_FILENAME} ^{FROMEXTEN} ^{ARG3} | |
| # | |
| # License: GNU/GPL3+ | |
| # | |
| # History: | |
| # 2018-05-28 First commit by lgaetz | |
| # | |
| # Argument vars | |
| # $1 - email address | |
| # $2 - File | |
| # $3 - Source CID | |
| # $4 - Destination CID | |
| time=$(date '+%m/%d/%Y %r'); | |
| # zero second recordings are an issue with some Asterisk versions, check file size and exit for small file size | |
| minimumsize=1000 | |
| actualsize=$(wc -c <"$2"); | |
| if [ $actualsize -le $minimumsize ]; then | |
| echo size $actualsize is under $minimumsize bytes | |
| exit | |
| fi | |
| # send email with attachment | |
| echo -e "Date/time: $time\n | |
| Attached Recording: | |
| $2 | |
| " | mail -a $2 -s "Call recording from $3 to $4" $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment