Yes, yes, I sold a little piece of my soul and bank account and bought myself an iPhone 4S. Apart from the price tag, the only doubt I had was the due to the closed nature of all Apple products. Seems its not all that closed though, with a little work, you can get Siri on the iPhone to just about anything you want except the dishes. In this article, I will discuss the steps that were needed to add some custom functionality to Siri. With these steps, Siri will respond to the command “What’s on TV?”. It will display a list of TV programmes and you can even ask for a summary for that program.
Actually getting everything together is a bit of work but I managed to get it up and running in a few hours. Here are the main components you will need. This script by SiriProxy’s author helped me a lot in setting up the environment so if you want more details, you should definitely check that out.
A Linux (virtual) machine and custom DNS server
We basically want our iPhone to think its talking to an official Apple Siri server. For this, we will need a DNS server on our local network which will resolve the address guzzoni.apple.com to the address of our fake server which is running SiriProxy. For the sake of convenience, lets say this is the same one as the DNS server.
I added a new virtual machine in VMWare based on an Ubuntu 11.10 instance. Then I installed dnsmasq using apt-get and edited the /etc/dnsmasq.conf file to redirect guzzoni.apple.com to the machine which will run SiriProxy; so in this case the same one. Here is the entry I had to add:
This opensource ruby project will fake Apple’s official Siri servers protocol and allows user to create plugins that listen to commands. Writing these plugins is extremely simple, as we will see later. I would say the installation is more difficult, though the process is described well on the website.
Here is a screenshot of SiriProxy running in the VM.
A configured iPhone
An important step here is to generate an SSL certificate using SiriProxy. You then need to install that certificate on your iPhone. You can do this easily by mailing it to yourself…
Open up the certificate file (siriproxy.pem) on your iPhone and install it by clicking the icon:
You will also need to point your iPhone’s DNS server to the IP of our own DNS server. You can do this at Settings => WIFI => Press the arrow after your network => DNS. Enter the same IP address here, which is 192.168.0.133 in our case.
OK the iPhone is configured. To revert back, you can remove the certificate by going to General => Profile => Remove. Don’t forget you’ll also need to revert the DNS settings to point to your home gateway again.
JXMLTV is a Java XMLTV grabber; which means it can dump the TV schedule to an XML file, which is then readable by another application, such as my SiriProxy plugin. To use it, go to the website and download the latest version, preferably on the same machine that will run SiriProxy. You can then start JXMLTV, which will dump the schedule to a file. Then we just need to copy that file to /tmp/jxmltv/xmltv.xml so the SiriProxy plugin can read it.
If you’re installing something more permanent ,you may want to automate this process by creating a daily cron job for this.
Before running JXMLTV, you should first check if your system time is correct, because on my Virtual Machine that wasn’t the case for some reason, which resulted in no data at all.
The SiriProxy plugin I created can be found on my github page. It is also my first Ruby script ever and I have to say writing Ruby feels really natural.
To install DominiekTV, do the following:
Make sure you verified the directories in the above script above since they won’t match your setup.
Okay, to recap, here’s what you should have by now:
- A Linux VM running dnsmasq.
- SiriProxy installed on that machine.
- DominiekTV plugin for SiriProxy installed.
- The output of the JXMLTV tool in /tmp/jxmltv/xmltv.xml
- The certificate installed on your iPhone and the DNS server on your iPhone changed to the VM’s IP.
If you have all these, you can fire up SiriProxy by going to the folder you installed it in and entering:
This should show a message saying SiriProxy has started on port 443.
Then you can ask Siri “What’s on TV?”, it will read the TV schedule for you, here’s what you will see on the screen:
You can also ask Siri something like “What’s ‘My Wife and Kids’ about?”, it will give the synopsis of the show.
That was pretty easy. There are some downsides though. Because we tampered with the iPhone configuration, Siri won’t work out of your home network (unless you remove the certificate). Your iPhone’s internet connection will also fail if the DNS server is not longer running. That said, SiriProxy offered us a way to easily extend Siri with custom functionality. I can only imagine how difficult it must have been to get that working, so kudos!
Published on 04 Mar 2012