UPDATE

There were enough people wanting this, so I went ahead and made the process a lot more simple. 

If all you want to do is make you Mac mute when a phone call comes  in then just install Caller from the Android Market, and install this application on your mac. 

Caller’s defaults have been changed to use the Mac Applications settings. The Mac Application runs a small server in the background that accepts connections from the Phone and handles the muting. There is also a small icon in the menu bar to help when you don’t want it to auto mute.

The Caller application will still work with other scripts and applications. There is no reason to stop it from doing that. Your current settings will be preserved if your upgrading from a previous version of caller. The default values are listed below incase you want to switch over to using them.

Base Server URL: http://192.168.42.1:3366
Call Start Arguments: /mute
Call Stop Arguments: /unmute

I have left the original article intact below, so that others can reference how to setup custom scripts to do other things then mute macs.

The original article.

So a friend and I were talking to day, and we got to talking about how cool it would be if your mac would mute when you get a phone call. I was thinking about this a few days ago but figured I was just weird. When my friend made the same statement out of nowhere, I went AH HA, and started trying to figure it out. 

Well theres no automatic way to do it. Thats what I figured out. So being a developer I just made one. 

The process takes two parts. First we need a application on our phone that can make a get request when a call comes in, and one when a call ends. Second we need a script on the computer in question to do the actual muting. 

But before we go any futher….

 

My system specs

  • Several Android phones (does the muting)
  • A Mac Book Pro (needs muting)

Don’t worry if you have windows or linux or some other OS this should still work, you will just need to adjust the muting script. If you have an iPhone instead of an android, your own your own (though the idea still works, you just need an iPhone app to run it) 

 

Android Side

I could not find an application to do this automatically, so I wrote one. Google really i nice to their devs, that makes it worth wile to do these nice little apps. Apple is not nice to their devs, so I will likely never create an iPhone app for this, but maybe someone else will. The code is simple, I just don’t want to fight with the Mobile App Store. Not worth it for an application that I can’t see charging for.

Any way, rant over, back to the app. Search the android marker for “Caller” or “Coteyr” if caller returns to many results for you.  Install and set aside.  We will come back to configuring it in a moment. 

Computer side

Make some kind of script to be called via a get request and host it somehow. I used Apache and my sites directory. Simple. Here is what I am using. It is a slightly modified version of the script found here.

Make sure you enable php on your mac (or what ever os you use). And then thats it your good to go.

Back to the Android

 Start Caller, put in your server url and the arguments you wish to send. Don’t forget the ? or else….  And your done, enjoy your phone muting computer experience.

Quick Notes

  • If the app force closes, then you will have to reinstall or restart you phone. This shouldn’t happen, but it sometimes can if you put in a really funky URL or your server responds with a 301/302
  • You don’t have to just mute, you can do all kinds of stuff. The Caller app does a get when you get on the phone and a get when you hang up the phone. Use it for anything. 
  • You really should make sure that your nice php script isn’t accessible to the outside world. At least add in some silly URL based security or something. Better to just have it on the local lan. 
  • If you have any questions just email me. But I do charge for writing code and scripts. See this website for examples. 

Coteyr.net Programming LLC. is about one thing. Getting your project done the way you like it. Using Agile development and management techniques, we are able to get even the most complex projects done in a short time frame and on a modest budget.

Feel free to contact me via any of the methods below. My normal hours are 10am to 10pm Eastern Standard Time. In case of emergency I am available 24/7.

Email: coteyr@coteyr.net
Phone: (813) 421-4338
GTalk: coteyr@coteyr.net
Skype: coteyr
Guru: Profile