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

Error Handling

错误处理

All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
go
import "errors"

result, err := client.Messages.Send(ctx, params)
if err != nil {
  var apiErr *telnyx.Error
  if errors.As(err, &apiErr) {
    switch apiErr.StatusCode {
    case 422:
      fmt.Println("Validation error — check required fields and formats")
    case 429:
      // Rate limited — wait and retry with exponential backoff
      fmt.Println("Rate limited, retrying...")
    default:
      fmt.Printf("API error %d: %s\n", apiErr.StatusCode, apiErr.Error())
    }
  } else {
    fmt.Println("Network error — check connectivity and retry")
  }
}
Common error codes:
401
invalid API key,
403
insufficient permissions,
404
resource not found,
422
validation error (check field formats),
429
rate limited (retry with exponential backoff).
所有API调用都可能失败,原因包括网络错误、限流(429)、验证错误(422)或身份认证错误(401)。在生产环境代码中请务必做好错误处理:
go
import "errors"

result, err := client.Messages.Send(ctx, params)
if err != nil {
  var apiErr *telnyx.Error
  if errors.As(err, &apiErr) {
    switch apiErr.StatusCode {
    case 422:
      fmt.Println("Validation error — check required fields and formats")
    case 429:
      // Rate limited — wait and retry with exponential backoff
      fmt.Println("Rate limited, retrying...")
    default:
      fmt.Printf("API error %d: %s\n", apiErr.StatusCode, apiErr.Error())
    }
  } else {
    fmt.Println("Network error — check connectivity and retry")
  }
}
常见错误码:
401
API密钥无效,
403
权限不足,
404
资源不存在,
422
验证错误(请检查字段格式),
429
触发限流(请使用指数退避策略重试)。

Important Notes

重要说明

  • Pagination: Use
    ListAutoPaging()
    for automatic iteration:
    iter := client.Resource.ListAutoPaging(ctx, params); for iter.Next() { item := iter.Current() }
    .
  • 分页: 使用
    ListAutoPaging()
    实现自动遍历:
    iter := client.Resource.ListAutoPaging(ctx, params); for iter.Next() { item := iter.Current() }

Fetch multiple call resources

获取多个通话资源

Returns multiple call resources for an account. This endpoint is eventually consistent.
GET /texml/Accounts/{account_sid}/Calls
go
	response, err := client.Texml.Accounts.Calls.GetCalls(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountCallGetCallsParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.Calls)
Returns:
calls
(array[object]),
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
start
(integer),
uri
(string)
返回当前账号下的多个通话资源,该接口为最终一致性。
GET /texml/Accounts/{account_sid}/Calls
go
	response, err := client.Texml.Accounts.Calls.GetCalls(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountCallGetCallsParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.Calls)
返回参数:
calls
(对象数组),
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
start
(整数),
uri
(字符串)

Initiate an outbound call

发起外呼

Initiate an outbound TeXML call. Telnyx will request TeXML from the XML Request URL configured for the connection in the Mission Control Portal.
POST /texml/Accounts/{account_sid}/Calls
— Required:
To
,
From
,
ApplicationSid
Optional:
AsyncAmd
(boolean),
AsyncAmdStatusCallback
(string),
AsyncAmdStatusCallbackMethod
(enum: GET, POST),
CallerId
(string),
CancelPlaybackOnDetectMessageEnd
(boolean),
CancelPlaybackOnMachineDetection
(boolean),
CustomHeaders
(array[object]),
DetectionMode
(enum: Premium, Regular),
FallbackUrl
(string),
MachineDetection
(enum: Enable, Disable, DetectMessageEnd),
MachineDetectionSilenceTimeout
(integer),
MachineDetectionSpeechEndThreshold
(integer),
MachineDetectionSpeechThreshold
(integer),
MachineDetectionTimeout
(integer),
PreferredCodecs
(string),
Record
(boolean),
RecordingChannels
(enum: mono, dual),
RecordingStatusCallback
(string),
RecordingStatusCallbackEvent
(string),
RecordingStatusCallbackMethod
(enum: GET, POST),
RecordingTimeout
(integer),
RecordingTrack
(enum: inbound, outbound, both),
SendRecordingUrl
(boolean),
SipAuthPassword
(string),
SipAuthUsername
(string),
SipRegion
(enum: US, Europe, Canada, Australia, Middle East),
StatusCallback
(string),
StatusCallbackEvent
(enum: initiated, ringing, answered, completed),
StatusCallbackMethod
(enum: GET, POST),
SuperviseCallSid
(string),
SupervisingRole
(enum: barge, whisper, monitor),
Texml
(string),
TimeLimit
(integer),
Timeout
(integer),
Trim
(enum: trim-silence, do-not-trim),
Url
(string),
UrlMethod
(enum: GET, POST)
go
	response, err := client.Texml.Accounts.Calls.Calls(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountCallCallsParams{
			ApplicationSid: "example-app-sid",
			From:           "+13120001234",
			To:             "+13121230000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.From)
Returns:
from
(string),
status
(string),
to
(string)
发起一个TeXML外呼,Telnyx会从Mission Control Portal中为该连接配置的XML请求地址获取TeXML内容。
POST /texml/Accounts/{account_sid}/Calls
— 必填参数:
To
,
From
,
ApplicationSid
可选参数:
AsyncAmd
(布尔值),
AsyncAmdStatusCallback
(字符串),
AsyncAmdStatusCallbackMethod
(枚举值: GET, POST),
CallerId
(字符串),
CancelPlaybackOnDetectMessageEnd
(布尔值),
CancelPlaybackOnMachineDetection
(布尔值),
CustomHeaders
(对象数组),
DetectionMode
(枚举值: Premium, Regular),
FallbackUrl
(字符串),
MachineDetection
(枚举值: Enable, Disable, DetectMessageEnd),
MachineDetectionSilenceTimeout
(整数),
MachineDetectionSpeechEndThreshold
(整数),
MachineDetectionSpeechThreshold
(整数),
MachineDetectionTimeout
(整数),
PreferredCodecs
(字符串),
Record
(布尔值),
RecordingChannels
(枚举值: mono, dual),
RecordingStatusCallback
(字符串),
RecordingStatusCallbackEvent
(字符串),
RecordingStatusCallbackMethod
(枚举值: GET, POST),
RecordingTimeout
(整数),
RecordingTrack
(枚举值: inbound, outbound, both),
SendRecordingUrl
(布尔值),
SipAuthPassword
(字符串),
SipAuthUsername
(字符串),
SipRegion
(枚举值: US, Europe, Canada, Australia, Middle East),
StatusCallback
(字符串),
StatusCallbackEvent
(枚举值: initiated, ringing, answered, completed),
StatusCallbackMethod
(枚举值: GET, POST),
SuperviseCallSid
(字符串),
SupervisingRole
(枚举值: barge, whisper, monitor),
Texml
(字符串),
TimeLimit
(整数),
Timeout
(整数),
Trim
(枚举值: trim-silence, do-not-trim),
Url
(字符串),
UrlMethod
(枚举值: GET, POST)
go
	response, err := client.Texml.Accounts.Calls.Calls(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountCallCallsParams{
			ApplicationSid: "example-app-sid",
			From:           "+13120001234",
			To:             "+13121230000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.From)
返回参数:
from
(字符串),
status
(字符串),
to
(字符串)

Fetch a call

获取单个通话信息

Returns an individual call identified by its CallSid. This endpoint is eventually consistent.
GET /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Get(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", call.AccountSid)
Returns:
account_sid
(string),
answered_by
(enum: human, machine, not_sure),
caller_name
(string),
date_created
(string),
date_updated
(string),
direction
(enum: inbound, outbound),
duration
(string),
end_time
(string),
from
(string),
from_formatted
(string),
price
(string),
price_unit
(string),
sid
(string),
start_time
(string),
status
(enum: ringing, in-progress, canceled, completed, failed, busy, no-answer),
to
(string),
to_formatted
(string),
uri
(string)
根据CallSid返回对应通话的详情,该接口为最终一致性。
GET /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Get(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", call.AccountSid)
返回参数:
account_sid
(字符串),
answered_by
(枚举值: human, machine, not_sure),
caller_name
(字符串),
date_created
(字符串),
date_updated
(字符串),
direction
(枚举值: inbound, outbound),
duration
(字符串),
end_time
(字符串),
from
(字符串),
from_formatted
(字符串),
price
(字符串),
price_unit
(字符串),
sid
(字符串),
start_time
(字符串),
status
(枚举值: ringing, in-progress, canceled, completed, failed, busy, no-answer),
to
(字符串),
to_formatted
(字符串),
uri
(字符串)

Update call

更新通话信息

Update TeXML call. Please note that the keys present in the payload MUST BE formatted in CamelCase as specified in the example.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Update(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			UpdateCall: telnyx.UpdateCallParam{},
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", call.AccountSid)
Returns:
account_sid
(string),
answered_by
(enum: human, machine, not_sure),
caller_name
(string),
date_created
(string),
date_updated
(string),
direction
(enum: inbound, outbound),
duration
(string),
end_time
(string),
from
(string),
from_formatted
(string),
price
(string),
price_unit
(string),
sid
(string),
start_time
(string),
status
(enum: ringing, in-progress, canceled, completed, failed, busy, no-answer),
to
(string),
to_formatted
(string),
uri
(string)
更新TeXML通话信息,请注意请求体中的键必须按照示例所示使用驼峰命名格式。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}
go
	call, err := client.Texml.Accounts.Calls.Update(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			UpdateCall: telnyx.UpdateCallParam{},
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", call.AccountSid)
返回参数:
account_sid
(字符串),
answered_by
(枚举值: human, machine, not_sure),
caller_name
(字符串),
date_created
(字符串),
date_updated
(字符串),
direction
(枚举值: inbound, outbound),
duration
(字符串),
end_time
(字符串),
from
(字符串),
from_formatted
(字符串),
price
(字符串),
price_unit
(字符串),
sid
(字符串),
start_time
(字符串),
status
(枚举值: ringing, in-progress, canceled, completed, failed, busy, no-answer),
to
(字符串),
to_formatted
(字符串),
uri
(字符串)

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.Background(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonGetRecordingsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
recordings
(array[object]),
start
(integer),
uri
(string)
根据call_sid返回对应通话的录音列表。
GET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Calls.RecordingsJson.GetRecordingsJson(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonGetRecordingsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
返回参数:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
recordings
(对象数组),
start
(整数),
uri
(字符串)

Request recording for a call

为通话开启录音

Starts recording with specified parameters for call identified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Calls.RecordingsJson.RecordingsJson(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonRecordingsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
channels
(enum: 1, 2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
error_code
(string | null),
price
(string | null),
price_unit
(string | null),
sid
(string),
source
(enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(date-time),
track
(enum: inbound, outbound, both),
uri
(string)
根据指定参数为对应call_sid的通话开启录音。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Calls.RecordingsJson.RecordingsJson(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallRecordingsJsonRecordingsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
channels
(枚举值: 1, 2),
conference_sid
(uuid),
date_created
(日期时间),
date_updated
(日期时间),
duration
(字符串 | 空),
error_code
(字符串 | 空),
price
(字符串 | 空),
price_unit
(字符串 | 空),
sid
(字符串),
source
(枚举值: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(日期时间),
track
(枚举值: inbound, outbound, both),
uri
(字符串)

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.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallRecordingRecordingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			CallSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
channels
(enum: 1, 2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
error_code
(string | null),
price
(string | null),
price_unit
(string | null),
sid
(string),
source
(enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(date-time),
track
(enum: inbound, outbound, both),
uri
(string)
更新指定通话的录音资源。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Recordings.RecordingSidJson(
		context.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallRecordingRecordingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			CallSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
channels
(枚举值: 1, 2),
conference_sid
(uuid),
date_created
(日期时间),
date_updated
(日期时间),
duration
(字符串 | 空),
error_code
(字符串 | 空),
price
(字符串 | 空),
price_unit
(字符串 | 空),
sid
(字符串),
source
(枚举值: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(日期时间),
track
(枚举值: inbound, outbound, both),
uri
(字符串)

Request siprec session for a call

为通话开启siprec会话

Starts siprec session with specified parameters for call identified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
go
	response, err := client.Texml.Accounts.Calls.SiprecJson(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallSiprecJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
date_created
(string),
date_updated
(string),
error_code
(string),
sid
(string),
start_time
(string),
status
(enum: in-progress, stopped),
track
(enum: both_tracks, inbound_track, outbound_track),
uri
(string)
根据指定参数为对应call_sid的通话开启siprec会话。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
go
	response, err := client.Texml.Accounts.Calls.SiprecJson(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallSiprecJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
date_created
(字符串),
date_updated
(字符串),
error_code
(字符串),
sid
(字符串),
start_time
(字符串),
status
(枚举值: in-progress, stopped),
track
(枚举值: both_tracks, inbound_track, outbound_track),
uri
(字符串)

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.Background(),
		"siprec_sid",
		telnyx.TexmlAccountCallSiprecSiprecSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			CallSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
date_updated
(string),
error_code
(string),
sid
(string),
status
(enum: in-progress, stopped),
uri
(string)
根据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.Background(),
		"siprec_sid",
		telnyx.TexmlAccountCallSiprecSiprecSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			CallSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
date_updated
(字符串),
error_code
(字符串),
sid
(字符串),
status
(枚举值: in-progress, stopped),
uri
(字符串)

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.Background(),
		"call_sid",
		telnyx.TexmlAccountCallStreamsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
date_updated
(date-time),
name
(string),
sid
(string),
status
(enum: in-progress),
uri
(string)
将通话的媒体流推送到指定的WebSocket地址。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.json
go
	response, err := client.Texml.Accounts.Calls.StreamsJson(
		context.Background(),
		"call_sid",
		telnyx.TexmlAccountCallStreamsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
date_updated
(日期时间),
name
(字符串),
sid
(字符串),
status
(枚举值: in-progress),
uri
(字符串)

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.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallStreamStreamingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			CallSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
date_updated
(date-time),
sid
(string),
status
(enum: stopped),
uri
(string)
更新指定通话的媒体流资源。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.json
go
	response, err := client.Texml.Accounts.Calls.Streams.StreamingSidJson(
		context.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountCallStreamStreamingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			CallSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
date_updated
(日期时间),
sid
(字符串),
status
(枚举值: stopped),
uri
(字符串)

List conference resources

获取会议资源列表

Lists conference resources.
GET /texml/Accounts/{account_sid}/Conferences
go
	response, err := client.Texml.Accounts.Conferences.GetConferences(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountConferenceGetConferencesParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.Conferences)
Returns:
conferences
(array[object]),
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
start
(integer),
uri
(string)
获取所有会议资源列表。
GET /texml/Accounts/{account_sid}/Conferences
go
	response, err := client.Texml.Accounts.Conferences.GetConferences(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountConferenceGetConferencesParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.Conferences)
返回参数:
conferences
(对象数组),
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
start
(整数),
uri
(字符串)

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.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", conference.AccountSid)
Returns:
account_sid
(string),
api_version
(string),
call_sid_ending_conference
(string),
date_created
(string),
date_updated
(string),
friendly_name
(string),
reason_conference_ended
(enum: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded),
region
(string),
sid
(string),
status
(enum: init, in-progress, completed),
subresource_uris
(object),
uri
(string)
返回指定会议的详情。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}
go
	conference, err := client.Texml.Accounts.Conferences.Get(
		context.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", conference.AccountSid)
返回参数:
account_sid
(字符串),
api_version
(字符串),
call_sid_ending_conference
(字符串),
date_created
(字符串),
date_updated
(字符串),
friendly_name
(字符串),
reason_conference_ended
(枚举值: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded),
region
(字符串),
sid
(字符串),
status
(枚举值: init, in-progress, completed),
subresource_uris
(对象),
uri
(字符串)

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.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", conference.AccountSid)
Returns:
account_sid
(string),
api_version
(string),
call_sid_ending_conference
(string),
date_created
(string),
date_updated
(string),
friendly_name
(string),
reason_conference_ended
(enum: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded),
region
(string),
sid
(string),
status
(enum: init, in-progress, completed),
subresource_uris
(object),
uri
(string)
更新指定会议的资源信息。
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}
go
	conference, err := client.Texml.Accounts.Conferences.Update(
		context.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", conference.AccountSid)
返回参数:
account_sid
(字符串),
api_version
(字符串),
call_sid_ending_conference
(字符串),
date_created
(字符串),
date_updated
(字符串),
friendly_name
(字符串),
reason_conference_ended
(枚举值: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded),
region
(字符串),
sid
(字符串),
status
(枚举值: init, in-progress, completed),
subresource_uris
(对象),
uri
(字符串)

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.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantGetParticipantsParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
Returns:
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
participants
(array[object]),
start
(integer),
uri
(string)
获取指定会议的参会者列表
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
go
	response, err := client.Texml.Accounts.Conferences.Participants.GetParticipants(
		context.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantGetParticipantsParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
返回参数:
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
participants
(对象数组),
start
(整数),
uri
(字符串)

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.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantParticipantsParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
coaching
(boolean),
coaching_call_sid
(string),
conference_sid
(uuid),
end_conference_on_exit
(boolean),
hold
(boolean),
muted
(boolean),
status
(enum: connecting, connected, completed),
uri
(string)
拨号邀请新的参会者加入指定会议
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
go
	response, err := client.Texml.Accounts.Conferences.Participants.Participants(
		context.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceParticipantParticipantsParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
coaching
(布尔值),
coaching_call_sid
(字符串),
conference_sid
(uuid),
end_conference_on_exit
(布尔值),
hold
(布尔值),
muted
(布尔值),
status
(枚举值: connecting, connected, completed),
uri
(字符串)

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.Background(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", participant.AccountSid)
Returns:
account_sid
(string),
api_version
(string),
call_sid
(string),
call_sid_legacy
(string),
coaching
(boolean),
coaching_call_sid
(string),
coaching_call_sid_legacy
(string),
conference_sid
(uuid),
date_created
(string),
date_updated
(string),
end_conference_on_exit
(boolean),
hold
(boolean),
muted
(boolean),
status
(enum: connecting, connected, completed),
uri
(string)
获取指定会议参会者的资源信息
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	participant, err := client.Texml.Accounts.Conferences.Participants.Get(
		context.Background(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", participant.AccountSid)
返回参数:
account_sid
(字符串),
api_version
(字符串),
call_sid
(字符串),
call_sid_legacy
(字符串),
coaching
(布尔值),
coaching_call_sid
(字符串),
coaching_call_sid_legacy
(字符串),
conference_sid
(uuid),
date_created
(字符串),
date_updated
(字符串),
end_conference_on_exit
(布尔值),
hold
(布尔值),
muted
(布尔值),
status
(枚举值: connecting, connected, completed),
uri
(字符串)

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.Background(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", participant.AccountSid)
Returns:
account_sid
(string),
api_version
(string),
call_sid
(string),
call_sid_legacy
(string),
coaching
(boolean),
coaching_call_sid
(string),
coaching_call_sid_legacy
(string),
conference_sid
(uuid),
date_created
(string),
date_updated
(string),
end_conference_on_exit
(boolean),
hold
(boolean),
muted
(boolean),
status
(enum: connecting, connected, completed),
uri
(string)
更新指定会议参会者的信息
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	participant, err := client.Texml.Accounts.Conferences.Participants.Update(
		context.Background(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", participant.AccountSid)
返回参数:
account_sid
(字符串),
api_version
(字符串),
call_sid
(字符串),
call_sid_legacy
(字符串),
coaching
(布尔值),
coaching_call_sid
(字符串),
coaching_call_sid_legacy
(字符串),
conference_sid
(uuid),
date_created
(字符串),
date_updated
(字符串),
end_conference_on_exit
(布尔值),
hold
(布尔值),
muted
(布尔值),
status
(枚举值: connecting, connected, completed),
uri
(字符串)

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.Background(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantDeleteParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
将指定参会者从会议中移除
DELETE /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
go
	err := client.Texml.Accounts.Conferences.Participants.Delete(
		context.Background(),
		"call_sid_or_participant_label",
		telnyx.TexmlAccountConferenceParticipantDeleteParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
			ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}

List conference recordings

获取会议录音列表

Lists conference recordings
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings
go
	response, err := client.Texml.Accounts.Conferences.GetRecordings(
		context.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
Returns:
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
participants
(array[object]),
recordings
(array[object]),
start
(integer),
uri
(string)
获取指定会议的录音列表
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings
go
	response, err := client.Texml.Accounts.Conferences.GetRecordings(
		context.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
返回参数:
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
participants
(对象数组),
recordings
(对象数组),
start
(整数),
uri
(字符串)

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.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
recordings
(array[object]),
start
(integer),
uri
(string)
根据conference_sid返回对应会议的录音信息。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.Conferences.GetRecordingsJson(
		context.Background(),
		"conference_sid",
		telnyx.TexmlAccountConferenceGetRecordingsJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
返回参数:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
recordings
(对象数组),
start
(整数),
uri
(字符串)

List queue resources

获取队列资源列表

Lists queue resources.
GET /texml/Accounts/{account_sid}/Queues
go
	page, err := client.Texml.Accounts.Queues.List(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountQueueListParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", page)
Returns:
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
queues
(array[object]),
start
(integer),
uri
(string)
获取所有队列资源列表。
GET /texml/Accounts/{account_sid}/Queues
go
	page, err := client.Texml.Accounts.Queues.List(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountQueueListParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", page)
返回参数:
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
queues
(对象数组),
start
(整数),
uri
(字符串)

Create a new queue

创建队列

Creates a new queue resource.
POST /texml/Accounts/{account_sid}/Queues
go
	queue, err := client.Texml.Accounts.Queues.New(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountQueueNewParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", queue.AccountSid)
Returns:
account_sid
(string),
average_wait_time
(integer),
current_size
(integer),
date_created
(string),
date_updated
(string),
max_size
(integer),
sid
(string),
subresource_uris
(object),
uri
(string)
创建一个新的队列资源。
POST /texml/Accounts/{account_sid}/Queues
go
	queue, err := client.Texml.Accounts.Queues.New(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountQueueNewParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", queue.AccountSid)
返回参数:
account_sid
(字符串),
average_wait_time
(整数),
current_size
(整数),
date_created
(字符串),
date_updated
(字符串),
max_size
(整数),
sid
(字符串),
subresource_uris
(对象),
uri
(字符串)

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.Background(),
		"queue_sid",
		telnyx.TexmlAccountQueueGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", queue.AccountSid)
Returns:
account_sid
(string),
average_wait_time
(integer),
current_size
(integer),
date_created
(string),
date_updated
(string),
max_size
(integer),
sid
(string),
subresource_uris
(object),
uri
(string)
返回指定队列的资源信息。
GET /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	queue, err := client.Texml.Accounts.Queues.Get(
		context.Background(),
		"queue_sid",
		telnyx.TexmlAccountQueueGetParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", queue.AccountSid)
返回参数:
account_sid
(字符串),
average_wait_time
(整数),
current_size
(整数),
date_created
(字符串),
date_updated
(字符串),
max_size
(整数),
sid
(字符串),
subresource_uris
(对象),
uri
(字符串)

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.Background(),
		"queue_sid",
		telnyx.TexmlAccountQueueUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", queue.AccountSid)
Returns:
account_sid
(string),
average_wait_time
(integer),
current_size
(integer),
date_created
(string),
date_updated
(string),
max_size
(integer),
sid
(string),
subresource_uris
(object),
uri
(string)
更新指定队列的资源信息。
POST /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	queue, err := client.Texml.Accounts.Queues.Update(
		context.Background(),
		"queue_sid",
		telnyx.TexmlAccountQueueUpdateParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", queue.AccountSid)
返回参数:
account_sid
(字符串),
average_wait_time
(整数),
current_size
(整数),
date_created
(字符串),
date_updated
(字符串),
max_size
(整数),
sid
(字符串),
subresource_uris
(对象),
uri
(字符串)

Delete a queue resource

删除队列

Delete a queue resource.
DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	err := client.Texml.Accounts.Queues.Delete(
		context.Background(),
		"queue_sid",
		telnyx.TexmlAccountQueueDeleteParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
删除指定的队列资源。
DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}
go
	err := client.Texml.Accounts.Queues.Delete(
		context.Background(),
		"queue_sid",
		telnyx.TexmlAccountQueueDeleteParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}

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.Background(),
		"account_sid",
		telnyx.TexmlAccountGetRecordingsJsonParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
recordings
(array[object]),
start
(integer),
uri
(string)
返回当前账号下的所有录音资源。
GET /texml/Accounts/{account_sid}/Recordings.json
go
	response, err := client.Texml.Accounts.GetRecordingsJson(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountGetRecordingsJsonParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
返回参数:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
recordings
(对象数组),
start
(整数),
uri
(字符串)

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.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonGetRecordingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlGetCallRecordingResponseBody.AccountSid)
Returns:
account_sid
(string),
call_sid
(string),
channels
(enum: 1, 2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
error_code
(string | null),
media_url
(uri),
sid
(string),
source
(enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(date-time),
status
(enum: in-progress, completed, paused, stopped),
subresources_uris
(object),
uri
(string)
根据录音ID返回对应录音的资源信息。
GET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
go
	texmlGetCallRecordingResponseBody, err := client.Texml.Accounts.Recordings.Json.GetRecordingSidJson(
		context.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonGetRecordingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlGetCallRecordingResponseBody.AccountSid)
返回参数:
account_sid
(字符串),
call_sid
(字符串),
channels
(枚举值: 1, 2),
conference_sid
(uuid),
date_created
(日期时间),
date_updated
(日期时间),
duration
(字符串 | 空),
error_code
(字符串 | 空),
media_url
(uri),
sid
(字符串),
source
(枚举值: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(日期时间),
status
(枚举值: in-progress, completed, paused, stopped),
subresources_uris
(对象),
uri
(字符串)

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.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonDeleteRecordingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
根据录音ID删除对应录音资源。
DELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
go
	err := client.Texml.Accounts.Recordings.Json.DeleteRecordingSidJson(
		context.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountRecordingJsonDeleteRecordingSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}

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.Background(),
		"account_sid",
		telnyx.TexmlAccountGetTranscriptionsJsonParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
start
(integer),
transcriptions
(array[object]),
uri
(string)
返回当前账号下的所有录音转写资源。
GET /texml/Accounts/{account_sid}/Transcriptions.json
go
	response, err := client.Texml.Accounts.GetTranscriptionsJson(
		context.Background(),
		"account_sid",
		telnyx.TexmlAccountGetTranscriptionsJsonParams{},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.End)
返回参数:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
start
(整数),
transcriptions
(对象数组),
uri
(字符串)

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.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonGetRecordingTranscriptionSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
Returns:
account_sid
(string),
api_version
(string),
call_sid
(string),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
recording_sid
(string),
sid
(string),
status
(enum: in-progress, completed),
transcription_text
(string),
uri
(string)
根据ID返回对应录音转写的资源信息。
GET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
go
	response, err := client.Texml.Accounts.Transcriptions.Json.GetRecordingTranscriptionSidJson(
		context.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonGetRecordingTranscriptionSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.AccountSid)
返回参数:
account_sid
(字符串),
api_version
(字符串),
call_sid
(字符串),
date_created
(日期时间),
date_updated
(日期时间),
duration
(字符串 | 空),
recording_sid
(字符串),
sid
(字符串),
status
(枚举值: in-progress, completed),
transcription_text
(字符串),
uri
(字符串)

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.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonDeleteRecordingTranscriptionSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
永久删除指定的录音转写资源。
DELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
go
	err := client.Texml.Accounts.Transcriptions.Json.DeleteRecordingTranscriptionSidJson(
		context.Background(),
		"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
		telnyx.TexmlAccountTranscriptionJsonDeleteRecordingTranscriptionSidJsonParams{
			AccountSid: "550e8400-e29b-41d4-a716-446655440000",
		},
	)
	if err != nil {
		log.Fatal(err)
	}

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. In your TeXML you will be able to use your secret name, and this name will be replaced by the actual secret value when processing the TeXML on Telnyx side. The secrets are not visible in any logs.
POST /texml/secrets
— Required:
name
,
value
go
	response, err := client.Texml.Secrets(context.Background(), telnyx.TexmlSecretsParams{
		Name:  "My Secret Name",
		Value: "My Secret Value",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.Data)
Returns:
name
(string),
value
(enum: REDACTED)
创建TeXML密钥,后续在TeXML中使用Mustache模板时可将其作为动态参数使用。你可以在TeXML中使用密钥名称,Telnyx侧处理TeXML时会自动将名称替换为实际的密钥值,密钥不会在任何日志中显示。
POST /texml/secrets
— 必填参数:
name
,
value
go
	response, err := client.Texml.Secrets(context.Background(), telnyx.TexmlSecretsParams{
		Name:  "My Secret Name",
		Value: "My Secret Value",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", response.Data)
返回参数:
name
(字符串),
value
(枚举值: REDACTED)

List all TeXML Applications

获取所有TeXML应用列表

Returns a list of your TeXML Applications.
GET /texml_applications
go
	page, err := client.TexmlApplications.List(context.Background(), telnyx.TexmlApplicationListParams{})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", page)
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
返回你所有的TeXML应用列表。
GET /texml_applications
go
	page, err := client.TexmlApplications.List(context.Background(), telnyx.TexmlApplicationListParams{})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", page)
返回参数:
active
(布尔值),
anchorsite_override
(枚举值: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举值: RFC 2833, Inband, SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举值: get, post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举值: get, post),
voice_url
(uri)

Creates a TeXML Application

创建TeXML应用

Creates a TeXML Application.
POST /texml_applications
— Required:
friendly_name
,
voice_url
Optional:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
voice_fallback_url
(uri),
voice_method
(enum: get, post)
go
	texmlApplication, err := client.TexmlApplications.New(context.Background(), telnyx.TexmlApplicationNewParams{
		FriendlyName: "call-router",
		VoiceURL:     "https://example.com",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
创建一个新的TeXML应用。
POST /texml_applications
— 必填参数:
friendly_name
,
voice_url
可选参数:
active
(布尔值),
anchorsite_override
(枚举值: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
dtmf_type
(枚举值: RFC 2833, Inband, SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
inbound
(对象),
outbound
(对象),
status_callback
(uri),
status_callback_method
(枚举值: get, post),
tags
(字符串数组),
voice_fallback_url
(uri),
voice_method
(枚举值: get, post)
go
	texmlApplication, err := client.TexmlApplications.New(context.Background(), telnyx.TexmlApplicationNewParams{
		FriendlyName: "call-router",
		VoiceURL:     "https://example.com",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
返回参数:
active
(布尔值),
anchorsite_override
(枚举值: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举值: RFC 2833, Inband, SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举值: get, post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举值: get, post),
voice_url
(uri)

Retrieve a TeXML Application

获取TeXML应用详情

Retrieves the details of an existing TeXML Application.
GET /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Get(context.Background(), "1293384261075731499")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
获取现有TeXML应用的详细信息。
GET /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Get(context.Background(), "1293384261075731499")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
返回参数:
active
(布尔值),
anchorsite_override
(枚举值: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举值: RFC 2833, Inband, SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举值: get, post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举值: get, post),
voice_url
(uri)

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: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
voice_fallback_url
(uri),
voice_method
(enum: get, post)
go
	texmlApplication, err := client.TexmlApplications.Update(
		context.Background(),
		"1293384261075731499",
		telnyx.TexmlApplicationUpdateParams{
			FriendlyName: "call-router",
			VoiceURL:     "https://example.com",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
更新现有TeXML应用的配置。
PATCH /texml_applications/{id}
— 必填参数:
friendly_name
,
voice_url
可选参数:
active
(布尔值),
anchorsite_override
(枚举值: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
dtmf_type
(枚举值: RFC 2833, Inband, SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
inbound
(对象),
outbound
(对象),
status_callback
(uri),
status_callback_method
(枚举值: get, post),
tags
(字符串数组),
voice_fallback_url
(uri),
voice_method
(枚举值: get, post)
go
	texmlApplication, err := client.TexmlApplications.Update(
		context.Background(),
		"1293384261075731499",
		telnyx.TexmlApplicationUpdateParams{
			FriendlyName: "call-router",
			VoiceURL:     "https://example.com",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
返回参数:
active
(布尔值),
anchorsite_override
(枚举值: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举值: RFC 2833, Inband, SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举值: get, post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举值: get, post),
voice_url
(uri)

Deletes a TeXML Application

删除TeXML应用

Deletes a TeXML Application.
DELETE /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Delete(context.Background(), "1293384261075731499")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
删除指定的TeXML应用。
DELETE /texml_applications/{id}
go
	texmlApplication, err := client.TexmlApplications.Delete(context.Background(), "1293384261075731499")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", texmlApplication.Data)
返回参数:
active
(布尔值),
anchorsite_override
(枚举值: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举值: RFC 2833, Inband, SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举值: get, post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举值: get, post),
voice_url
(uri)