Inspiration
I wanted to make a bridge from text-based games to phone calls. I thought it would be cool to bridge two ways of interfacing with the user that are not often thought of together. I also thought it would be a cool way to play some classic text-based games.
What it does
My project reads and writes the game's standard input and output and reads the results out loud on a phone call. It has a powerful, flexible matching engine built on regular expressions that can transform game outputs to make them better for reading over the phone and transform user inputs so that they're in the format the game expects. The game code runs unmodified and my project handles all the translation between input/output formats as well as interacting with the phone system.
If I had purchased SIP trunking service, I could have made this game available via a regular phone number that anyone could call. However, I didn't do that, so it's only accessible on my LAN.
How I built it
For most of the development, I used a mockup script that just used the terminal to interface with the games (although it did it in the same way that the final version would later do). This was because I was having trouble configuring the phone system and, in any case, it was cumbersome to copy my files back and forth. The actual interface is very simple, taking advantage of the Asterisk PBX's AGI scripting interface. It only uses a few AGI commands and the rest of the logic is implemented in Python. I set myself the task of adding enough text replacement and manipulation features so that I could adapt a golf game that I wrote for CSC171, and I ended up adding what I think are a pretty complete set of fundamental building blocks that could be used to adapt any game.
Challenges I ran into
Asterisk/SIP in general really does not like working behind NAT and especially not behind double NAT. I was running the PBX in a Docker container for convenience but I could not get the NAT to work so I switched to hosting it on a dedicated Raspberry Pi.
Also, the website for FreePBX (the distribution/configuration of Asterisk that I used) was down for the first several hours of hacking which made it impossible to set up the phone system then.
Accomplishments that I'm proud of
I'm really happy with how this entire project turned out. I was able to implement all of the advanced, flexible text matching and replacement features that I wanted, and I found it to be pretty easy to adapt a game to it.
What I learned
I learned a lot with this project. I had messed with Asterisk/FreePBX a little bit in the past, but not very much. With this project, I learned a lot about troubleshooting that combination as well as setting up configurations for it behind the scenes. I had never programmed with the AGI scripting interface before, so that was also a learning experience.
What's next for game2asterisk
I would like to make it easier to generate the description files by making a web GUI or something that would allow the user to autogenerate at least some of the files so that they could fill the rest in by hand. This would make it a lot easier to use.

Log in or sign up for Devpost to join the conversation.