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-gobash
go get github.com/team-telnyx/telnyx-goSetup
初始化配置
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 is already initialized as shown above.
clientgo
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")),
)以下所有示例均假设已按上述方式初始化完成。
clientList all TeXML Applications
列出所有TeXML应用
Returns a list of your TeXML Applications.
GET /texml_applicationsgo
page, err := client.TexmlApplications.List(context.TODO(), telnyx.TexmlApplicationListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)返回你的所有TeXML应用列表。
GET /texml_applicationsgo
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_applicationsfriendly_namevoice_urlOptional: (boolean), (enum), (boolean), (enum), (boolean), (integer), (object), (object), (uri), (enum), (array[string]), (uri), (enum)
activeanchorsite_overridecall_cost_in_webhooksdtmf_typefirst_command_timeoutfirst_command_timeout_secsinboundoutboundstatus_callbackstatus_callback_methodtagsvoice_fallback_urlvoice_methodgo
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_applicationsfriendly_namevoice_url可选参数:(布尔值), (枚举), (布尔值), (枚举), (布尔值), (整数), (对象), (对象), (URI), (枚举), (字符串数组), (URI), (枚举)
activeanchorsite_overridecall_cost_in_webhooksdtmf_typefirst_command_timeoutfirst_command_timeout_secsinboundoutboundstatus_callbackstatus_callback_methodtagsvoice_fallback_urlvoice_methodgo
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}friendly_namevoice_urlOptional: (boolean), (enum), (boolean), (enum), (boolean), (integer), (object), (object), (uri), (enum), (array[string]), (uri), (enum)
activeanchorsite_overridecall_cost_in_webhooksdtmf_typefirst_command_timeoutfirst_command_timeout_secsinboundoutboundstatus_callbackstatus_callback_methodtagsvoice_fallback_urlvoice_methodgo
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_namevoice_url可选参数:(布尔值), (枚举), (布尔值), (枚举), (布尔值), (整数), (对象), (对象), (URI), (枚举), (字符串数组), (URI), (枚举)
activeanchorsite_overridecall_cost_in_webhooksdtmf_typefirst_command_timeoutfirst_command_timeout_secsinboundoutboundstatus_callbackstatus_callback_methodtagsvoice_fallback_urlvoice_methodgo
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}/Callsgo
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}/Callsgo
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}/CallsToFromApplicationSidOptional: (boolean), (string), (enum), (string), (boolean), (boolean), (array[object]), (enum), (string), (enum), (integer), (integer), (integer), (integer), (string), (boolean), (enum), (string), (string), (enum), (integer), (enum), (boolean), (string), (string), (enum), (string), (enum), (enum), (string), (enum), (string), (integer), (integer), (enum), (string), (enum)
AsyncAmdAsyncAmdStatusCallbackAsyncAmdStatusCallbackMethodCallerIdCancelPlaybackOnDetectMessageEndCancelPlaybackOnMachineDetectionCustomHeadersDetectionModeFallbackUrlMachineDetectionMachineDetectionSilenceTimeoutMachineDetectionSpeechEndThresholdMachineDetectionSpeechThresholdMachineDetectionTimeoutPreferredCodecsRecordRecordingChannelsRecordingStatusCallbackRecordingStatusCallbackEventRecordingStatusCallbackMethodRecordingTimeoutRecordingTrackSendRecordingUrlSipAuthPasswordSipAuthUsernameSipRegionStatusCallbackStatusCallbackEventStatusCallbackMethodSuperviseCallSidSupervisingRoleTexmlTimeLimitTimeoutTrimUrlUrlMethodgo
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}/CallsToFromApplicationSid可选参数:(布尔值), (字符串), (枚举), (字符串), (布尔值), (布尔值), (对象数组), (枚举), (字符串), (枚举), (整数), (整数), (整数), (整数), (字符串), (布尔值), (枚举), (字符串), (字符串), (枚举), (整数), (枚举), (布尔值), (字符串), (字符串), (枚举), (字符串), (枚举), (枚举), (字符串), (枚举), (字符串), (整数), (整数), (枚举), (字符串), (枚举)
AsyncAmdAsyncAmdStatusCallbackAsyncAmdStatusCallbackMethodCallerIdCancelPlaybackOnDetectMessageEndCancelPlaybackOnMachineDetectionCustomHeadersDetectionModeFallbackUrlMachineDetectionMachineDetectionSilenceTimeoutMachineDetectionSpeechEndThresholdMachineDetectionSpeechThresholdMachineDetectionTimeoutPreferredCodecsRecordRecordingChannelsRecordingStatusCallbackRecordingStatusCallbackEventRecordingStatusCallbackMethodRecordingTimeoutRecordingTrackSendRecordingUrlSipAuthPasswordSipAuthUsernameSipRegionStatusCallbackStatusCallbackEventStatusCallbackMethodSuperviseCallSidSupervisingRoleTexmlTimeLimitTimeoutTrimUrlUrlMethodgo
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}/Participantsgo
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}/Participantsgo
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}/Participantsgo
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}/Participantsgo
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}/Conferencesgo
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}/Conferencesgo
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}/Queuesgo
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}/Queuesgo
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}/Queuesgo
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}/Queuesgo
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.jsongo
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.jsongo
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}.jsongo
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}.jsongo
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}.jsongo
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}.jsongo
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.jsongo
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.jsongo
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.jsongo
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.jsongo
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}.jsongo
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}.jsongo
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}/Recordingsgo
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}/Recordingsgo
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.jsongo
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.jsongo
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/secretsnamevaluego
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/secretsnamevaluego
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.jsongo
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.jsongo
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}.jsongo
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}.jsongo
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.jsongo
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.jsongo
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}.jsongo
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}.jsongo
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.jsongo
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.jsongo
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}.jsongo
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}.jsongo
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}.jsongo
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}.jsongo
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 and headers for verification (Standard Webhooks compatible).
telnyx-timestamptelnyx-signature-ed25519| Event | Description |
|---|---|
| TeXML Call Answered. Webhook sent when a TeXML call is answered |
| TeXML Call Completed. Webhook sent when a TeXML call is completed |
| TeXML Call Initiated. Webhook sent when a TeXML call is initiated |
| TeXML Call Ringing. Webhook sent when a TeXML call is ringing |
| TeXML Call AMD. Webhook sent when Answering Machine Detection (AMD) completes during a TeXML call |
| TeXML Call DTMF. Webhook sent when a DTMF digit is received during a TeXML call |
| TeXML Gather. Webhook sent when a Gather command completes (sent to the action URL) |
| TeXML HTTP Request. Webhook sent as response to an HTTP Request instruction |
| TeXML AI Gather. Webhook sent when AI Gather completes with transcription results |
| TeXML Refer Status. Webhook sent for SIP REFER status updates |
| TeXML Conference Join. Webhook sent when a participant joins a TeXML conference |
| TeXML Conference Leave. Webhook sent when a participant leaves a TeXML conference |
| TeXML Conference Speaker. Webhook sent when a participant starts or stops speaking in a TeXML conference |
| TeXML Conference End. Webhook sent when a TeXML conference ends |
| TeXML Conference Start. Webhook sent when a TeXML conference starts |
| TeXML Queue. Webhook sent for queue status events (triggered by Enqueue command waitUrl) |
| TeXML Recording Completed. Webhook sent when a recording is completed during a TeXML call (triggered by recordingStatusCallbackEvent) |
| TeXML Recording In-Progress. Webhook sent when a recording starts during a TeXML call (triggered by recordingStatusCallbackEvent) |
| TeXML SIPREC. Webhook sent for SIPREC session status updates |
| TeXML Stream. Webhook sent for media streaming status updates |
| TeXML Transcription. Webhook sent when a recording transcription is completed |
以下Webhook事件将发送到你配置的Webhook URL。所有Webhook都包含和头信息用于验证(兼容标准Webhooks)。
telnyx-timestamptelnyx-signature-ed25519| 事件 | 描述 |
|---|---|
| TeXML通话已接听:当TeXML通话被接听时发送的Webhook |
| TeXML通话已结束:当TeXML通话完成时发送的Webhook |
| TeXML通话已发起:当TeXML通话被发起时发送的Webhook |
| TeXML通话正在振铃:当TeXML通话处于振铃状态时发送的Webhook |
| TeXML通话AMD检测完成:当TeXML通话的应答机器检测(AMD)完成时发送的Webhook |
| TeXML通话DTMF信号接收:当TeXML通话中接收到DTMF按键时发送的Webhook |
| TeXML收集命令完成:当Gather命令执行完成时发送的Webhook(发送到action URL) |
| TeXML HTTP请求响应:作为HTTP Request指令的响应发送的Webhook |
| TeXML AI收集完成:当AI Gather命令完成并返回转录结果时发送的Webhook |
| TeXML SIP REFER状态更新:针对SIP REFER状态变化发送的Webhook |
| TeXML会议参与者加入:当参与者加入TeXML会议时发送的Webhook |
| TeXML会议参与者离开:当参与者离开TeXML会议时发送的Webhook |
| TeXML会议参与者发言状态变化:当TeXML会议中参与者开始或停止发言时发送的Webhook |
| TeXML会议已结束:当TeXML会议结束时发送的Webhook |
| TeXML会议已开始:当TeXML会议启动时发送的Webhook |
| TeXML队列状态更新:针对队列状态事件发送的Webhook(由Enqueue命令的waitUrl触发) |
| TeXML录音已完成:当TeXML通话中的录音完成时发送的Webhook(由recordingStatusCallbackEvent触发) |
| TeXML录音进行中:当TeXML通话中的录音启动时发送的Webhook(由recordingStatusCallbackEvent触发) |
| TeXML SIPREC状态更新:针对SIPREC会话状态变化发送的Webhook |
| TeXML媒体流状态更新:针对媒体流状态变化发送的Webhook |
| TeXML录音转录完成:当录音转录完成时发送的Webhook |