Skip to content

Instantly share code, notes, and snippets.

@mbornoz
Created January 14, 2013 09:09
Show Gist options
  • Save mbornoz/4528760 to your computer and use it in GitHub Desktop.
Save mbornoz/4528760 to your computer and use it in GitHub Desktop.
#!/bin/bash
mute() {
temp=$(mktemp)
pacmd list-sink-inputs > $temp
process_id=$(pidof "twinkle")
while read line; do
if [[ "${line:0:6}" == "index:" ]]; then
index="${line:7}"
elif [[ "${line:0:25}" == "application.process.id = " ]]; then
if [[ "${line:25}" != "\"$process_id\"" ]]; then
pacmd set-sink-input-mute $index $1 > /dev/null 2>&1
fi
fi
done < $temp
}
if [[ "${SIP_CSEQ}" == "102 INVITE" ]]; then
from=$(echo ${SIP_FROM}| cut -d ';' -f 1)
if zenity --question --no-markup --text "CALL FROM: $from, answer?"; then
mute 1
echo "awful.tag.viewonly(tags[2][9])" | awesome-client #default startup tag for twinkle
twinkle --cmd answer
fi
else
mute 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment