30 lines
834 B
Bash
Executable file
30 lines
834 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# By default, we operate in bracketed mode: initiate listening calls, play announcement and terminate them
|
|
# With -n, we do not do bracketing, you have to initiate and terminate listening calls yourself
|
|
# with ann_listen[_all].sh and ann_end[_all].sh. Useful if you want to combine playback and speech in
|
|
# one announcement (call 121 to speak without bracketing).
|
|
|
|
if [[ "$1" == -n ]]; then num=121; shift; else num=122; fi
|
|
|
|
|
|
playstring="silence/1"
|
|
i=0
|
|
for arg in "$@"; do
|
|
if [[ "$arg" =~ ^silence ]]; then
|
|
playitem="$arg"
|
|
else
|
|
ffmpeg -i "$arg" -ar 8000 -ac 1 -y /tmp/ann$i.wav
|
|
playitem=/tmp/ann$i
|
|
fi
|
|
playstring="$playstring&$playitem"
|
|
i=$((i+1))
|
|
done
|
|
|
|
fn=/var/spool/asterisk/tmp/ann_play.call
|
|
echo "
|
|
Channel: Local/$num@orgs
|
|
Application: Playback
|
|
Data: $playstring
|
|
" >$fn
|
|
mv $fn /var/spool/asterisk/outgoing/
|