Obtain connection credentials from your application server, then use the AOQ SDK to connect, configure media tracks, and exchange session events.
Connection resources
After you connect with the AOQ SDK, use media tracks for audio and video and the data track for session commands and events. For other connection options, see the suite API reference.
AOQ access
First create a multimodal interaction application to obtain the workspace ID and application ID, then configure the application with the model, voice, and interaction mode. Import the AOQ SDK for your platform from SDK downloads. Request client permissions as needed when capturing audio or video with a microphone or camera.
Obtain connection credentials
Before each new connection, the AppServer requests temporary credentials. Replace {endpoint} with the endpoint for the workspace that contains the application, and configure the corresponding API Key on the AppServer.
clientIp) in the request body so that the gateway can select a Relay endpoint. If omitted, the gateway uses the request source IP address.
The API Key is stored only on the AppServer. The AppServer returns the connection parameters in the table below to the client. The response includes sidExpiresInSecs only if the request specifies tokenExpiresInSecs. Its value matches the requested connection token lifetime in seconds, not the session duration.
| Gateway Response Fields | AoqConnectConfig Field |
|---|---|
aoqTokenForClient | token |
sid | sid |
clientRelayCertFingerprint | certFingerprint |
clientRelayEndpoints | relayEndpoints, convert endpoint, port, and route_index item by item |
extraInfo.workspaceIdHash | workspaceIdHash |
Connect and interact
- Initialize the engine and configure tracks. Register callbacks for connection status, Data messages, and SDK errors. For audio conversations, publish Audio and Data tracks, subscribe to Audio and Data tracks, and configure audio codecs, capture, and playback. Configure an upstream Video track according to the application's input capabilities, and a downstream Video track according to its output capabilities. Disable media upload before connecting.
- Connect and start a session. Pass the connection parameters and track configuration, then wait for the SDK to report a successful connection. Send the Start instruction over the Data track, including the application and workspace information. After receiving
Started, continue waiting forDialogStateChanged. Enable audio upload only after confirming thatpayload.output.stateisListening. - Send and receive media and events. Audio and video use media tracks, while application events use the Data track. Construct requests using Input Message in the Interaction protocol, and parse session events and errors using Output Message. If video input is needed, enable the configured Video track according to the application's capabilities.
- End the session. Stop media upload and send the Stop instruction over the Data track. After receiving
Stopped, stop capture and playback, then disconnect. Release the engine resources when they are no longer needed.