telnyx-texml-go

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

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

Telnyx Texml - Go

Telnyx Texml - 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
已按上述方式初始化完成。

List all TeXML Applications

列出所有TeXML应用

Returns a list of your TeXML Applications.
GET /texml_applications
go
	page, err := client.TexmlApplications.List(context.TODO(), telnyx.TexmlApplicationListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)
返回你的所有TeXML应用列表。
GET /texml_applications
go
	page, err := client.TexmlApplications.List(context.TODO(), telnyx.TexmlApplicationListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Creates a TeXML Application

创建TeXML应用

Creates a TeXML Application.
POST /texml_applications
— Required:
friendly_name
,
voice_url
Optional:
active
(boolean),
anchorsite_override
(enum),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
status_callback
(uri),
status_callback_method
(enum),
tags
(array[string]),
voice_fallback_url
(uri),
voice_method
(enum)
go
	texmlApplication, err := client.TexmlApplications.New(context.TODO(), telnyx.TexmlApplicationNewParams{
		FriendlyName: "call-router",
		VoiceURL:     "https://example.com",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
创建一个TeXML应用。
POST /texml_applications
— 必填参数:
friendly_name
,
voice_url
可选参数:
active
(布尔值),
anchorsite_override
(枚举),
call_cost_in_webhooks
(布尔值),
dtmf_type
(枚举),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
inbound
(对象),
outbound
(对象),
status_callback
(URI),
status_callback_method
(枚举),
tags
(字符串数组),
voice_fallback_url
(URI),
voice_method
(枚举)
go
	texmlApplication, err := client.TexmlApplications.New(context.TODO(), telnyx.TexmlApplicationNewParams{
		FriendlyName: "call-router",
		VoiceURL:     "https://example.com",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)

Retrieve a TeXML Application

获取单个TeXML应用详情

Retrieves the details of an existing TeXML Application.
GET /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Get(context.TODO(), "1293384261075731499")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
获取现有TeXML应用的详细信息。
GET /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Get(context.TODO(), "1293384261075731499")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)

Update a TeXML Application

更新TeXML应用

Updates settings of an existing TeXML Application.
PATCH /texml_applications/{id}
— Required:
friendly_name
,
voice_url
Optional:
active
(boolean),
anchorsite_override
(enum),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
status_callback
(uri),
status_callback_method
(enum),
tags
(array[string]),
voice_fallback_url
(uri),
voice_method
(enum)
go
	texmlApplication, err := client.TexmlApplications.Update(
		context.TODO(),
		"1293384261075731499",
		telnyx.TexmlApplicationUpdateParams{
			FriendlyName: "call-router",
			VoiceURL:     "https://example.com",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
更新现有TeXML应用的设置。
PATCH /texml_applications/{id}
— 必填参数:
friendly_name
,
voice_url
可选参数:
active
(布尔值),
anchorsite_override
(枚举),
call_cost_in_webhooks
(布尔值),
dtmf_type
(枚举),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
inbound
(对象),
outbound
(对象),
status_callback
(URI),
status_callback_method
(枚举),
tags
(字符串数组),
voice_fallback_url
(URI),
voice_method
(枚举)
go
	texmlApplication, err := client.TexmlApplications.Update(
		context.TODO(),
		"1293384261075731499",
		telnyx.TexmlApplicationUpdateParams{
			FriendlyName: "call-router",
			VoiceURL:     "https://example.com",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)

Deletes a TeXML Application

删除TeXML应用

Deletes a TeXML Application.
DELETE /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Delete(context.TODO(), "1293384261075731499")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
删除一个TeXML应用。
DELETE /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Delete(context.TODO(), "1293384261075731499")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlApplication.Data)

Fetch multiple call resources

获取多个通话资源

Returns multiple call resources for an account.
GET /texml/Accounts/{account_sid}/Calls
go
	response, err := client.Texml.Accounts.Calls.GetCalls(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountCallGetCallsParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Calls)
返回账户下的多个通话资源。
GET /texml/Accounts/{account_sid}/Calls
go
	response, err := client.Texml.Accounts.Calls.GetCalls(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountCallGetCallsParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Calls)

Initiate an outbound call

发起外呼通话

Initiate an outbound TeXML call.
POST /texml/Accounts/{account_sid}/Calls
— Required:
To
,
From
,
ApplicationSid
Optional:
AsyncAmd
(boolean),
AsyncAmdStatusCallback
(string),
AsyncAmdStatusCallbackMethod
(enum),
CallerId
(string),
CancelPlaybackOnDetectMessageEnd
(boolean),
CancelPlaybackOnMachineDetection
(boolean),
CustomHeaders
(array[object]),
DetectionMode
(enum),
FallbackUrl
(string),
MachineDetection
(enum),
MachineDetectionSilenceTimeout
(integer),
MachineDetectionSpeechEndThreshold
(integer),
MachineDetectionSpeechThreshold
(integer),
MachineDetectionTimeout
(integer),
PreferredCodecs
(string),
Record
(boolean),
RecordingChannels
(enum),
RecordingStatusCallback
(string),
RecordingStatusCallbackEvent
(string),
RecordingStatusCallbackMethod
(enum),
RecordingTimeout
(integer),
RecordingTrack
(enum),
SendRecordingUrl
(boolean),
SipAuthPassword
(string),
SipAuthUsername
(string),
SipRegion
(enum),
StatusCallback
(string),
StatusCallbackEvent
(enum),
StatusCallbackMethod
(enum),
SuperviseCallSid
(string),
SupervisingRole
(enum),
Texml
(string),
TimeLimit
(integer),
Timeout
(integer),
Trim
(enum),
Url
(string),
UrlMethod
(enum)
go
	response, err := client.Texml.Accounts.Calls.Calls(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountCallCallsParams{
			ApplicationSid: "example-app-sid",
			From:           "+13120001234",
			To:             "+13121230000",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.From)
发起一个TeXML外呼通话。
POST /texml/Accounts/{account_sid}/Calls
— 必填参数:
To
,
From
,
ApplicationSid
可选参数:
AsyncAmd
(布尔值),
AsyncAmdStatusCallback
(字符串),
AsyncAmdStatusCallbackMethod
(枚举),
CallerId
(字符串),
CancelPlaybackOnDetectMessageEnd
(布尔值),
CancelPlaybackOnMachineDetection
(布尔值),
CustomHeaders
(对象数组),
DetectionMode
(枚举),
FallbackUrl
(字符串),
MachineDetection
(枚举),
MachineDetectionSilenceTimeout
(整数),
MachineDetectionSpeechEndThreshold
(整数),
MachineDetectionSpeechThreshold
(整数),
MachineDetectionTimeout
(整数),
PreferredCodecs
(字符串),
Record
(布尔值),
RecordingChannels
(枚举),
RecordingStatusCallback
(字符串),
RecordingStatusCallbackEvent
(字符串),
RecordingStatusCallbackMethod
(枚举),
RecordingTimeout
(整数),
RecordingTrack
(枚举),
SendRecordingUrl
(布尔值),
SipAuthPassword
(字符串),
SipAuthUsername
(字符串),
SipRegion
(枚举),
StatusCallback
(字符串),
StatusCallbackEvent
(枚举),
StatusCallbackMethod
(枚举),
SuperviseCallSid
(字符串),
SupervisingRole
(枚举),
Texml
(字符串),
TimeLimit
(整数),
Timeout
(整数),
Trim
(枚举),
Url
(字符串),
UrlMethod
(枚举)
go
	response, err := client.Texml.Accounts.Calls.Calls(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountCallCallsParams{
			ApplicationSid: "example-app-sid",
			From:           "+13120001234",
			To:             "+13121230000",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.From)

Fetch a call

获取单个通话详情

Returns an individual call identified by its CallSid.
GET /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Get(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallGetParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", call.AccountSid)
返回由CallSid标识的单个通话信息。
GET /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Get(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallGetParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", call.AccountSid)

Update call

更新通话信息

Update TeXML call.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Update(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallUpdateParams{
			AccountSid: "account_sid",
			UpdateCall: telnyx.UpdateCallParam{},
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", call.AccountSid)
更新TeXML通话的设置。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Update(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallUpdateParams{
			AccountSid: "account_sid",
			UpdateCall: telnyx.UpdateCallParam{},
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", call.AccountSid)

List conference participants

列出会议参与者

Lists conference participants
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
go
	response, err := client.Texml.Accounts.Conferences.Participants.GetParticipants(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantGetParticipantsParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)
列出会议的所有参与者。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
go
	response, err := client.Texml.Accounts.Conferences.Participants.GetParticipants(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantGetParticipantsParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)

Dial a new conference participant

邀请新的会议参与者

Dials a new conference participant
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
go
	response, err := client.Texml.Accounts.Conferences.Participants.Participants(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantParticipantsParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
邀请新的参与者加入会议。
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
go
	response, err := client.Texml.Accounts.Conferences.Participants.Participants(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantParticipantsParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

Get conference participant resource

获取单个会议参与者信息

Gets conference participant resource
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	participant, err := client.Texml.Accounts.Conferences.Participants.Get(
		context.TODO(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantGetParams{
			AccountSid:    "account_sid",
			ConferenceSid: "conference_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", participant.AccountSid)
获取单个会议参与者的资源信息。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	participant, err := client.Texml.Accounts.Conferences.Participants.Get(
		context.TODO(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantGetParams{
			AccountSid:    "account_sid",
			ConferenceSid: "conference_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", participant.AccountSid)

Update a conference participant

更新会议参与者信息

Updates a conference participant
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	participant, err := client.Texml.Accounts.Conferences.Participants.Update(
		context.TODO(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantUpdateParams{
			AccountSid:    "account_sid",
			ConferenceSid: "conference_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", participant.AccountSid)
更新会议参与者的设置。
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	participant, err := client.Texml.Accounts.Conferences.Participants.Update(
		context.TODO(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantUpdateParams{
			AccountSid:    "account_sid",
			ConferenceSid: "conference_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", participant.AccountSid)

Delete a conference participant

移除会议参与者

Deletes a conference participant
DELETE /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	err := client.Texml.Accounts.Conferences.Participants.Delete(
		context.TODO(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantDeleteParams{
			AccountSid:    "account_sid",
			ConferenceSid: "conference_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
移除会议中的某个参与者。
DELETE /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	err := client.Texml.Accounts.Conferences.Participants.Delete(
		context.TODO(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantDeleteParams{
			AccountSid:    "account_sid",
			ConferenceSid: "conference_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}

List conference resources

列出所有会议资源

Lists conference resources.
GET /texml/Accounts/{account_sid}/Conferences
go
	response, err := client.Texml.Accounts.Conferences.GetConferences(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountConferenceGetConferencesParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Conferences)
列出账户下的所有会议资源。
GET /texml/Accounts/{account_sid}/Conferences
go
	response, err := client.Texml.Accounts.Conferences.GetConferences(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountConferenceGetConferencesParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Conferences)

Fetch a conference resource

获取单个会议资源详情

Returns a conference resource.
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}
go
	conference, err := client.Texml.Accounts.Conferences.Get(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", conference.AccountSid)
返回单个会议的资源信息。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}
go
	conference, err := client.Texml.Accounts.Conferences.Get(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", conference.AccountSid)

Update a conference resource

更新会议资源设置

Updates a conference resource.
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}
go
	conference, err := client.Texml.Accounts.Conferences.Update(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceUpdateParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", conference.AccountSid)
更新会议资源的配置。
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}
go
	conference, err := client.Texml.Accounts.Conferences.Update(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceUpdateParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", conference.AccountSid)

List queue resources

列出所有队列资源

Lists queue resources.
GET /texml/Accounts/{account_sid}/Queues
go
	page, err := client.Texml.Accounts.Queues.List(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountQueueListParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)
列出账户下的所有队列资源。
GET /texml/Accounts/{account_sid}/Queues
go
	page, err := client.Texml.Accounts.Queues.List(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountQueueListParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Create a new queue

创建新队列

Creates a new queue resource.
POST /texml/Accounts/{account_sid}/Queues
go
	queue, err := client.Texml.Accounts.Queues.New(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountQueueNewParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", queue.AccountSid)
创建一个新的队列资源。
POST /texml/Accounts/{account_sid}/Queues
go
	queue, err := client.Texml.Accounts.Queues.New(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountQueueNewParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", queue.AccountSid)

Fetch a queue resource

获取单个队列资源详情

Returns a queue resource.
GET /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	queue, err := client.Texml.Accounts.Queues.Get(
		context.TODO(),
		"queue_sid",
		telnyx.TexmlAccountQueueGetParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", queue.AccountSid)
返回单个队列的资源信息。
GET /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	queue, err := client.Texml.Accounts.Queues.Get(
		context.TODO(),
		"queue_sid",
		telnyx.TexmlAccountQueueGetParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", queue.AccountSid)

Update a queue resource

更新队列资源设置

Updates a queue resource.
POST /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	queue, err := client.Texml.Accounts.Queues.Update(
		context.TODO(),
		"queue_sid",
		telnyx.TexmlAccountQueueUpdateParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", queue.AccountSid)
更新队列资源的配置。
POST /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	queue, err := client.Texml.Accounts.Queues.Update(
		context.TODO(),
		"queue_sid",
		telnyx.TexmlAccountQueueUpdateParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", queue.AccountSid)

Delete a queue resource

删除队列资源

Delete a queue resource.
DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	err := client.Texml.Accounts.Queues.Delete(
		context.TODO(),
		"queue_sid",
		telnyx.TexmlAccountQueueDeleteParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
删除指定的队列资源。
DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	err := client.Texml.Accounts.Queues.Delete(
		context.TODO(),
		"queue_sid",
		telnyx.TexmlAccountQueueDeleteParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}

Fetch multiple recording resources

获取多个录音资源

Returns multiple recording resources for an account.
GET /texml/Accounts/{account_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.GetRecordingsJson(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountGetRecordingsJsonParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)
返回账户下的多个录音资源。
GET /texml/Accounts/{account_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.GetRecordingsJson(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountGetRecordingsJsonParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)

Fetch recording resource

获取单个录音资源详情

Returns recording resource identified by recording id.
GET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
go
	texmlGetCallRecordingResponseBody, err := client.Texml.Accounts.Recordings.Json.GetRecordingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonGetRecordingSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlGetCallRecordingResponseBody.AccountSid)
返回由录音ID标识的单个录音资源信息。
GET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
go
	texmlGetCallRecordingResponseBody, err := client.Texml.Accounts.Recordings.Json.GetRecordingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonGetRecordingSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", texmlGetCallRecordingResponseBody.AccountSid)

Delete recording resource

删除录音资源

Deletes recording resource identified by recording id.
DELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
go
	err := client.Texml.Accounts.Recordings.Json.DeleteRecordingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonDeleteRecordingSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
删除由录音ID标识的录音资源。
DELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
go
	err := client.Texml.Accounts.Recordings.Json.DeleteRecordingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonDeleteRecordingSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}

Fetch recordings for a call

获取单个通话的所有录音

Returns recordings for a call identified by call_sid.
GET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Calls.RecordingsJson.GetRecordingsJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonGetRecordingsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)
返回由call_sid标识的通话的所有录音。
GET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Calls.RecordingsJson.GetRecordingsJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonGetRecordingsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)

Request recording for a call

发起通话录音

Starts recording with specified parameters for call idientified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Calls.RecordingsJson.RecordingsJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonRecordingsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
为指定call_sid的通话启动录音,并应用指定参数。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Calls.RecordingsJson.RecordingsJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonRecordingsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

Update recording on a call

更新通话中的录音设置

Updates recording resource for particular call.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Recordings.RecordingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallRecordingRecordingSidJsonParams{
			AccountSid: "account_sid",
			CallSid:    "call_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
更新指定通话的录音资源配置。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Recordings.RecordingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallRecordingRecordingSidJsonParams{
			AccountSid: "account_sid",
			CallSid:    "call_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

List conference recordings

列出会议的所有录音

Lists conference recordings
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings
go
	response, err := client.Texml.Accounts.Conferences.GetRecordings(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)
列出指定会议的所有录音。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings
go
	response, err := client.Texml.Accounts.Conferences.GetRecordings(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)

Fetch recordings for a conference

获取会议的所有录音

Returns recordings for a conference identified by conference_sid.
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Conferences.GetRecordingsJson(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)
返回由conference_sid标识的会议的所有录音。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Conferences.GetRecordingsJson(
		context.TODO(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)

Create a TeXML secret

创建TeXML密钥

Create a TeXML secret which can be later used as a Dynamic Parameter for TeXML when using Mustache Templates in your TeXML.
POST /texml/secrets
— Required:
name
,
value
go
	response, err := client.Texml.Secrets(context.TODO(), telnyx.TexmlSecretsParams{
		Name:  "My Secret Name",
		Value: "My Secret Value",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
创建TeXML密钥,后续可在TeXML的Mustache模板中用作动态参数。
POST /texml/secrets
— 必填参数:
name
,
value
go
	response, err := client.Texml.Secrets(context.TODO(), telnyx.TexmlSecretsParams{
		Name:  "My Secret Name",
		Value: "My Secret Value",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)

Request siprec session for a call

发起通话的SIPREC会话

Starts siprec session with specified parameters for call idientified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
go
	response, err := client.Texml.Accounts.Calls.SiprecJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallSiprecJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
为指定call_sid的通话启动SIPREC会话,并应用指定参数。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
go
	response, err := client.Texml.Accounts.Calls.SiprecJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallSiprecJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

Updates siprec session for a call

更新通话的SIPREC会话

Updates siprec session identified by siprec_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{siprec_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Siprec.SiprecSidJson(
		context.TODO(),
		"siprec_sid",
		telnyx.TexmlAccountCallSiprecSiprecSidJsonParams{
			AccountSid: "account_sid",
			CallSid:    "call_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
更新由siprec_sid标识的通话SIPREC会话。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{siprec_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Siprec.SiprecSidJson(
		context.TODO(),
		"siprec_sid",
		telnyx.TexmlAccountCallSiprecSiprecSidJsonParams{
			AccountSid: "account_sid",
			CallSid:    "call_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

Start streaming media from a call.

启动通话媒体流

Starts streaming media from a call to a specific WebSocket address.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.json
go
	response, err := client.Texml.Accounts.Calls.StreamsJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallStreamsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
启动通话媒体流,将媒体数据发送到指定的WebSocket地址。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.json
go
	response, err := client.Texml.Accounts.Calls.StreamsJson(
		context.TODO(),
		"call_sid",
		telnyx.TexmlAccountCallStreamsJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

Update streaming on a call

更新通话的媒体流设置

Updates streaming resource for particular call.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Streams.StreamingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallStreamStreamingSidJsonParams{
			AccountSid: "account_sid",
			CallSid:    "call_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
更新指定通话的媒体流资源配置。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Streams.StreamingSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallStreamStreamingSidJsonParams{
			AccountSid: "account_sid",
			CallSid:    "call_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

List recording transcriptions

列出所有录音转录资源

Returns multiple recording transcription resources for an account.
GET /texml/Accounts/{account_sid}/Transcriptions.json
go
	response, err := client.Texml.Accounts.GetTranscriptionsJson(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountGetTranscriptionsJsonParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)
返回账户下的多个录音转录资源。
GET /texml/Accounts/{account_sid}/Transcriptions.json
go
	response, err := client.Texml.Accounts.GetTranscriptionsJson(
		context.TODO(),
		"account_sid",
		telnyx.TexmlAccountGetTranscriptionsJsonParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.End)

Fetch a recording transcription resource

获取单个录音转录资源详情

Returns the recording transcription resource identified by its ID.
GET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
go
	response, err := client.Texml.Accounts.Transcriptions.Json.GetRecordingTranscriptionSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonGetRecordingTranscriptionSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回由ID标识的单个录音转录资源信息。
GET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
go
	response, err := client.Texml.Accounts.Transcriptions.Json.GetRecordingTranscriptionSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonGetRecordingTranscriptionSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.AccountSid)

Delete a recording transcription

删除录音转录资源

Permanently deletes a recording transcription.
DELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
go
	err := client.Texml.Accounts.Transcriptions.Json.DeleteRecordingTranscriptionSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonDeleteRecordingTranscriptionSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}

永久删除指定的录音转录资源。
DELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
go
	err := client.Texml.Accounts.Transcriptions.Json.DeleteRecordingTranscriptionSidJson(
		context.TODO(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonDeleteRecordingTranscriptionSidJsonParams{
			AccountSid: "account_sid",
		},
	)
	if err != nil {
		panic(err.Error())
	}

Webhooks

Webhooks

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
TexmlCallAnsweredWebhook
TeXML Call Answered. Webhook sent when a TeXML call is answered
TexmlCallCompletedWebhook
TeXML Call Completed. Webhook sent when a TeXML call is completed
TexmlCallInitiatedWebhook
TeXML Call Initiated. Webhook sent when a TeXML call is initiated
TexmlCallRingingWebhook
TeXML Call Ringing. Webhook sent when a TeXML call is ringing
TexmlCallAmdWebhook
TeXML Call AMD. Webhook sent when Answering Machine Detection (AMD) completes during a TeXML call
TexmlCallDtmfWebhook
TeXML Call DTMF. Webhook sent when a DTMF digit is received during a TeXML call
TexmlGatherWebhook
TeXML Gather. Webhook sent when a Gather command completes (sent to the action URL)
TexmlHttpRequestWebhook
TeXML HTTP Request. Webhook sent as response to an HTTP Request instruction
TexmlAiGatherWebhook
TeXML AI Gather. Webhook sent when AI Gather completes with transcription results
TexmlReferStatusWebhook
TeXML Refer Status. Webhook sent for SIP REFER status updates
TexmlConferenceJoinWebhook
TeXML Conference Join. Webhook sent when a participant joins a TeXML conference
TexmlConferenceLeaveWebhook
TeXML Conference Leave. Webhook sent when a participant leaves a TeXML conference
TexmlConferenceSpeakerWebhook
TeXML Conference Speaker. Webhook sent when a participant starts or stops speaking in a TeXML conference
TexmlConferenceEndWebhook
TeXML Conference End. Webhook sent when a TeXML conference ends
TexmlConferenceStartWebhook
TeXML Conference Start. Webhook sent when a TeXML conference starts
TexmlQueueWebhook
TeXML Queue. Webhook sent for queue status events (triggered by Enqueue command waitUrl)
TexmlRecordingCompletedWebhook
TeXML Recording Completed. Webhook sent when a recording is completed during a TeXML call (triggered by recordingStatusCallbackEvent)
TexmlRecordingInProgressWebhook
TeXML Recording In-Progress. Webhook sent when a recording starts during a TeXML call (triggered by recordingStatusCallbackEvent)
TexmlSiprecWebhook
TeXML SIPREC. Webhook sent for SIPREC session status updates
TexmlStreamWebhook
TeXML Stream. Webhook sent for media streaming status updates
TexmlTranscriptionWebhook
TeXML Transcription. Webhook sent when a recording transcription is completed
以下Webhook事件将发送到你配置的Webhook URL。所有Webhook都包含
telnyx-timestamp
telnyx-signature-ed25519
头信息用于验证(兼容标准Webhooks)。
事件描述
TexmlCallAnsweredWebhook
TeXML通话已接听:当TeXML通话被接听时发送的Webhook
TexmlCallCompletedWebhook
TeXML通话已结束:当TeXML通话完成时发送的Webhook
TexmlCallInitiatedWebhook
TeXML通话已发起:当TeXML通话被发起时发送的Webhook
TexmlCallRingingWebhook
TeXML通话正在振铃:当TeXML通话处于振铃状态时发送的Webhook
TexmlCallAmdWebhook
TeXML通话AMD检测完成:当TeXML通话的应答机器检测(AMD)完成时发送的Webhook
TexmlCallDtmfWebhook
TeXML通话DTMF信号接收:当TeXML通话中接收到DTMF按键时发送的Webhook
TexmlGatherWebhook
TeXML收集命令完成:当Gather命令执行完成时发送的Webhook(发送到action URL)
TexmlHttpRequestWebhook
TeXML HTTP请求响应:作为HTTP Request指令的响应发送的Webhook
TexmlAiGatherWebhook
TeXML AI收集完成:当AI Gather命令完成并返回转录结果时发送的Webhook
TexmlReferStatusWebhook
TeXML SIP REFER状态更新:针对SIP REFER状态变化发送的Webhook
TexmlConferenceJoinWebhook
TeXML会议参与者加入:当参与者加入TeXML会议时发送的Webhook
TexmlConferenceLeaveWebhook
TeXML会议参与者离开:当参与者离开TeXML会议时发送的Webhook
TexmlConferenceSpeakerWebhook
TeXML会议参与者发言状态变化:当TeXML会议中参与者开始或停止发言时发送的Webhook
TexmlConferenceEndWebhook
TeXML会议已结束:当TeXML会议结束时发送的Webhook
TexmlConferenceStartWebhook
TeXML会议已开始:当TeXML会议启动时发送的Webhook
TexmlQueueWebhook
TeXML队列状态更新:针对队列状态事件发送的Webhook(由Enqueue命令的waitUrl触发)
TexmlRecordingCompletedWebhook
TeXML录音已完成:当TeXML通话中的录音完成时发送的Webhook(由recordingStatusCallbackEvent触发)
TexmlRecordingInProgressWebhook
TeXML录音进行中:当TeXML通话中的录音启动时发送的Webhook(由recordingStatusCallbackEvent触发)
TexmlSiprecWebhook
TeXML SIPREC状态更新:针对SIPREC会话状态变化发送的Webhook
TexmlStreamWebhook
TeXML媒体流状态更新:针对媒体流状态变化发送的Webhook
TexmlTranscriptionWebhook
TeXML录音转录完成:当录音转录完成时发送的Webhook