Option 2: Integrate in-app, web, and video calling natively into your mobile application using the Amazon Chime SDK client APIs
To integrate Amazon Connect in-app, web, and video calling natively with your
mobile application use the Amazon Connect
StartWebRTCContact API to create the contact, and then use the details
returned by the API call to join the call using the Amazon Chime client library
for iOS
How a client device initiates an in-app or web call
The following diagram shows the sequence of events for a client device (mobile application or browser) to initiate an in-app or web call.
![A conceptual diagram that shows how a client devices initiates a call.](/images/connect/latest/adminguide/images/netra-gs-diagram.png)
-
Your customer uses the client application (website or application) to start an in-app or web call.
-
The client application (website or mobile application) or web server uses the Amazon Connect StartWebRTCContact API to start the contact passing any attributes or context to Amazon Connect.
-
The client application joins the call using the details returned from the StartWebRTCContact in step 1.
-
(Optional) Client uses the CreateParticipantConnection API to receive a
ConnectionToken
that is used to send DTMF through the SendMessage API. -
The contact reaches the flow and is routed based on the flow and placed in queue.
-
The agent accepts the contact.
-
(Optional) If video is enabled for customer and the agent, they are able to start their video.
Get started
Following are the high level steps to get started:
-
Use the StartWebRTCContact API to create the contact. The API returns the details needed for the Amazon Chime client SDK to join the call.
-
Instantiate the Amazon Chime SDK client
MeetingSessionConfiguration
object using the configurations returned by StartWebRTCContact. -
Instantiate Amazon Chime SDK client
DefaultMeetingSession
withMeetingSessionConfiguration
, which was created in step 2 to create a client meeting session.-
iOS (Swift)
let logger = ConsoleLogger(name: "logger") let meetingSession = DefaultMeetingSession(configuration: meetingSessionConfig, logger: logger)
-
Android (Kotlin)
val logger = ConsoleLogger() val meetingSession = DefaultMeetingSession( configuration = meetingSessionConfig, logger = logger, context = applicationContext )
-
-
Use the
meetingSession.audioVideo.start()
method to join the WebRTC contact with audio. -
Use the
meetingSession.audioVideo.stop()
method to hangup the WebRTC contact. -
Optional steps
-
To send DTMF to the call, two Amazon Connect Participant Service APIs are needed: CreateParticipantConnection and SendMessage respectively.
Note
contentType
for the SendMessage API must beaudio/dtmf
.-
Invoke CreateParticipantConnection to retrieve
ConnectionToken
. (ParticipantToken
is needed for calling this API. You can find it in the StartWebRTCContact response.) -
With the
ConnectionToken
, call SendMessage for sending DTMF digits.
-
-
For mute and unmute, use
meetingSession.audioVideo.realtimeLocalMute()
andmeetingSession.audioVideo.realtimeLocalUnmute()
. -
To start self video on the mobile application, use the
meetingSession.audioVideo.startLocalVideo()
-
To stop self video on the mobile application, use the
meetingSession.audioVideo.stopLocalVideo()
. -
To allow receiving and loading video of the agent inside mobile application, use the
meetingSession.audioVideo.startRemoteVideo()
. -
To disallow receiving and loading video of the agent inside mobile application, use the
meetingSession.audioVideo.stopRemoteVideo()
. -
To select the audio input/output device, you can use the methods from the Amazon Chime SDK client for Android and iOS or the native iOS capabilities
for iOS.
-