#!/bin/sh
# configversion: 1

# This script is executed (asynchronously) when you get an incoming call
# You can use it to play a ring tone

# $1 = Contact Name or Number (if not in contacts)

# Start the mpv ring until another hook kill it or the max (10) is reached
mpv --volume=0 --quiet --no-video --loop=10 /usr/share/sxmo/ring.ogg &
MPVID=$!
echo "$MPVID" > "$XDG_RUNTIME_DIR/sxmo.ring.pid"

# Vibrate while mpv is running
while kill -0 $MPVID; do
		sxmo_vibrate 1500
		sleep 0.5
done
