diff --git a/CHANGES.md b/CHANGES.md index 49c790910..38a8e67c9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,21 @@ twilio-go changelog ==================== +[2024-12-05] Version 1.23.7 +--------------------------- +**Api** +- Add optional parameter `intelligence_service` to `transcription` +- Updated `phone_number_sid` to be populated for sip trunking terminating calls. + +**Numbers** +- Add Update Hosted Number Order V2 API endpoint +- Update Port in docs + +**Twiml** +- Add optional parameter `intelligence_service` to `` +- Add support for new `` and `` noun +- Add `events` attribute to `` verb + + [2024-11-15] Version 1.23.6 --------------------------- **Api** diff --git a/rest/api/v2010/accounts_calls_transcriptions.go b/rest/api/v2010/accounts_calls_transcriptions.go index b756657ab..4c01f3748 100644 --- a/rest/api/v2010/accounts_calls_transcriptions.go +++ b/rest/api/v2010/accounts_calls_transcriptions.go @@ -51,6 +51,8 @@ type CreateRealtimeTranscriptionParams struct { Hints *string `json:"Hints,omitempty"` // The provider will add punctuation to recognition result EnableAutomaticPunctuation *bool `json:"EnableAutomaticPunctuation,omitempty"` + // The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. + IntelligenceService *string `json:"IntelligenceService,omitempty"` } func (params *CreateRealtimeTranscriptionParams) SetPathAccountSid(PathAccountSid string) *CreateRealtimeTranscriptionParams { @@ -109,6 +111,10 @@ func (params *CreateRealtimeTranscriptionParams) SetEnableAutomaticPunctuation(E params.EnableAutomaticPunctuation = &EnableAutomaticPunctuation return params } +func (params *CreateRealtimeTranscriptionParams) SetIntelligenceService(IntelligenceService string) *CreateRealtimeTranscriptionParams { + params.IntelligenceService = &IntelligenceService + return params +} // Create a Transcription func (c *ApiService) CreateRealtimeTranscription(CallSid string, params *CreateRealtimeTranscriptionParams) (*ApiV2010RealtimeTranscription, error) { @@ -164,6 +170,9 @@ func (c *ApiService) CreateRealtimeTranscription(CallSid string, params *CreateR if params != nil && params.EnableAutomaticPunctuation != nil { data.Set("EnableAutomaticPunctuation", fmt.Sprint(*params.EnableAutomaticPunctuation)) } + if params != nil && params.IntelligenceService != nil { + data.Set("IntelligenceService", *params.IntelligenceService) + } resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) if err != nil { diff --git a/rest/api/v2010/docs/AccountsCallsTranscriptionsApi.md b/rest/api/v2010/docs/AccountsCallsTranscriptionsApi.md index 713cde869..43a1d9ef3 100644 --- a/rest/api/v2010/docs/AccountsCallsTranscriptionsApi.md +++ b/rest/api/v2010/docs/AccountsCallsTranscriptionsApi.md @@ -46,6 +46,7 @@ Name | Type | Description **SpeechModel** | **string** | Recognition model used by the transcription engine, among those supported by the provider **Hints** | **string** | A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. **EnableAutomaticPunctuation** | **bool** | The provider will add punctuation to recognition result +**IntelligenceService** | **string** | The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. ### Return type diff --git a/rest/numbers/v2/README.md b/rest/numbers/v2/README.md index 259dbd57c..48560e983 100644 --- a/rest/numbers/v2/README.md +++ b/rest/numbers/v2/README.md @@ -40,6 +40,7 @@ Class | Method | HTTP request | Description *HostedNumberOrdersApi* | [**DeleteHostedNumberOrder**](docs/HostedNumberOrdersApi.md#deletehostednumberorder) | **Delete** /v2/HostedNumber/Orders/{Sid} | *HostedNumberOrdersApi* | [**FetchHostedNumberOrder**](docs/HostedNumberOrdersApi.md#fetchhostednumberorder) | **Get** /v2/HostedNumber/Orders/{Sid} | *HostedNumberOrdersApi* | [**ListHostedNumberOrder**](docs/HostedNumberOrdersApi.md#listhostednumberorder) | **Get** /v2/HostedNumber/Orders | +*HostedNumberOrdersApi* | [**UpdateHostedNumberOrder**](docs/HostedNumberOrdersApi.md#updatehostednumberorder) | **Post** /v2/HostedNumber/Orders/{Sid} | *HostedNumberOrdersBulkApi* | [**CreateBulkHostedNumberOrder**](docs/HostedNumberOrdersBulkApi.md#createbulkhostednumberorder) | **Post** /v2/HostedNumber/Orders/Bulk | *HostedNumberOrdersBulkApi* | [**FetchBulkHostedNumberOrder**](docs/HostedNumberOrdersBulkApi.md#fetchbulkhostednumberorder) | **Get** /v2/HostedNumber/Orders/Bulk/{BulkHostingSid} | *RegulatoryComplianceBundlesApi* | [**CreateBundle**](docs/RegulatoryComplianceBundlesApi.md#createbundle) | **Post** /v2/RegulatoryCompliance/Bundles | diff --git a/rest/numbers/v2/docs/HostedNumberOrdersApi.md b/rest/numbers/v2/docs/HostedNumberOrdersApi.md index add4f706a..43816091f 100644 --- a/rest/numbers/v2/docs/HostedNumberOrdersApi.md +++ b/rest/numbers/v2/docs/HostedNumberOrdersApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**DeleteHostedNumberOrder**](HostedNumberOrdersApi.md#DeleteHostedNumberOrder) | **Delete** /v2/HostedNumber/Orders/{Sid} | [**FetchHostedNumberOrder**](HostedNumberOrdersApi.md#FetchHostedNumberOrder) | **Get** /v2/HostedNumber/Orders/{Sid} | [**ListHostedNumberOrder**](HostedNumberOrdersApi.md#ListHostedNumberOrder) | **Get** /v2/HostedNumber/Orders | +[**UpdateHostedNumberOrder**](HostedNumberOrdersApi.md#UpdateHostedNumberOrder) | **Post** /v2/HostedNumber/Orders/{Sid} | @@ -193,3 +194,48 @@ Name | Type | Description [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## UpdateHostedNumberOrder + +> NumbersV2HostedNumberOrder UpdateHostedNumberOrder(ctx, Sidoptional) + + + +Updates a specific HostedNumberOrder. + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**Sid** | **string** | The SID of the HostedNumberOrder resource to update. + +### Other Parameters + +Other parameters are passed through a pointer to a UpdateHostedNumberOrderParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**Status** | **string** | +**VerificationCallDelay** | **int** | The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. +**VerificationCallExtension** | **string** | The numerical extension to dial when making the ownership verification call. + +### Return type + +[**NumbersV2HostedNumberOrder**](NumbersV2HostedNumberOrder.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/numbers/v2/docs/NumbersV2HostedNumberOrder.md b/rest/numbers/v2/docs/NumbersV2HostedNumberOrder.md index 4bce5db51..c3ea11b60 100644 --- a/rest/numbers/v2/docs/NumbersV2HostedNumberOrder.md +++ b/rest/numbers/v2/docs/NumbersV2HostedNumberOrder.md @@ -23,6 +23,12 @@ Name | Type | Description | Notes **ContactPhoneNumber** | Pointer to **string** | The contact phone number of the person authorized to sign the Authorization Document. | **BulkHostingRequestSid** | Pointer to **string** | A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. | **NextStep** | Pointer to **string** | The next step you need to take to complete the hosted number order and request it successfully. | +**VerificationAttempts** | **int** | The number of attempts made to verify ownership via a call for the hosted phone number. |[optional] [default to 0] +**VerificationCallSids** | Pointer to **[]string** | The Call SIDs that identify the calls placed to verify ownership. | +**VerificationCallDelay** | **int** | The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. |[optional] [default to 0] +**VerificationCallExtension** | Pointer to **string** | The numerical extension to dial when making the ownership verification call. | +**VerificationCode** | Pointer to **string** | The digits the user must pass in the ownership verification call. | +**VerificationType** | Pointer to [**string**](HostedNumberOrderEnumVerificationType.md) | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/numbers/v2/hosted_number_orders.go b/rest/numbers/v2/hosted_number_orders.go index c9cc95e42..ecbeedab6 100644 --- a/rest/numbers/v2/hosted_number_orders.go +++ b/rest/numbers/v2/hosted_number_orders.go @@ -426,3 +426,61 @@ func (c *ApiService) getNextListHostedNumberOrderResponse(nextPageUrl string) (i } return ps, nil } + +// Optional parameters for the method 'UpdateHostedNumberOrder' +type UpdateHostedNumberOrderParams struct { + // + Status *string `json:"Status,omitempty"` + // The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + VerificationCallDelay *int `json:"VerificationCallDelay,omitempty"` + // The numerical extension to dial when making the ownership verification call. + VerificationCallExtension *string `json:"VerificationCallExtension,omitempty"` +} + +func (params *UpdateHostedNumberOrderParams) SetStatus(Status string) *UpdateHostedNumberOrderParams { + params.Status = &Status + return params +} +func (params *UpdateHostedNumberOrderParams) SetVerificationCallDelay(VerificationCallDelay int) *UpdateHostedNumberOrderParams { + params.VerificationCallDelay = &VerificationCallDelay + return params +} +func (params *UpdateHostedNumberOrderParams) SetVerificationCallExtension(VerificationCallExtension string) *UpdateHostedNumberOrderParams { + params.VerificationCallExtension = &VerificationCallExtension + return params +} + +// Updates a specific HostedNumberOrder. +func (c *ApiService) UpdateHostedNumberOrder(Sid string, params *UpdateHostedNumberOrderParams) (*NumbersV2HostedNumberOrder, error) { + path := "/v2/HostedNumber/Orders/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.VerificationCallDelay != nil { + data.Set("VerificationCallDelay", fmt.Sprint(*params.VerificationCallDelay)) + } + if params != nil && params.VerificationCallExtension != nil { + data.Set("VerificationCallExtension", *params.VerificationCallExtension) + } + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2HostedNumberOrder{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/numbers/v2/model_numbers_v2_hosted_number_order.go b/rest/numbers/v2/model_numbers_v2_hosted_number_order.go index ee421226d..840afb628 100644 --- a/rest/numbers/v2/model_numbers_v2_hosted_number_order.go +++ b/rest/numbers/v2/model_numbers_v2_hosted_number_order.go @@ -56,4 +56,15 @@ type NumbersV2HostedNumberOrder struct { BulkHostingRequestSid *string `json:"bulk_hosting_request_sid,omitempty"` // The next step you need to take to complete the hosted number order and request it successfully. NextStep *string `json:"next_step,omitempty"` + // The number of attempts made to verify ownership via a call for the hosted phone number. + VerificationAttempts int `json:"verification_attempts,omitempty"` + // The Call SIDs that identify the calls placed to verify ownership. + VerificationCallSids *[]string `json:"verification_call_sids,omitempty"` + // The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + VerificationCallDelay int `json:"verification_call_delay,omitempty"` + // The numerical extension to dial when making the ownership verification call. + VerificationCallExtension *string `json:"verification_call_extension,omitempty"` + // The digits the user must pass in the ownership verification call. + VerificationCode *string `json:"verification_code,omitempty"` + VerificationType *string `json:"verification_type,omitempty"` } diff --git a/twiml/voice_response.go b/twiml/voice_response.go index ae1faaf47..d52b2ac75 100644 --- a/twiml/voice_response.go +++ b/twiml/voice_response.go @@ -107,6 +107,7 @@ type VoiceTranscription struct { // speech_model: Speech Model used by the transcription engine // hints: Hints to be provided to the transcription engine // enable_automatic_punctuation: Enable Automatic Punctuation + // intelligence_service: The SID or the unique name of the Intelligence Service to be used // OptionalAttributes: additional attributes Name string Track string @@ -121,6 +122,7 @@ type VoiceTranscription struct { SpeechModel string Hints string EnableAutomaticPunctuation string + IntelligenceService string InnerElements []Element OptionalAttributes map[string]string } @@ -148,6 +150,7 @@ func (m VoiceTranscription) GetAttr() (map[string]string, map[string]string) { "SpeechModel": m.SpeechModel, "Hints": m.Hints, "EnableAutomaticPunctuation": m.EnableAutomaticPunctuation, + "IntelligenceService": m.IntelligenceService, } return m.OptionalAttributes, paramsAttr } @@ -1297,6 +1300,7 @@ type VoiceDial struct { // sequential: Used to determine if child TwiML nouns should be dialed in order, one after the other (sequential) or dial all at once (parallel). Default is false, parallel // refer_url: Webhook that will receive future SIP REFER requests // refer_method: The HTTP method to use for the refer Webhook + // events: Subscription to events // OptionalAttributes: additional attributes Number string Action string @@ -1316,6 +1320,7 @@ type VoiceDial struct { Sequential string ReferUrl string ReferMethod string + Events string InnerElements []Element OptionalAttributes map[string]string } @@ -1347,6 +1352,7 @@ func (m VoiceDial) GetAttr() (map[string]string, map[string]string) { "Sequential": m.Sequential, "ReferUrl": m.ReferUrl, "ReferMethod": m.ReferMethod, + "Events": m.Events, } return m.OptionalAttributes, paramsAttr } @@ -1776,6 +1782,192 @@ func (m VoiceConnect) GetInnerElements() []Element { return m.InnerElements } +//VoiceAssistant TwiML Noun +type VoiceAssistant struct { + // id: The assistant ID of the AI Assistant + // language: Language to be used for both text-to-speech and transcription + // tts_language: Language to be used for text-to-speech + // transcription_language: Language to be used for transcription + // tts_provider: Provider to be used for text-to-speech + // voice: Voice to be used for text-to-speech + // transcription_provider: Provider to be used for transcription + // speech_model: Speech model to be used for transcription + // profanity_filter: Whether profanities should be filtered out of the speech transcription + // dtmf_detection: Whether DTMF tones should be detected and reported in speech transcription + // welcome_greeting: The sentence to be played automatically when the session is connected + // partial_prompts: Whether partial prompts should be reported to WebSocket server before the caller finishes speaking + // interruptible: Whether caller's speaking can interrupt the play of text-to-speech + // interrupt_by_dtmf: Whether DTMF tone can interrupt the play of text-to-speech + // welcome_greeting_interruptible: Whether caller's speaking can interrupt the welcome greeting + // debug: Whether debugging on the session is enabled + // OptionalAttributes: additional attributes + Id string + Language string + TtsLanguage string + TranscriptionLanguage string + TtsProvider string + Voice string + TranscriptionProvider string + SpeechModel string + ProfanityFilter string + DtmfDetection string + WelcomeGreeting string + PartialPrompts string + Interruptible string + InterruptByDtmf string + WelcomeGreetingInterruptible string + Debug string + InnerElements []Element + OptionalAttributes map[string]string +} + +func (m VoiceAssistant) GetName() string { + return "Assistant" +} + +func (m VoiceAssistant) GetText() string { + return "" +} + +func (m VoiceAssistant) GetAttr() (map[string]string, map[string]string) { + paramsAttr := map[string]string{ + "Id": m.Id, + "Language": m.Language, + "TtsLanguage": m.TtsLanguage, + "TranscriptionLanguage": m.TranscriptionLanguage, + "TtsProvider": m.TtsProvider, + "Voice": m.Voice, + "TranscriptionProvider": m.TranscriptionProvider, + "SpeechModel": m.SpeechModel, + "ProfanityFilter": m.ProfanityFilter, + "DtmfDetection": m.DtmfDetection, + "WelcomeGreeting": m.WelcomeGreeting, + "PartialPrompts": m.PartialPrompts, + "Interruptible": m.Interruptible, + "InterruptByDtmf": m.InterruptByDtmf, + "WelcomeGreetingInterruptible": m.WelcomeGreetingInterruptible, + "Debug": m.Debug, + } + return m.OptionalAttributes, paramsAttr +} + +func (m VoiceAssistant) GetInnerElements() []Element { + return m.InnerElements +} + +//VoiceLanguage TwiML Noun +type VoiceLanguage struct { + // code: Language code of this language setting is for + // tts_provider: Provider to be used for text-to-speech of this language + // voice: Voice to be used for text-to-speech of this language + // transcription_provider: Provider to be used for transcription of this language + // speech_model: Speech model to be used for transcription of this language + // OptionalAttributes: additional attributes + Code string + TtsProvider string + Voice string + TranscriptionProvider string + SpeechModel string + InnerElements []Element + OptionalAttributes map[string]string +} + +func (m VoiceLanguage) GetName() string { + return "Language" +} + +func (m VoiceLanguage) GetText() string { + return "" +} + +func (m VoiceLanguage) GetAttr() (map[string]string, map[string]string) { + paramsAttr := map[string]string{ + "Code": m.Code, + "TtsProvider": m.TtsProvider, + "Voice": m.Voice, + "TranscriptionProvider": m.TranscriptionProvider, + "SpeechModel": m.SpeechModel, + } + return m.OptionalAttributes, paramsAttr +} + +func (m VoiceLanguage) GetInnerElements() []Element { + return m.InnerElements +} + +//VoiceConversationRelay TwiML Noun +type VoiceConversationRelay struct { + // url: URL of the remote service where the session is connected to + // language: Language to be used for both text-to-speech and transcription + // tts_language: Language to be used for text-to-speech + // transcription_language: Language to be used for transcription + // tts_provider: Provider to be used for text-to-speech + // voice: Voice to be used for text-to-speech + // transcription_provider: Provider to be used for transcription + // speech_model: Speech model to be used for transcription + // profanity_filter: Whether profanities should be filtered out of the speech transcription + // dtmf_detection: Whether DTMF tones should be detected and reported in speech transcription + // welcome_greeting: The sentence to be played automatically when the session is connected + // partial_prompts: Whether partial prompts should be reported to WebSocket server before the caller finishes speaking + // interruptible: Whether caller's speaking can interrupt the play of text-to-speech + // interrupt_by_dtmf: Whether DTMF tone can interrupt the play of text-to-speech + // welcome_greeting_interruptible: Whether caller's speaking can interrupt the welcome greeting + // debug: Whether debugging on the session is enabled + // OptionalAttributes: additional attributes + Url string + Language string + TtsLanguage string + TranscriptionLanguage string + TtsProvider string + Voice string + TranscriptionProvider string + SpeechModel string + ProfanityFilter string + DtmfDetection string + WelcomeGreeting string + PartialPrompts string + Interruptible string + InterruptByDtmf string + WelcomeGreetingInterruptible string + Debug string + InnerElements []Element + OptionalAttributes map[string]string +} + +func (m VoiceConversationRelay) GetName() string { + return "ConversationRelay" +} + +func (m VoiceConversationRelay) GetText() string { + return "" +} + +func (m VoiceConversationRelay) GetAttr() (map[string]string, map[string]string) { + paramsAttr := map[string]string{ + "Url": m.Url, + "Language": m.Language, + "TtsLanguage": m.TtsLanguage, + "TranscriptionLanguage": m.TranscriptionLanguage, + "TtsProvider": m.TtsProvider, + "Voice": m.Voice, + "TranscriptionProvider": m.TranscriptionProvider, + "SpeechModel": m.SpeechModel, + "ProfanityFilter": m.ProfanityFilter, + "DtmfDetection": m.DtmfDetection, + "WelcomeGreeting": m.WelcomeGreeting, + "PartialPrompts": m.PartialPrompts, + "Interruptible": m.Interruptible, + "InterruptByDtmf": m.InterruptByDtmf, + "WelcomeGreetingInterruptible": m.WelcomeGreetingInterruptible, + "Debug": m.Debug, + } + return m.OptionalAttributes, paramsAttr +} + +func (m VoiceConversationRelay) GetInnerElements() []Element { + return m.InnerElements +} + //VoiceConversation TwiML Noun type VoiceConversation struct { // service_instance_sid: Service instance Sid