Automatically pause your MPD on incoming Fritz!Box call

A friend recently told me how great it is to have an Asterisk server at home. One of the reasons was a nice feature he implemented: If a call is coming in (or going out) and his computer is currently playing music, the music will automatically stop and resume after the call ended.

Since I don’t have an Asterisk at home and don’t want one, I was thinking about whether that was possible with my Fritz!Box DSL/WiFi/VoIP combo and MPD as well. Turns out, it is.

I have written a little shell script, fritzmpdpause, that:

  • requires nothing but a POSIX shell (like bash), sed and netcat (and of course MPD running on some host and a Fritz!Box)
  • does not require changes on a Fritz!Box with stock firmware
  • will pause MPD when a call comes in or goes out
  • keeps track of the number of active calls (because you might have more than one) and resumes playing only if none are left
  • does not resume playing if you have during the call manually instructed MPD to stop playing

Get it while it’s hot, post it to Fritz!Box power user forums (I’m not active on any of them) or MPD sites and tell your friends about it!

Erstellt: 29. 1. 2010, 14:16:34 (CET)
Tags: English Fritz!Box HowTo code fritzmpdpause bash shell script MPD mute pause
scytale.name