What you saw in the movies, when this happened, were using dedicated answering machine hardware, connected to the same analog line as the phone.
With voicemail in Asterisk (And the voicemail service provided by many telcos, not needing a dedicated machine) this is not possible, as the circuit is closed, as soon as the dial attempt finishes, the call is then routed to voicemail, somewhere else.
You could connect a phone and an answering machine to an ATA, to archive what you want, but that’s about the only way to do it.
The way you would approach this in Asterisk is to make a temporary recording of the caller’s identity, call the callee, and using a callee answer subroutine, on Dial, present that recording to the callee and ask if they want to take the call. There is an option for the subroutine to return “torture” status, which is intended to send the caller to an IVR intended to waste the time of junk callers.
There may well be worked examples of this, somewhere.
I generally do what you’ve seen in the films for all my unknown callers, on my home phone, which is a DECT phone directly on a simple analogue line.
In theory, you can emulate this, but you’d need non-standard hardware.
If you have an IP phone that can auto-answer, you could use that as your “answering machine” speaker.
Then add some logic to Asterisk so that if you pick up the phone while somebody is leaving a message, it redirects them out of VoiceMail and into a bridge with you.
You haven’t told us what hardware you have though.