Amir
Amir

Reputation: 352

Implement ESL in amazon connect

In Amazon connect, I need to pass call flow to an external application via a socket and control the call from that application .

Something like ESL in Freeswitch: Event Socket Library

For those who do not know what ESL is, it pass the call to a socket in external application and get command from that application like Play, Disconnect

And then all commands are available in ESL library in Freeswitch.

Does amazon connect have such ability?

Thanks

Upvotes: 2

Views: 247

Answers (1)

Yasen
Yasen

Reputation: 4504

Yes, you can start connection using websockets

As per AWS manual for the Amazon Connect Participant Service:

Method CreateParticipantConnection creates the participant's connection. Note that ParticipantToken is used for invoking this API instead of ConnectionToken.

The response URL for WEBSOCKET Type has a connect expiry timeout of 100s. Clients must manually connect to the returned websocket URL and subscribe to the desired topic.

Upon websocket URL expiry, as specified in the response ConnectionExpiry parameter, clients need to call this API again to obtain a new websocket URL and perform the same steps as before.

Request Syntax

``POST /participant/connection HTTP/1.1 X-Amz-Bearer: ParticipantToken Content-type: application/json

{ "Type": [ "string" ] }``

URI Request Parameters

The request uses the following URI parameters.

ParticipantToken

This is a header parameter.

The Participant Token as obtained from StartChatContact API response.

Length Constraints: Minimum length of 1. Maximum length of 1000.

Required: Yes

Request Body

The request accepts the following data in JSON format.

Type

Type of connection information required.

Type: Array of strings

Array Members: Minimum number of 1 item.

Valid Values: WEBSOCKET | CONNECTION_CREDENTIALS

Sample GO code

Source

type CreateParticipantConnectionInput struct {

    // This is a header parameter.
    //
    // The Participant Token as obtained from StartChatContact (https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html)
    // API response.
    //
    // ParticipantToken is a required field
    ParticipantToken *string `location:"header" locationName:"X-Amz-Bearer" min:"1" type:"string" required:"true"`

    // Type of connection information required.
    //
    // Type is a required field
    Type []*string `min:"1" type:"list" required:"true"`
    // contains filtered or unexported fields
}
type CreateParticipantConnectionOutput struct {

    // Creates the participant's connection credentials. The authentication token
    // associated with the participant's connection.
    ConnectionCredentials *ConnectionCredentials `type:"structure"`

    // Creates the participant's websocket connection.
    Websocket *Websocket `type:"structure"`
    // contains filtered or unexported fields
}


var params CreateParticipantConnectionInput;
mySession := session.Must(session.NewSession())

// Create a ConnectParticipant client from just a session.
client := connectparticipant.New(mySession)

// Create a ConnectParticipant client with additional configuration
client := connectparticipant.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

params.ParticipantToken := getToken();// The Participant Token as obtained from StartChatContact (https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html) 
req, resp := client.CreateParticipantConnection(params);

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

ESL alternative

As for your question:

It pass the call to a socket in external application and get command from that application like Play, Disconnect And then all commands are available in ESL library in Freeswitch

AWS are unlikely to plan this functionality.

Upvotes: 2

Related Questions