I won the RestComm/Telestax category at TADHack 2014 Madrid. You can see the video of my presentation for the Real Time Quiz hack.
The solution is based in two components; Web and CC (Call Control) side, that is the telephone network.
The web side, handles the contest logic. This logic is implemented as a very basic state machine, with the different contest states (WAITING_PARTICIPANTS->ASK<->WAITING_ANSWERS->END). For this state machine I used a singleton EJB (Enterprise Java Beans). This EJB stores the contest state context (preprovisioned sequence of the right answers, currentRound, and list of participants with their answers). I made a JUnit to test this EJB, and i had it working in two hours. Then I wrapped the logic with a REST JEE resource for the CC call to invoke the necessary logic, allowing participants to interact via tranditional phonecall, using the phone keypad to send their answers.
Finally, I implemented a basic user interface based in JSF/Primefaces (JavaServer Faces (application framework)) for the presenter to guide the contest; one screen to provision the contest answer list, and another one to control the contest state. The control state screen is polling the logic every 3 seconds by Ajax calls, to have the latest information about the contest state, including the list of participants, identified by their phone number, and the responses they provided.
Overall, I did it in around 5 hours; the polling was not working for some reason, and I lost a lot of time fixing that. Then on Saturday morning, I went to the hackaton, and surprised the Telestax guys by presenting my application. We started at 9:30, and I had 4 hours left to implement all the call control logic. I had a sketch of the CC logic on paper, see below, and showed it to George and Henrique, guys from Telestax.
They provided me with a sandbox of the latest RestComm solution. The latest version comes with very powerful actions, like the external service feature, which is what i based all my solution. In 10 minutes we were creating the basic modules in the RVD (RestComm Visual Designer) tool. This graphical tool allows composing the CC/IVR logic very easily. So, in around 1 hour we were ready to start initial integration/functional testing, with the solution.
Thanks to Voxbone, I had some public number/DIDs, so I changed the routing to the new RestComm sandbox. We went to the usual debugging/troubleshooting phase during 1 hour more, during this time we fixed things like invoking the REST API properly. It was a GET not a POST (doh!), so we had to use query parameters, instead of form parameters. I had to patch the web side to make this work, or fix some typos I had in the CC Script. Since we were using the dynamic routing capabilities, is important to name your modules with the exact literal my REST API was returning. Thanks to Henrique, I was able to have something working by noon, phew!
But as you know, Murphy’s Law always ensures problems at the last minute. Due to network issues, the environment was very unstable, calls were not properly routed to the RestComm box, and TTS was failing a lot. So Henrique decided to use another instance, and in about 1 hour we had everything working again, this time quite smoothly. Henrique and I, tested the solution several times, calling the contest in real time, and playing with it. It was working, and it looked pretty amazing.
So around 1300 I reported to Alan Quayle, TADHack event organizer, about the readiness of the solution. He booked me a presentation gap at 1500. So I went on doing more testing. Suddenly at 1330, Alan came to my place, and told me, “Jaime, are you ready?”, I went like “well, I’m doing last minute testing, but I guess I can show something”. Then I was struck by Alan, he told me “prepare yourself, you are presenting your hack right now, you are going to be the first live hack demo, and you have 5 minutes to show your hack”.
I had a basic presentation of the product ready in advance, and even some actual quiz questions, but with this 5 minutes window, there was no time for anything. I went to the stage, rush through the presentation as fast I as could, and headed immediately to the actual demo. Of course, I had several problems; the micro plugged to my phone was not working, so nobody could listen to the contest TTS (Text To Speech) announcement. I switched quickly to a traditional micro, and oriented the micro to the phone. Then I started with first call, and show the first feature. Then I started the actual contest through the presenter Web GUI, unfortunately nobody from the audience joined the contest, later someone told me the slide with the numbers was shown very quick for the people to dial. Since I was the only one playing I started right away. First questions, and boom, the call crashed, later Henrique told me the TTS provider had failed.
I started thinking, “OK , here we go, demo effect again, and nothing is going to work, what a shame”. I attempted the call one more time, restarting the whole contest again, this time the contest behaved properly, and I was able to complete the whole quiz. That was it; my 5 minutes run out, I finished the demo. Alan mentioned he was very happy “first hack, and its working!!!”