From 4e4f4e80de91f506d8afcf3818857d4c9b2cf9f2 Mon Sep 17 00:00:00 2001 From: Abinaya S Plivo <92303844+Abinaya-Shunmugavel@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:54:13 +0530 Subject: [PATCH] Remove plivobin urls in GO SDK (#222) * Remove plivobin urls in GO SDK * added transcription params to MPC XML * sdk versioning added * corrected --- CHANGELOG.md | 4 +++ baseclient.go | 2 +- fixtures/listMaskingSessionResponse.json | 42 ++++++++++++------------ maskingsession_test.go | 4 +-- xml/plivoxml.go | 12 +++++++ xml/plivoxml_test.go | 4 +-- 6 files changed, 42 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7da7ee6..b64f898 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [7.56.0](https://github.com/plivo/plivo-go/tree/v7.56.0) (2024-11-19) +**Feature - Transcription params added in MPC XML Element** +- Support for the `transcriptionUrl`, `transcript` parameter in MPC XML Element. + ## [7.55.1](https://github.com/plivo/plivo-go/tree/v7.55.1) (2024-11-15) **Feature - RecordParticipantTrack param added in MPC XML creation** - Support for the `RecordParticipantTrack` parameter in MPC XML Creation. diff --git a/baseclient.go b/baseclient.go index 1ef7c90..ae267d3 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "7.55.1" +const sdkVersion = "7.56.0" const lookupBaseUrl = "lookup.plivo.com" diff --git a/fixtures/listMaskingSessionResponse.json b/fixtures/listMaskingSessionResponse.json index 55714bc..297f4e1 100644 --- a/fixtures/listMaskingSessionResponse.json +++ b/fixtures/listMaskingSessionResponse.json @@ -13,7 +13,7 @@ "amount": 0, "call_time_limit": 600, "callback_method": "GET", - "callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1", + "callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "created_time": "2023-07-05 10:25:40.877364 +0000 UTC", "duration": 2863, "expiry_time": "2023-07-05 11:13:23.895313 +0000 UTC", @@ -26,11 +26,11 @@ "record": true, "record_file_format": "mp3", "recording_callback_method": "GET", - "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/c2146ba4-798d-49b0-8580-53851a16e055/", "ring_timeout": 120, "second_party": "919976106830", - "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "second_party_play_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055", "status": "expired", "total_call_amount": 0, @@ -43,7 +43,7 @@ "amount": 0, "call_time_limit": 600, "callback_method": "GET", - "callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1", + "callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "created_time": "2023-07-04 10:29:02.410778 +0000 UTC", "duration": 2571, "expiry_time": "2023-07-04 11:11:53.486694 +0000 UTC", @@ -56,11 +56,11 @@ "record": true, "record_file_format": "mp3", "recording_callback_method": "GET", - "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/61130623-ac98-4d70-8961-3b3110700e0a/", "ring_timeout": 120, "second_party": "919976106830", - "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml", "session_uuid": "61130623-ac98-4d70-8961-3b3110700e0a", "status": "expired", "total_call_amount": 0, @@ -73,7 +73,7 @@ "amount": 0, "call_time_limit": 600, "callback_method": "GET", - "callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1", + "callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "created_time": "2023-07-04 07:29:27.14973 +0000 UTC", "duration": 926, "expiry_time": "2023-07-04 07:36:50.056529 +0000 UTC", @@ -86,11 +86,11 @@ "record": true, "record_file_format": "mp3", "recording_callback_method": "GET", - "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/4b083bef-7b26-4116-95a4-c35f81f5c2c1/", "ring_timeout": 120, "second_party": "919976106830", - "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml", "session_uuid": "4b083bef-7b26-4116-95a4-c35f81f5c2c1", "status": "expired", "total_call_amount": 0, @@ -103,7 +103,7 @@ "amount": 0, "call_time_limit": 600, "callback_method": "GET", - "callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1", + "callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "created_time": "2023-07-04 06:41:19.396345 +0000 UTC", "duration": 1244, "expiry_time": "2023-07-04 07:02:03.635064 +0000 UTC", @@ -116,11 +116,11 @@ "record": true, "record_file_format": "mp3", "recording_callback_method": "GET", - "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/24d9691b-3904-488f-9ad8-f5afa6121606/", "ring_timeout": 120, "second_party": "919976106830", - "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml", "session_uuid": "24d9691b-3904-488f-9ad8-f5afa6121606", "status": "expired", "total_call_amount": 0, @@ -133,7 +133,7 @@ "amount": 0, "call_time_limit": 14400, "callback_method": "GET", - "callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7", + "callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "created_time": "2023-07-03 09:46:07.91423 +0000 UTC", "duration": 8702, "expiry_time": "2023-07-03 12:11:09.939161 +0000 UTC", @@ -146,11 +146,11 @@ "record": false, "record_file_format": "mp3", "recording_callback_method": "GET", - "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/964c20e0-9d59-40d5-90c3-7006ef5d03f4/", "ring_timeout": 120, "second_party": "919976106830", - "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml", "session_uuid": "964c20e0-9d59-40d5-90c3-7006ef5d03f4", "status": "expired", "total_call_amount": 0, @@ -163,7 +163,7 @@ "amount": 0, "call_time_limit": 600, "callback_method": "GET", - "callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1", + "callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "created_time": "2023-06-30 06:51:11.021617 +0000 UTC", "duration": 6702, "expiry_time": "2023-06-30 08:42:53.503857 +0000 UTC", @@ -176,11 +176,11 @@ "record": true, "record_file_format": "mp3", "recording_callback_method": "GET", - "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/c4ea0e4c-b3e7-47c3-a31c-79227ac6939c/", "ring_timeout": 120, "second_party": "919976106830", - "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml", "session_uuid": "c4ea0e4c-b3e7-47c3-a31c-79227ac6939c", "status": "expired", "total_call_amount": 0, @@ -193,7 +193,7 @@ "amount": 0, "call_time_limit": 14400, "callback_method": "GET", - "callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7", + "callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "created_time": "2023-06-30 06:39:06.742974 +0000 UTC", "duration": 6000, "expiry_time": "2023-06-30 06:39:16.99714 +0000 UTC", @@ -206,11 +206,11 @@ "record": false, "record_file_format": "mp3", "recording_callback_method": "GET", - "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml", "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/dd3bb3c2-4f18-4988-87f1-9116b00bb875/", "ring_timeout": 120, "second_party": "919976106830", - "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml", + "second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml", "session_uuid": "dd3bb3c2-4f18-4988-87f1-9116b00bb875", "status": "expired", "total_call_amount": 0, diff --git a/maskingsession_test.go b/maskingsession_test.go index 4e6cc09..6d96a16 100644 --- a/maskingsession_test.go +++ b/maskingsession_test.go @@ -82,9 +82,9 @@ func TestMaskingSessionService_CreateMaskingSession_ForcePinAuthentication(t *te SecondPartyPin: "2435", PinRetry: 2, PinRetryWait: 5, - PinPromptPlay: "https://plivobin-prod-usw.plivops.com/api/v1/speak.mp3", + PinPromptPlay: "https://s3.amazonaws.com/plivosamplexml/speak_url.xml", UnknownCallerPlay: "", - IncorrectPinPlay: "https://plivobin-prod-usw.plivops.com/api/v1/speak.mp3", + IncorrectPinPlay: "https://s3.amazonaws.com/plivosamplexml/speak_url.xml", ForcePinAuthentication: true, }) if err != nil { diff --git a/xml/plivoxml.go b/xml/plivoxml.go index cd9448d..85c6abd 100644 --- a/xml/plivoxml.go +++ b/xml/plivoxml.go @@ -1197,6 +1197,8 @@ type MultiPartyCallElement struct { StartRecordingAudioMethod *string `xml:"StartRecordingAudioMethod,attr"` StopRecordingAudio *string `xml:"StopRecordingAudio,attr"` StopRecordingAudioMethod *string `xml:"StopRecordingAudioMethod,attr"` + Transcript *bool `xml:"transcript,attr"` + TranscriptionUrl *string `xml:"transcriptionUrl,attr"` RecordParticipantTrack *bool `xml:"recordParticipantTrack,attr"` } @@ -1350,6 +1352,16 @@ func (e MultiPartyCallElement) SetStopRecordingAudioMethod(value string) MultiPa return e } +func (e MultiPartyCallElement) SetTranscript(value bool) MultiPartyCallElement { + e.Transcript = &value + return e +} + +func (e MultiPartyCallElement) SetTranscriptionUrl(value string) MultiPartyCallElement { + e.TranscriptionUrl = &value + return e +} + func (e MultiPartyCallElement) AddContents(values ...interface{}) MultiPartyCallElement { e.Contents = append(e.Contents, values) return e diff --git a/xml/plivoxml_test.go b/xml/plivoxml_test.go index 38dcd13..1b6f1ed 100644 --- a/xml/plivoxml_test.go +++ b/xml/plivoxml_test.go @@ -61,9 +61,9 @@ func TestComplexXML(t *testing.T) { } func TestMPCXML(t *testing.T) { - assert.Equal(t, "Nairobi", ResponseElement{ + assert.Equal(t, "Nairobi", ResponseElement{ Contents: []interface{}{ - new(MultiPartyCallElement).SetAgentHoldMusicMethod("GET").SetCoachMode(true).SetCustomerHoldMusicMethod("GET").SetEndMpcOnExit(false).SetEnterSound("beep:1").SetEnterSoundMethod("GET").SetExitSound("beep:2").SetExitSoundMethod("GET").SetHold(false).SetMaxDuration(14400).SetMaxParticipants(10).SetRecordMinMemberCount(1).SetMute(false).SetOnExitActionMethod("POST").SetRecord(false).SetRecordFileFormat("mp3").SetRecordingCallbackMethod("POST").SetRelayDtmfInputs(false).SetRole("agent").SetStartMpcOnEnter(true).SetStatusCallbackEvents("mpc-state-changes,participant-state-changes").SetStatusCallbackMethod("POST").SetStayAlone(false).SetWaitMusicMethod("GET").SetWaitTime(5).SetContents("Nairobi").SetStartRecordingAudio("https://s3.amazonaws.com/plivocloud/music.mp3").SetStartRecordingAudioMethod("GET").SetStopRecordingAudio("https://s3.amazonaws.com/plivocloud/music.mp3").SetStopRecordingAudioMethod("GET"), + new(MultiPartyCallElement).SetAgentHoldMusicMethod("GET").SetCoachMode(true).SetCustomerHoldMusicMethod("GET").SetEndMpcOnExit(false).SetEnterSound("beep:1").SetEnterSoundMethod("GET").SetExitSound("beep:2").SetExitSoundMethod("GET").SetHold(false).SetMaxDuration(14400).SetMaxParticipants(10).SetRecordMinMemberCount(1).SetMute(false).SetOnExitActionMethod("POST").SetRecord(false).SetRecordFileFormat("mp3").SetRecordingCallbackMethod("POST").SetRelayDtmfInputs(false).SetRole("agent").SetStartMpcOnEnter(true).SetStatusCallbackEvents("mpc-state-changes,participant-state-changes").SetStatusCallbackMethod("POST").SetStayAlone(false).SetWaitMusicMethod("GET").SetWaitTime(5).SetContents("Nairobi").SetStartRecordingAudio("https://s3.amazonaws.com/plivocloud/music.mp3").SetStartRecordingAudioMethod("GET").SetStopRecordingAudio("https://s3.amazonaws.com/plivocloud/music.mp3").SetStopRecordingAudioMethod("GET").SetTranscript(true).SetTranscriptionUrl("url"), }, }.String()) }