I have done this. I have my own VoIP system. One of my DIDs picks up and is a recording of me saying "I'm screening my calls for telemarketers and scams. enter code 5300 any time to be connected to $myname". If 5300 is entered, it dials out to the DID for my cellphone and transfers the call. No code, or no action, call goes nowhere.
You can fairly easily make the code whatever you want or make it a multi step process.
Yes, costs average less than $6 a month. Wholesale SIP termination and origination is remarkably cheap if you are dealing with the US48 states and Canada.
I believe I'm at something like 6/10ths of 1 cent per minute.
If I remember correctly from the conversation I mentioned above: this is only implementable yourself with a VOIP solution and not an actual phone line?
I really recommend against introducing analog anything into a modern VoIP system in 2018. Better to port your landline's DID to a VoIP service and route it from there. If you need a physical landline looking phone, good quality sip desk phones are $50 (assuming you don't care about huge color screens).
Definitely. End-to-end digital is best for fidelity and reliability. Running your own PBX is another point of failure for a service most people expect very high uptime out of, and opens you up to toll fraud. It's only worth it if you have a lot of phone or want call recording or transferring.