# Setting up a 3G-324M session

Setting up a 3G-324M session involves the following:

- Starting the 3G-324M session

- Establishing terminal capabilities

- Handling events

## Starting the 3G-324M session

Use h324Start to start the 3G-324M session. This function does the following:

- Creates an H.245 stack for the specified MUX.

- Sets the initial values that are needed to begin an exchange with the client (such as resetting PMSYNC and the video sequence number).

## Establishing terminal capabilities

Use the following functions to establish terminal capabilities for the 3G-324M session:

Function | Description
h324SetupCall | Informs the H.324M Middleware that it can begin H.245 negotiations with the remote terminal.
h324GetTermCaps | Queries the H.324M Middleware for the 3G-324M Interface or remote terminal 3G-324M audio, video, and multiplexing capabilities.
h324SetTermCaps | Sets the local terminal capabilities and initiates the transfer of terminal capabilities (H.245 terminal capabilities exchange).

After you complete call setup, the Middleware returns one of the following events:

- H324EVN_CALL_SETUP_FAILED, if the call setup was not successful.

- H324EVN_MEDIA_SETUP_DONE, if the media was set up correctly for both audio and video.

- (MONA fast call setup only) H324EVN_FAST_CALL_SETUP_DONE notification event.

The Middleware also returns H324EVN_LCD in the following cases:

- The Middleware either accepted a unidirectional remote OLC request, or received a confirmation in the case of a bi-directional remote OLC.

- The remote terminal confirmed a bi-directional OLC request that was accepted by the Middleware.

- The Middleware received an accept response from the remote terminal.

## Handling events

The following table describes how to handle events in the 3G-324M session:

Step | Action
1 | Wait for Natural Access events by invoking ctaWaitEvent.
2 | Submit all events received from Natural Access to the H.324M Middleware by invoking h324SubmitEvent. The Middleware processes these events, and returns them to the application when relevant.
3 | Free buffers for all MSPP events that include buffers, except for those consumed by h324SubmitEvent.