# Performing voice and fax switchover

The procedure for implementing voice/fax switchover varies depending whether the gateway is at the emitting side or receiving side of the fax transmission.

## Receiving gateway

When the called fax machine receives the CNG tone, it responds by sending a CED tone, which indicates that the called station is a fax terminal. Voice/fax switchover takes place in the following way:

Step | Action
1 | The DS0 endpoint in the receiving gateway detects the CED tone (through ADI tone detection) and sends an ADI event to the application.
2 | The application disables the voice channel.
3 | The application waits for the MSPEVN_DISABLE_CHANNEL_DONE event from the voice channel, then enables the T.38 fax full duplex channel.
4 | The application sends a MSP_CMD_DS0_CONFIG filter command to the DS0 endpoint, changing the endpoint's data transmission mode from voice to fax.

The fax CED tone is transferred as a T.38 packet to the IP network. The following illustration shows the receiving gateway performing voice/fax switchover:

## Emitting gateway

On the emitting gateway, voice/fax switchover takes place in the following way:

Step | Action
1 | When the gateway receives the first T.38 packet, the T38UDP endpoint automatically sends an MSPEVN_T38_PACKET_DETECTED unsolicited event to the gateway application.
2 | The emitting gateway disables the voice channel.
3 | The application enables the T.38 fax full duplex channel.
4 | The application sends an endpoint filter command that switches the DS0 endpoint from voice to fax transmission mode. The T.38 full duplex channel regenerates the CED tone and sends it over the PSTN network (through the DS0 endpoint).

When the calling fax machine (connected to the emitting gateway) receives the CED tone, it begins to transmit fax data across the network. The T38UDP endpoint must be enabled to detect the arrival of T.38 fax packets.

The following illustration shows the emitting gateway performing voice/fax switchover:

The following illustration shows the emitting and receiving gateways transferring fax data after voice/fax switchover has taken place: