Connect an Analog Phone to VoIP with an ATA: Setup Guide
To connect an analog phone to VoIP with an ATA, plug the phone into the ATA's FXS port, give the ATA a LAN IP, and register it to your PBX or provider with a SIP server, user ID, auth ID and password. Use G.711 for fax and card terminals.
- Analog phones, fax machines, card terminals and alarm panels all need an FXS port on an ATA; FXO is only for bringing a phone line into a gateway.
- Register the ATA as a PJSIP extension on FreePBX, or as a single-account SIP registration with a provider, using the same four fields in both cases.
- Fax, card terminals and alarm panels need G.711, 20 ms packets, no VAD and no echo cancellation; G.729 corrupts their tones.
- Turn SIP ALG off on the router and set a 60 to 120 second registration expiry for remote ATAs to avoid one-way audio and dropped registrations.
- Triage in order: power, cable, tone dialing, registration, then PBX logs with pjsip set logger on to read 401, 403, 404, 488 and 503.
How do I connect an analog phone to a VoIP ATA: FXS or FXO?
An analog telephone adapter (ATA) is a small SIP endpoint with one or more RJ11 ports. Each FXS (Foreign Exchange Station) port behaves like the wall socket of a phone company: it supplies battery voltage (about 48 V DC), dial tone and ring voltage (about 90 V AC) to the device you plug in. The ATA turns the phone's off-hook state and dialed digits into SIP signaling and RTP audio.
FXO (Foreign Exchange Office) is the opposite: the port acts like a phone and plugs into an existing telephone line or a legacy PBX extension, so a gateway can answer or place calls on that line. If you are connecting a desk phone, fax machine, alarm panel or card terminal, you need FXS. You need FXO only if you must keep a copper line from the telco and bridge it into the PBX.
| Device you have | Port needed | Where it plugs |
|---|---|---|
| Analog desk phone, cordless base, fax, card terminal, alarm panel | FXS | Phone port of the ATA |
| Copper line from a telco that you want to keep | FXO | Line port of a gateway (for example a FreePBX FXO card or FXO ATA) |
| Old analog PBX extension you want to answer on the VoIP PBX | FXO | Gateway FXO port wired to that extension |
How do I register the ATA to FreePBX or a SIP provider?
There are two models. In the PBX model the ATA is just another extension, so the PBX controls routing, voicemail and outbound routes. In the provider model the ATA registers straight to the carrier with a DID, and the PBX is not involved.
The ATA fields are the same in both cases; only the values differ. In FreePBX, create a PJSIP extension (Applications, Extensions, Add Extension, Add New SIP [chan_pjsip] Extension). Give it a strong, unique secret and do not reuse an IP phone's template.
| ATA field | FreePBX PJSIP extension | SIP provider with DID |
|---|---|---|
| SIP server / proxy | PBX LAN IP or FQDN, port 5060 UDP | Provider registrar hostname (port per provider) |
| User ID / username | Extension number, for example 2001 | Account or DID as issued by provider |
| Auth ID / auth username | Extension number (same as user ID) | SIP username from provider portal |
| Password | The extension's secret | SIP password from provider portal |
| Display / caller ID name | Name and Outbound CID set in FreePBX | Set by provider or by the account |
| Outbound proxy | Leave empty on a LAN | Only if the provider requires it |
| Register expiry | 300 s on LAN, 60 to 120 s if remote | As provider recommends, 60 to 120 s behind NAT |
# Confirm the ATA registered (Asterisk CLI)
asterisk -rx "pjsip show endpoints"
asterisk -rx "pjsip show contacts"
# Watch the REGISTER exchange live
asterisk -rx "pjsip set logger on"
sngrep -d any port 5060Which network settings should I set before the first call?
Give the ATA a static IP or a DHCP reservation, so the PBX, firewall rules and provisioning always find it. Put it on the voice VLAN if you have one, and give that VLAN a QoS marking of DSCP EF (46) for RTP and CS3 (24) for SIP.
Disable SIP ALG on the router. It rewrites SIP headers badly and is the top cause of registrations that work but calls that have one-way audio or drop after about 30 seconds.
For an ATA behind NAT and registering to a remote PBX or provider, set NAT keepalive on and registration expiry to 60 to 120 seconds, so the router's UDP mapping stays open. Set the correct NTP server, time zone and region or tone set (for example US, UK or EU), otherwise dial tone, busy and ring cadence will sound wrong and some phones will not detect them.
On the PBX side, for NATed remote ATAs set the PJSIP extension's Force rport, Rewrite Contact and RTP Symmetric to yes, and set External Address and Local Networks in Settings, Asterisk SIP Settings. For LAN ATAs, set direct_media to no so audio always traverses the PBX and codecs stay predictable.
; pjsip.endpoint (custom or via FreePBX GUI)
[2001]
type=endpoint
disallow=all
allow=ulaw,alaw
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
dtmf_mode=rfc4733
; RTP range on the PBX (rtp.conf), open this on the firewall
[general]
rtpstart=10000
rtpend=20000 What ATA settings does each device need?
Voice calls tolerate compression and clever tricks; fax, modems and payment terminals do not. A fax or card terminal sends audio tones (V.21, V.29, V.34, or DTMF tones) that G.729 and other low-bitrate codecs distort, because they are tuned for speech and not for modem signals. VAD (silence suppression) also cuts the start of a tone burst, and an echo canceller treats the modem tone as echo and suppresses it.
Use the table as the starting profile for each device, then tune.
| Setting | Voice phone | Fax machine | Card terminal / PoS dial-up | Alarm panel |
|---|---|---|---|---|
| Codec | G.711 ulaw/alaw first, G.722 not available on analog | G.711 only | G.711 only | G.711 only |
| Packetization | 20 ms | 20 ms | 20 ms | 20 ms |
| VAD / silence suppression | Off | Off | Off | Off |
| Echo canceller | On | Off (or tone-disable) | Off | Off |
| Jitter buffer | Adaptive | Fixed, medium to high | Fixed | Fixed |
| DTMF | RFC2833 (rfc4733) | RFC2833 | Inband fallback if digits fail | Inband on G.711 for Contact ID |
| Fax mode | None | G.711 passthrough; T.38 only if all hops support it | None | None |
| Speed limit | n/a | 14400 bps, ECM on | Lowest modem speed the terminal offers (V.22 or V.32) | n/a |
How do I make fax work: G.711 or T.38?
G.711 passthrough sends the fax tones as ordinary audio. It works well on a clean LAN or a good carrier path, but it needs under about 1 percent packet loss and low jitter, as a lost packet corrupts a scan line and ECM must resend it. T.38 relays the fax as data packets with redundancy, so it tolerates loss better, but it works only if the ATA, the PBX and the carrier all negotiate it. A mismatch gives a 488 or a call that connects and then fails during the handshake.
So the safe order is: start with G.711 passthrough, ECM on, speed capped at 14400 bps, echo canceller off. Move to T.38 only if loss over the internet path makes passthrough unreliable and your carrier states T.38 support. In FreePBX, enable T.38 passthrough on the extension (PJSIP t38_udptl=yes, t38_udptl_ec=redundancy) only when the ATA also has T.38 enabled.
Test before cutover. Send 10 pages at 200 dpi to a fax service or to a second machine, and send a 1-page test at the highest quality the carrier allows. Run ping and mtr from the ATA's network to the provider for five minutes and check for loss and jitter; then check RTP stats with rtp set debug on and the ATA's own call statistics.
; PJSIP endpoint tuned for a fax ATA
[2002]
type=endpoint
disallow=all
allow=ulaw
t38_udptl=no ; set yes only when T.38 is verified end to end
t38_udptl_ec=none
fax_detect=no
direct_media=noHow should the dial plan, caller ID and 911 be set?
Analog phones send digits one at a time, so the ATA needs a digit map telling it when the number is complete. If the map is wrong, calls wait for the full timeout before sending. Use a map such as (*xx|[2-9]xxxxxx|1[2-9]xx[2-9]xxxxxx|011xx.|xx.T) with a short timeout of 3 to 5 seconds, and allow # as a terminator so users can send immediately.
On the PBX, make sure an outbound route matches what the ATA sends, with the trunk's prefix rules, and that the extension's Outbound CID is a number the carrier allows. Otherwise calls fail with 404 or 403, or arrive with blocked or wrong caller ID.
Emergency calls: register an E911 address for the number the ATA presents, and for the DID of each remote location. An ATA has no location awareness, so a remote ATA that moves will send responders to the wrong place. Also label every analog phone, as a power cut disables the ATA, router and PBX at once, so put them on a UPS.
How do I fix no dial tone or failed calls, in order?
Work from the physical layer upward, and stop at the first failure. Most no dial tone cases are not SIP problems at all.
| SIP response | Meaning | Typical fix |
|---|---|---|
| 401 Unauthorized | Challenge, or wrong secret if it repeats | Check password and auth ID; compare to the extension secret |
| 403 Forbidden | Rejected by ACL, or the trunk blocked the caller | Check PJSIP ACL, Fail2ban, and the provider's allowed IPs |
| 404 Not Found | No route or extension matches the digits | Check digit map, outbound route patterns and trunk prefix |
| 488 Not Acceptable Here | Codec or media mismatch | Allow ulaw/alaw on both legs; disable T.38 if not supported |
| 503 Service Unavailable | Trunk down or registration lost | Check trunk registration and DNS; check the provider status |
- Check power and link lights on the ATA (Power, WAN/LAN, and the Phone port light that shows registration).
- Check the phone cable is in the Phone/FXS port, not the Line/FXO or LAN port, and try a known good phone.
- Set the phone to tone dialing, not pulse, and test with a different handset to rule out a dead phone.
- Open the ATA web page and read the registration status. If it says Not Registered, check the server, user ID, auth ID, password and expiry.
- On the PBX, check the account is enabled and run fail2ban-client status asterisk to see whether the ATA IP is banned; unban it with fail2ban-client set asterisk unbanip <IP>.
- Run asterisk -rx "pjsip set logger on", dial from the phone, and read the INVITE and the response in the CLI or in sngrep.
- For one-way audio, confirm SIP ALG is off, rtp_symmetric and force_rport are on, and UDP 10000 to 20000 is open to the ATA; run rtp set debug on to see which direction has no packets.
Common questions
Can I use two phones on one ATA port?
Yes for ordinary phones, as they simply share the line, but only one call is possible at once and the ringer load is limited, typically to about 3 REN. Do not share a port between a fax machine or card terminal and a phone, as an extension phone picked up during a transmission will corrupt it.
Why does my credit card terminal fail only on the VoIP line?
Usually because of a compressed codec, VAD or the echo canceller changing the modem tones, or because jitter breaks the connect. Set G.711 only, turn off echo cancellation and VAD, use a fixed jitter buffer and lower the terminal's modem speed, or ask the processor to switch it to IP mode.
Does an alarm panel work through an ATA?
Often, if the ATA uses G.711, no echo cancellation and inband or passthrough DTMF so Contact ID tones arrive intact. Ask the monitoring company to confirm that it accepts VoIP dialers, as some do not, and keep a cellular or IP communicator as a backup.
What DTMF mode should I choose, RFC2833 or inband?
Use RFC2833 (rfc4733 in PJSIP) on both the ATA and the PBX or trunk, as it is reliable and sent out of band. If an IVR or alarm still misses digits and the call uses G.711, switch to inband, which sends the tones as audio and is the safest fallback.
How do I fix echo or low volume on an analog phone?
Make sure the echo canceller is on for voice and, if echo remains, lower the ATA's Rx gain by 3 dB steps, or Tx gain if the far end hears an echo of their own voice. If the volume is too low, raise the gain in small steps, since too much gain causes clipping and echo.