12-27-2020, 09:04 AM
(12-27-2020, 06:10 AM)lat Wrote:(12-22-2020, 10:39 PM)hiimtye Wrote: user guide lists some files to put scripts into that you can add a one liner to play an audio file using your favourite lightweight player for sms and callsThanks for the tip! Now, I have 2 scripts:
1. ring
2. pickupCode:mpv --loop ringtone1.wav
These work well, except when I miss the incoming call - the phone keeps ringing indefinitely. Is another hook required? How to do it in order to stop the phone ringing on a missed call?Code:pkill mpv
This is what I have in ring and pickup hooks. This checks if incoming call is still active and stops ring when the call has disconnected.
ring:-
Code:
#!/usr/bin/env sh
incallmonitor() {
CALLRINGING=$(mmcli -m "$(modem_n)" --voice-list-calls)
echo $CALLRINGING
if [[ "$CALLRINGING" == "No calls were found" ]]; then
exit 1
fi
}
modem_n() {
MODEMS="$(mmcli -L)"
echo "$MODEMS" | grep -qoE 'Modem\/([0-9]+)' || finish "Couldn't find modem - is your modem enabled?"
echo "$MODEMS" | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2
}
sxmo_audioout.sh Speaker
amixer sset 'Line Out' 100%
while true; do
mpv /home/mo/Music/message_tone.mp3 --no-video
sxmo_vibratepine 1000
notify-send $1
incallmonitor "$1"
done
pickup:-
Code:
ID=$(ps -ef|grep ring|grep -v grep|perl -ne '$_=~ m/^ *(.*) mo.*/;print $1')
kill -9 $ID
pkill mpv
sxmo_audioout.sh