telnyx-voice-gather-go

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- 由Telnyx OpenAPI规范自动生成,请勿编辑。 -->

Telnyx Voice Gather - Go

Telnyx Voice Gather - Go

Installation

安装

bash
go get github.com/team-telnyx/telnyx-go
bash
go get github.com/team-telnyx/telnyx-go

Setup

初始化设置

go
import (
  "context"
  "fmt"
  "os"

  "github.com/team-telnyx/telnyx-go"
  "github.com/team-telnyx/telnyx-go/option"
)

client := telnyx.NewClient(
  option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)
All examples below assume
client
is already initialized as shown above.
go
import (
  "context"
  "fmt"
  "os"

  "github.com/team-telnyx/telnyx-go"
  "github.com/team-telnyx/telnyx-go/option"
)

client := telnyx.NewClient(
  option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)
以下所有示例均假设
client
已按上述方式完成初始化。

Add messages to AI Assistant

向AI助手添加消息

Add messages to the conversation started by an AI assistant on the call.
POST /calls/{call_control_id}/actions/ai_assistant_add_messages
Optional:
client_state
(string),
command_id
(string),
messages
(array[object])
go
	response, err := client.Calls.Actions.AddAIAssistantMessages(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionAddAIAssistantMessagesParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
在通话中,为AI助手发起的对话添加消息。
POST /calls/{call_control_id}/actions/ai_assistant_add_messages
可选参数:
client_state
(字符串)、
command_id
(字符串)、
messages
(对象数组)
go
	response, err := client.Calls.Actions.AddAIAssistantMessages(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionAddAIAssistantMessagesParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Start AI Assistant

启动AI助手

Start an AI assistant on the call.
POST /calls/{call_control_id}/actions/ai_assistant_start
Optional:
assistant
(object),
client_state
(string),
command_id
(string),
greeting
(string),
interruption_settings
(object),
transcription
(object),
voice
(string),
voice_settings
(object)
go
	response, err := client.Calls.Actions.StartAIAssistant(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionStartAIAssistantParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
在通话中启动AI助手。
POST /calls/{call_control_id}/actions/ai_assistant_start
可选参数:
assistant
(对象)、
client_state
(字符串)、
command_id
(字符串)、
greeting
(字符串)、
interruption_settings
(对象)、
transcription
(对象)、
voice
(字符串)、
voice_settings
(对象)
go
	response, err := client.Calls.Actions.StartAIAssistant(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionStartAIAssistantParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Stop AI Assistant

停止AI助手

Stop an AI assistant on the call.
POST /calls/{call_control_id}/actions/ai_assistant_stop
Optional:
client_state
(string),
command_id
(string)
go
	response, err := client.Calls.Actions.StopAIAssistant(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionStopAIAssistantParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
在通话中停止AI助手。
POST /calls/{call_control_id}/actions/ai_assistant_stop
可选参数:
client_state
(字符串)、
command_id
(字符串)
go
	response, err := client.Calls.Actions.StopAIAssistant(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionStopAIAssistantParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Gather stop

停止收集

Stop current gather.
POST /calls/{call_control_id}/actions/gather_stop
Optional:
client_state
(string),
command_id
(string)
go
	response, err := client.Calls.Actions.StopGather(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionStopGatherParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
停止当前的收集操作。
POST /calls/{call_control_id}/actions/gather_stop
可选参数:
client_state
(字符串)、
command_id
(字符串)
go
	response, err := client.Calls.Actions.StopGather(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionStopGatherParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Gather using AI

使用AI进行收集

Gather parameters defined in the request payload using a voice assistant.
POST /calls/{call_control_id}/actions/gather_using_ai
— Required:
parameters
Optional:
assistant
(object),
client_state
(string),
command_id
(string),
gather_ended_speech
(string),
greeting
(string),
interruption_settings
(object),
language
(object),
message_history
(array[object]),
send_message_history_updates
(boolean),
send_partial_results
(boolean),
transcription
(object),
user_response_timeout_ms
(integer),
voice
(string),
voice_settings
(object)
go
	response, err := client.Calls.Actions.GatherUsingAI(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherUsingAIParams{
			Parameters: map[string]any{
				"properties": "bar",
				"required":   "bar",
				"type":       "bar",
			},
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
通过语音助手收集请求负载中定义的参数信息。
POST /calls/{call_control_id}/actions/gather_using_ai
— 必填参数:
parameters
可选参数:
assistant
(对象)、
client_state
(字符串)、
command_id
(字符串)、
gather_ended_speech
(字符串)、
greeting
(字符串)、
interruption_settings
(对象)、
language
(对象)、
message_history
(对象数组)、
send_message_history_updates
(布尔值)、
send_partial_results
(布尔值)、
transcription
(对象)、
user_response_timeout_ms
(整数)、
voice
(字符串)、
voice_settings
(对象)
go
	response, err := client.Calls.Actions.GatherUsingAI(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherUsingAIParams{
			Parameters: map[string]any{
				"properties": "bar",
				"required":   "bar",
				"type":       "bar",
			},
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Gather using audio

使用音频进行收集

Play an audio file on the call until the required DTMF signals are gathered to build interactive menus.
POST /calls/{call_control_id}/actions/gather_using_audio
Optional:
audio_url
(string),
client_state
(string),
command_id
(string),
inter_digit_timeout_millis
(int32),
invalid_audio_url
(string),
invalid_media_name
(string),
maximum_digits
(int32),
maximum_tries
(int32),
media_name
(string),
minimum_digits
(int32),
terminating_digit
(string),
timeout_millis
(int32),
valid_digits
(string)
go
	response, err := client.Calls.Actions.GatherUsingAudio(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherUsingAudioParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
在通话中播放音频文件,直到收集到所需的DTMF信号,以此构建交互式菜单。
POST /calls/{call_control_id}/actions/gather_using_audio
可选参数:
audio_url
(字符串)、
client_state
(字符串)、
command_id
(字符串)、
inter_digit_timeout_millis
(32位整数)、
invalid_audio_url
(字符串)、
invalid_media_name
(字符串)、
maximum_digits
(32位整数)、
maximum_tries
(32位整数)、
media_name
(字符串)、
minimum_digits
(32位整数)、
terminating_digit
(字符串)、
timeout_millis
(32位整数)、
valid_digits
(字符串)
go
	response, err := client.Calls.Actions.GatherUsingAudio(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherUsingAudioParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Gather using speak

使用语音播报进行收集

Convert text to speech and play it on the call until the required DTMF signals are gathered to build interactive menus.
POST /calls/{call_control_id}/actions/gather_using_speak
— Required:
voice
,
payload
Optional:
client_state
(string),
command_id
(string),
inter_digit_timeout_millis
(int32),
invalid_payload
(string),
language
(enum),
maximum_digits
(int32),
maximum_tries
(int32),
minimum_digits
(int32),
payload_type
(enum),
service_level
(enum),
terminating_digit
(string),
timeout_millis
(int32),
valid_digits
(string),
voice_settings
(object)
go
	response, err := client.Calls.Actions.GatherUsingSpeak(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherUsingSpeakParams{
			Payload: "say this on call",
			Voice:   "male",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
将文本转换为语音并在通话中播放,直到收集到所需的DTMF信号,以此构建交互式菜单。
POST /calls/{call_control_id}/actions/gather_using_speak
— 必填参数:
voice
payload
可选参数:
client_state
(字符串)、
command_id
(字符串)、
inter_digit_timeout_millis
(32位整数)、
invalid_payload
(字符串)、
language
(枚举类型)、
maximum_digits
(32位整数)、
maximum_tries
(32位整数)、
minimum_digits
(32位整数)、
payload_type
(枚举类型)、
service_level
(枚举类型)、
terminating_digit
(字符串)、
timeout_millis
(32位整数)、
valid_digits
(字符串)、
voice_settings
(对象)
go
	response, err := client.Calls.Actions.GatherUsingSpeak(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherUsingSpeakParams{
			Payload: "say this on call",
			Voice:   "male",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Gather

标准收集

Gather DTMF signals to build interactive menus.
POST /calls/{call_control_id}/actions/gather
Optional:
client_state
(string),
command_id
(string),
gather_id
(string),
initial_timeout_millis
(int32),
inter_digit_timeout_millis
(int32),
maximum_digits
(int32),
minimum_digits
(int32),
terminating_digit
(string),
timeout_millis
(int32),
valid_digits
(string)
go
	response, err := client.Calls.Actions.Gather(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

收集DTMF信号以构建交互式菜单。
POST /calls/{call_control_id}/actions/gather
可选参数:
client_state
(字符串)、
command_id
(字符串)、
gather_id
(字符串)、
initial_timeout_millis
(32位整数)、
inter_digit_timeout_millis
(32位整数)、
maximum_digits
(32位整数)、
minimum_digits
(32位整数)、
terminating_digit
(字符串)、
timeout_millis
(32位整数)、
valid_digits
(字符串)
go
	response, err := client.Calls.Actions.Gather(
		context.TODO(),
		"call_control_id",
		telnyx.CallActionGatherParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Webhooks

Webhook

The following webhook events are sent to your configured webhook URL. All webhooks include
telnyx-timestamp
and
telnyx-signature-ed25519
headers for verification (Standard Webhooks compatible).
EventDescription
callGatherEnded
Call Gather Ended
CallAIGatherEnded
Call AI Gather Ended
CallAIGatherMessageHistoryUpdated
Call AI Gather Message History Updated
CallAIGatherPartialResults
Call AI Gather Partial Results
CallConversationEnded
Call Conversation Ended
callPlaybackStarted
Call Playback Started
callPlaybackEnded
Call Playback Ended
callDtmfReceived
Call Dtmf Received
以下Webhook事件将发送至您配置的Webhook URL。所有Webhook均包含
telnyx-timestamp
telnyx-signature-ed25519
头信息用于验证(兼容标准Webhook)。
事件描述
callGatherEnded
通话收集操作结束
CallAIGatherEnded
通话AI收集操作结束
CallAIGatherMessageHistoryUpdated
通话AI收集消息历史更新
CallAIGatherPartialResults
通话AI收集部分结果
CallConversationEnded
通话对话结束
callPlaybackStarted
通话音频播放开始
callPlaybackEnded
通话音频播放结束
callDtmfReceived
通话收到DTMF信号

Webhook payload fields

Webhook负载字段

callGatherEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.digits
stringThe received DTMF digit or symbol.
data.payload.status
enumReflects how command ended.
CallAIGatherEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringTelnyx connection ID used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.message_history
array[object]The history of the messages exchanged during the AI gather
data.payload.result
objectThe result of the AI gather, its type depends of the
parameters
provided in the command
data.payload.status
enumReflects how command ended.
CallAIGatherMessageHistoryUpdated
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringTelnyx connection ID used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.message_history
array[object]The history of the messages exchanged during the AI gather
CallAIGatherPartialResults
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringTelnyx connection ID used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.message_history
array[object]The history of the messages exchanged during the AI gather
data.payload.partial_results
objectThe partial result of the AI gather, its type depends of the
parameters
provided in the command
CallConversationEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidUnique identifier for the event.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.created_at
date-timeTimestamp when the event was created in the system.
data.payload.assistant_id
stringUnique identifier of the assistant involved in the call.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call leg.
data.payload.call_session_id
stringID that is unique to the call session (group of related call legs).
data.payload.client_state
stringBase64-encoded state received from a command.
data.payload.calling_party_type
enumThe type of calling party connection.
data.payload.conversation_id
stringID unique to the conversation or insight group generated for the call.
data.payload.duration_sec
integerDuration of the conversation in seconds.
data.payload.from
stringThe caller's number or identifier.
data.payload.to
stringThe callee's number or SIP address.
data.payload.llm_model
stringThe large language model used during the conversation.
data.payload.stt_model
stringThe speech-to-text model used in the conversation.
data.payload.tts_provider
stringThe text-to-speech provider used in the call.
data.payload.tts_model_id
stringThe model ID used for text-to-speech synthesis.
data.payload.tts_voice_id
stringVoice ID used for TTS.
callPlaybackStarted
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.media_url
stringThe audio URL being played back, if audio_url has been used to start.
data.payload.media_name
stringThe name of the audio media file being played back, if media_name has been used to start.
data.payload.overlay
booleanWhether the audio is going to be played in overlay mode or not.
callPlaybackEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.media_url
stringThe audio URL being played back, if audio_url has been used to start.
data.payload.media_name
stringThe name of the audio media file being played back, if media_name has been used to start.
data.payload.overlay
booleanWhether the stopped audio was in overlay mode or not.
data.payload.status
enumReflects how command ended.
data.payload.status_detail
stringProvides details in case of failure.
callDtmfReceived
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringIdentifies the type of resource.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.digit
stringThe received DTMF digit or symbol.
callGatherEnded
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID标识资源的类型。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串通话中使用的Call Control App ID(原Telnyx连接ID)。
data.payload.call_leg_id
字符串通话的唯一标识ID,可用于关联Webhook事件。
data.payload.call_session_id
字符串通话会话的唯一标识ID,可用于关联Webhook事件。
data.payload.client_state
字符串从命令中接收的状态信息。
data.payload.from
字符串发起通话的号码或SIP URI。
data.payload.to
字符串通话的目标号码或SIP URI。
data.payload.digits
字符串接收到的DTMF数字或符号。
data.payload.status
枚举类型反映命令的结束方式。
CallAIGatherEnded
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID标识资源的类型。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串通话中使用的Telnyx连接ID。
data.payload.call_leg_id
字符串通话的唯一标识ID,可用于关联Webhook事件。
data.payload.call_session_id
字符串通话会话的唯一标识ID,可用于关联Webhook事件。
data.payload.client_state
字符串从命令中接收的状态信息。
data.payload.from
字符串发起通话的号码或SIP URI。
data.payload.to
字符串通话的目标号码或SIP URI。
data.payload.message_history
对象数组AI收集过程中交换的消息历史记录
data.payload.result
对象AI收集的结果,其类型取决于命令中提供的
parameters
参数
data.payload.status
枚举类型反映命令的结束方式。
CallAIGatherMessageHistoryUpdated
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID标识资源的类型。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串通话中使用的Telnyx连接ID。
data.payload.call_leg_id
字符串通话的唯一标识ID,可用于关联Webhook事件。
data.payload.call_session_id
字符串通话会话的唯一标识ID,可用于关联Webhook事件。
data.payload.client_state
字符串从命令中接收的状态信息。
data.payload.from
字符串发起通话的号码或SIP URI。
data.payload.to
字符串通话的目标号码或SIP URI。
data.payload.message_history
对象数组AI收集过程中交换的消息历史记录
CallAIGatherPartialResults
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID标识资源的类型。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串通话中使用的Telnyx连接ID。
data.payload.call_leg_id
字符串通话的唯一标识ID,可用于关联Webhook事件。
data.payload.call_session_id
字符串通话会话的唯一标识ID,可用于关联Webhook事件。
data.payload.client_state
字符串从命令中接收的状态信息。
data.payload.from
字符串发起通话的号码或SIP URI。
data.payload.to
字符串通话的目标号码或SIP URI。
data.payload.message_history
对象数组AI收集过程中交换的消息历史记录
data.payload.partial_results
对象AI收集的部分结果,其类型取决于命令中提供的
parameters
参数
CallConversationEnded
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID事件的唯一标识符。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.created_at
日期时间事件在系统中创建的时间戳。
data.payload.assistant_id
字符串通话中涉及的AI助手的唯一标识符。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串通话中使用的Call Control App ID(原Telnyx连接ID)。
data.payload.call_leg_id
字符串通话支路的唯一标识ID。
data.payload.call_session_id
字符串通话会话(一组相关通话支路)的唯一标识ID。
data.payload.client_state
字符串从命令中接收的Base64编码状态信息。
data.payload.calling_party_type
枚举类型主叫方连接的类型。
data.payload.conversation_id
字符串为通话生成的对话或洞察组的唯一ID。
data.payload.duration_sec
整数对话持续的秒数。
data.payload.from
字符串来电者的号码或标识符。
data.payload.to
字符串被叫者的号码或SIP地址。
data.payload.llm_model
字符串对话中使用的大语言模型。
data.payload.stt_model
字符串对话中使用的语音转文本模型。
data.payload.tts_provider
字符串通话中使用的文本转语音服务提供商。
data.payload.tts_model_id
字符串用于文本转语音合成的模型ID。
data.payload.tts_voice_id
字符串用于TTS的语音ID。
callPlaybackStarted
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID标识资源的类型。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串通话中使用的Call Control App ID(原Telnyx连接ID)。
data.payload.call_leg_id
字符串通话的唯一标识ID,可用于关联Webhook事件。
data.payload.call_session_id
字符串通话会话的唯一标识ID,可用于关联Webhook事件。
data.payload.client_state
字符串从命令中接收的状态信息。
data.payload.media_url
字符串正在播放的音频URL(如果使用audio_url启动播放)。
data.payload.media_name
字符串正在播放的音频媒体文件名称(如果使用media_name启动播放)。
data.payload.overlay
布尔值音频是否将以叠加模式播放。
callPlaybackEnded
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID标识资源的类型。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串通话中使用的Call Control App ID(原Telnyx连接ID)。
data.payload.call_leg_id
字符串通话的唯一标识ID,可用于关联Webhook事件。
data.payload.call_session_id
字符串通话会话的唯一标识ID,可用于关联Webhook事件。
data.payload.client_state
字符串从命令中接收的状态信息。
data.payload.media_url
字符串正在播放的音频URL(如果使用audio_url启动播放)。
data.payload.media_name
字符串正在播放的音频媒体文件名称(如果使用media_name启动播放)。
data.payload.overlay
布尔值已停止的音频是否处于叠加模式。
data.payload.status
枚举类型反映命令的结束方式。
data.payload.status_detail
字符串失败情况下的详细信息。
callDtmfReceived
字段类型描述
data.record_type
枚举类型标识资源的类型。
data.event_type
枚举类型所传递的事件类型。
data.id
UUID标识资源的类型。
data.occurred_at
日期时间事件发生的ISO 8601格式时间戳。
data.payload.call_control_id
字符串用于通过Call Control API下发命令的通话ID。
data.payload.connection_id
字符串标识资源的类型。
data.payload.call_leg_id
字符串通话的唯一标识ID,可用于关联Webhook事件。
data.payload.call_session_id
字符串通话会话的唯一标识ID,可用于关联Webhook事件。
data.payload.client_state
字符串从命令中接收的状态信息。
data.payload.from
字符串发起通话的号码或SIP URI。
data.payload.to
字符串通话的目标号码或SIP URI。
data.payload.digit
字符串接收到的DTMF数字或符号。