The roles are complementary
An FXS interface supplies the analog telephone-side service, including line feed and ringing behavior. An FXO interface behaves as the line-consuming side, as a conventional phone does toward a telephone line. To connect an analog phone to a SIP service, you normally need an ATA's FXS port. To bring an existing analog line into an IP PBX, you normally need an FXO gateway port. Devices such as the HT813 provide both roles in one unit, but the ports are not interchangeable.
FXS supplies the line service; FXO uses it. These are two separate connection examples. Never connect two live FXS sources together.
Check more than port count
For FXS, verify ringing load, supported caller-ID format, country impedance settings and the attached device's dialing behavior. Multiple physical ports do not necessarily share one SIP identity or provide the same simultaneous-call capacity. For FXO, verify line supervision: how answer and disconnect are detected, whether polarity reversal or current interruption is supplied, and which tones and cadence apply. A line that remains seized after hangup may have a supervision mismatch rather than a SIP failure.
Avoid damaging assumptions
Do not connect two line-supplying interfaces together or feed an ATA into building wiring that is still connected to a live outside line. Have the wiring isolated and identified by a competent installer. For selection, record the required port role, regional electrical profile and call behavior. Then test ring, answer, DTMF and disconnect in both directions. A dial tone alone is not enough: it may be generated locally even when upstream service is unavailable.
Sources & applicability
Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.
Examples require adaptation to your topology. No live PBX or hardware testing is claimed.