In that particular use case scenario, with a single PSTN line, the lowest cost possible full option solution in my opinion is to use Asterisk on a Raspberry Pi or Beagleboard Black and an analog adapter like the Cisco SPA3102, which costs less than 50 quid, and you don't really need anything else, if you use a fax you can keep the fax functionality directly on the incoming PSTN and let the fax take the faxes and switch to the SPA3102 for the rest. Obviously you can't connect a PSTN line directly to a RaspPi like you can with a VOIP, so the analog adapter transforms the PSTN line into a SIP line so that the RaspPi with asterisk can deal with it like a SIP trunk. This has a few advantages: e.g. you can automatically rout the lowest cost telecom service, including VOIP, and it's compatible with a relatively low cost Huawei SIM box that works really well, for cheaper mobile phone communications and integration of mobile phones into asterisk. A RaspPi can handle about 10 simultaneous full function calls despite of the low processing power and RAM, so it's plenty for your application.
Check out the wiki.asterisk.org, there are plenty of CallerID variables that asterisk stores and that you can use for further database linking, and you can modify or add existing or new variables.
Asterisk uses it's own scripting language AEL, but as a game developer you probably can work with lua without much difficulties, and that is a great tool for automating and manipulating dialplan scripts. Lua can be used for scripting all asterisk functionality, and you can even use existing AEL scripts by asterisk devs in combination with your own lua scripts.
Asterisk is not hard to set up and tweak for exactly the functions that you want, with easy integration of voice recording, least-cost routing, rerouting, outgoing callerID manipulation (for example what I do, everyone in my office dials out with a low cost SIP service, and the outgoing callerID is the mobile number of the person that makes the call, so that customers can immediately store the right number for a better service experience. Incoming calls in my offices come through ISDN or PSTN, depending on the location, asterisk rerouts the calls depending on what number was called and the person that calls the number. If it's a callerID from a case I manage for instance, and the number of the other office is called, it will patch through to my mobile phone over VOIP, so without extra cost. For every scenario, you add a dialplan, which is very easy to do, and asterisk executes the dialplan that corresponds with the use case.
It's very powerful, very stable, it runs on very cheap very low power hardware, and is very reliable. I'm running asterisk on my communications server, which is low power Atom-based, and also acts as a database server for timesheet based invoicing, and making invoices is completely automatic and takes no time at all. Once a month, I just print them out from consolidated data in the database, check them, and let the secretary put them in the mail.
The possibilities are endless, and easy to implement, especially in a small business with a limited number of lines. For bigger installations, which I have to implement regularily, there are some more tricks necessary to make stuff work and there is above all much more hardware that needs to work together with everything else, but in your case, you are completely spared of all that headache lol.
Asterisk on a rasppi is a universal low cost very reliable solution, in Germany, people, even in private houses, that have multiple lines in the house connected to a single ISDN line, don't pay extra for that service to the telecom provider, but have to use a compliant PBX, and that's expensive hardware, and owned by the subscriber, so if it breaks after 10 years or so, they need to replace it and buy it full cost, which is about 400-500 quid installed. Enter the RaspPi, a FritzBox (yeah, it's called like that, I can't help it, those Germans right?) ISDN to SIP adapter, and half an hour of installing and configuring linux and asterisk on the rasppi and adding the VOIP contacts of the people that live there, and they're good to go for another 10 years for under a 100 quid on materials and 50 quid of service fee. We've done a dozen of these in private homes in the last 10 months or so, even with wireless phones, not had a single complaint or problem, people are very enthusiastic about it, because the audio quality is much better than an analog PBX, because the signal is immediately converted to digital at the PSTN entry point, and because there is less switching and routing lag, less clicks and switching noises, and they just have to use their phone like before, but save on communications costs by using SIP communications without even realizing that they are, it's just a great simple upgrade.