You could of course use ssh instead but that is a very round-about way of going from a human pressing a dtmf button to powering a door latch somewhere else on the internet (use ssl if you go that route, mqtt is really quite secure if done properly) , . Use an open access mqtt broker and you can let the cleaning lady in while your at the pub. And it cost you 2x$5 for the pi zeros and another 5 for the relay, add in a few hours of R&D and you “learned to fish a bit”.
Then learn how to do it with thge AGI library straight to mqtt and there is no messing with the dialplan
or ssh or bash or routing or . . . needed as you can intercept the DTMF in there as needed.