My new iTunes/Asterisk/PHP Hack!


After hitting pause on my iTunes for the fifth call that came in, I figured there had to be an easier way to get my music and phone to sync up. It’s not a big deal, except I usually forget to turn my speakers back up (or resume my music), and I work in silence until my conscious mind alerts me.

Thanks to the guys over at RustyBrick, I have implemented an automatic pause/resume system. I have a PHP script that connects to my Asterisk box and watches it for relevant activity. When a call comes in, I get the Caller ID through a Growl notification, and AppleScript tells iTunes to pause. When I hang up, AppleScript tells iTunes to resume. If I make a call, it pauses as well.

It sure took some hacking to get it to work though. The RustyBrick guys may have been using an older version of Asterisk, and parts of the AppleScripts did not work on Leopard. It’s OK though as I’m just using this for me, so I just hard coded a few things in there.

Fun stuff!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.