Direct answer
Every claim is sourced below
A PSTN gateway is a device that converts telephone calls between the circuit-switched public telephone network and a packet-based IP network, so analog phones, fax machines, or a legacy PBX can work with a VoIP system.[1][2] On the analog side it uses two kinds of ports. An FXS port, short for Foreign Exchange Subscriber, supplies dial tone, battery current, and ring voltage to an end device such as a phone or fax machine, while an FXO port, short for Foreign Exchange Office, is the line-side interface that receives dial tone from the PSTN or a PBX and signals on-hook and off-hook by opening and closing the electrical loop.[4][11] The two always work as a pair, because a line coming from an FXO port has to terminate on an FXS port for a call to complete.[4] The gateway handles the media conversion, encoding voice with a codec such as G.711 or G.729 into RTP packets, and it speaks a VoIP control protocol such as SIP, MGCP, or H.248 to the phone system that runs the call.[1][3][8]