How do you mute from the command line?
Assuming you're using ALSA driver, run:
amixer set Master mute
amixer set Master unmute
Or, you can just use:
amixer set Master toggle
to toggle mute on and off.
This worked for me when others didn't:
amixer -q -D pulse sset Master toggle
This is from the link in nutty about natty's comment to the first answer:
In my setup sometimes amixer unmute fails for some reason. Therefore I'm using pactl in my scripts:
to mute:
pactl set-sink-mute 0 1
and unmute:
pactl set-sink-mute 0 0
Tested on Ubuntu 12.10.