# Setting up fax and voice connections

Fusion gateway applications can implement T.38 fax transmission by switching from voice to fax transmission over existing connections. Applications perform a set of tasks to create voice connections and T.38 fax full duplex connections in advance, and then switch from voice to fax transmission when fax activity is detected. This process is called voice/fax switchover.

To set up voice/fax switchover, the application creates the following MSPP components for each connection:

- DS0 endpoint

- RTP IPv4 endpoint

- T38UDP endpoint

- Voice channel

- T.38 fax full duplex channel

Since the MSPP service allows a single endpoint to connect to multiple channels, applications use mspConnect to connect the DS0 endpoint to:

- A voice channel (and an RTP IPv4 endpoint) creating a voice connection.

- A T.38 fax full duplex channel (and a T38UDP endpoint) creating a T.38 fax stand-by connection.

In T.38 fax stand-by configurations, the application must assign different UDP port numbers to RTP IPv4 and T38UDP endpoints. The T38UDP endpoint must be enabled before it can to perform packet detection.

By default, voice/fax switchover connections transfer voice data until the gateway application directs otherwise. When the application is alerted of fax activity, it switches from voice data transmission to fax data transmission.

Fax activity detection is performed by one of the following MSPP components, depending on the side of the fax transmission where the gateway resides:

- Receiving side: The application performs switchover when the ADI service detects a CED tone (through the DS0 endpoint).

- Emitting side: The application performs switchover when the T38UDP endpoint detects a valid T.38 packet and sends an MSPEVN_T38_PACKET_DETECTED unsolicited event.

The following illustration shows a gateway configured to perform voice/fax switchover:

## Connection setup tasks

The gateway application must perform the following tasks to set up a voice/fax switchover connection:

Step | Action
1 | Create a DS0 endpoint (with ADI service tone detection enabled), an RTP IPv4 endpoint, and a T38UDP endpoint (using mspCreateEndpoint).
2 | Create a full duplex voice channel and a T.38 fax full duplex (using mspCreateChannel).
3 | Connect (using mspConnect) the DS0 endpoint to both: A voice channel (and an RTP IPv4 endpoint), creating a voice connection. A T.38 fax full duplex channel (and an T38UDP endpoint), creating a T.38 fax stand-by connection. Connecting the DS0 endpoint in this way creates two full duplex MSPP connections that share the same DS0 endpoint.
4 | Enable the voice channel (with mspEnableChannel).
5 | Enable ADI service (CED) tone detection (with adiStartToneDetector).

To implement voice/fax switchover gateways at different locations on the network, you must set up voice/fax connections at both network locations. The following illustration shows two Fusion gateways sending voice data across an IP network through voice/fax switchover connections. Initially, the connections on both ends of the network are set up to transfer voice data.

When a calling fax machine sends a CNG tone (indicating that a fax terminal is calling), the tone is carried across the network as voice data. The called fax machine responds by sending a CED tone.