在亚马逊连接中,我需要通过套接字将调用流传递给外部应用程序,并控制来自该应用程序的调用。
类似于ESL in Freeswitch:事件套接字库
对于那些不知道ESL是什么的人,它在外部应用程序中传递对套接字的调用,并从该应用程序获得命令,比如Play、Disconnect。
然后,所有命令都在ESL库中的Freeswitch中可用。
亚马逊联网有这样的能力吗?
谢谢
发布于 2021-09-18 16:10:34
是的,您可以使用websockets启动连接。
根据AWS手册为Amazon Connect Participant Service
方法
CreateParticipantConnection创建参与者的连接。请注意,ParticipantToken用于调用此API,而不是ConnectionToken。WEBSOCKET类型的响应URL的连接过期超时为100。客户端必须手动连接到返回的websocket并订阅所需的主题。 在websocket到期时,如响应ConnectionExpiry参数中指定的那样,客户端需要再次调用此API以获得新的websocket并执行与前面相同的步骤。 请求语法POST /participant/connection HTTP/1.1 X-Amz-Bearer: `ParticipantToken` Content-type: application/json { "[Type](https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_CreateParticipantConnection.html#connectparticipant-CreateParticipantConnection-request-Type)": [ "`string`" ] }URI请求参数 请求使用以下URI参数。 ParticipantToken 这是一个标头参数。 从StartChatContact API响应中获得的参与者令牌。 长度约束:最小长度为1。最大长度为1000。 要求:是 请求体 请求接受以下JSON格式的数据。 类型 所需连接信息的类型。 类型:字符串数组 数组成员:最少一个项的数目。 有效值:WEBSOCKET | CONNECTION_CREDENTIALS
样本GO码
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替代方案
至于你的问题:
它在外部应用程序中传递对套接字的调用,并从该应用程序(如
Play、Disconnect)获取命令,然后在Freeswitch的ESL库中提供所有命令。
AWS不太可能计划此功能。
https://stackoverflow.com/questions/69235667
复制相似问题