You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
758 B
37 lines
758 B
4 years ago
|
#!/bin/bash
|
||
|
|
||
|
cd "$(dirname "$0")"
|
||
|
line="$1"
|
||
|
snd="$2"
|
||
|
. config.txt
|
||
|
|
||
|
./ann_end.sh "$line" # and any existing calls to prevent our call ending up in "call waiting" state (and thus not autoanswered)
|
||
|
sleep 0.5
|
||
|
./autoanswer_line.sh "$line" 1 || { echo >&2 "failed to enable autoanswer, exiting."; exit 1; }
|
||
|
|
||
|
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${line}_$i.wav
|
||
|
playitem=/tmp/ann${line}_$i
|
||
|
fi
|
||
|
playstring="$playstring&$playitem"
|
||
|
i=$((i+1))
|
||
|
done
|
||
|
|
||
|
fn=/var/spool/asterisk/tmp/ann_$line.call
|
||
|
echo "
|
||
|
Channel: PJSIP/emerg$line
|
||
|
Application: Playback
|
||
|
Data: $playstring
|
||
|
Priority: 1
|
||
|
" >$fn
|
||
|
|
||
|
mv "$fn" /var/spool/asterisk/outgoing/
|
||
|
|
||
|
./ann_volup.sh "$line" &
|
||
|
|