uElastix is designed for this to run on your Pi.
But you still need a PSTN Gateway- You can't (and please do not) connect PSTN directly to your Pi or any custom made device. A cheap and good one is Linksys PAP2T and lots on ebay. I would recommend SPA3102 and that is what I used at home.
Then you configure the SPA3102 to forward calls to uElastix and you can write custom scripts in Asterisk to execute PHP files, Bash Scripts or anything you want!
- You could not use the SPA gateway and redirected your home number to a virtual sip number / provider that will connect yo your pi over the internet. But you have to make sure your internet is always on. Then you can also use an wireless IP phone at home that just needs to be connected to your Wifi.
- Performance of Asterisk on the Pi depends if you are going to transcode audio. If you enable pass through it will reduce CPU use but possibly require more bandwidth. Transcoding will use less bandwidth, more CPU. Essentially Each user will use a bit of CPU. SO pass thought users could use 10% meaning you can have 10 simultaneous calls. Transcoded users could fall to 2 or 3 simultaneous calls.
- Some Telecom providers already provide you with SIP alternatives, where you can use that in Asterisk to dial out and you will get billed to your Telecom. For example BT in the UK, and also you can use IP phones on other shared BT networks or private WiFi to place and receive calls via your account or asterisk.
The provided guide for answering machines. Skip all the installing bits and just use uElastix. Then just use the extensions and configuration they show there as that is pretty basic Asterisk stuff. uElastix works really well on the Pi
Good luck though. Scripting in Asterisk is not easy and learning is even worse! But once you got it working you will be proud!