From d9bac7e76f07afb780bee89b7af3346cfe5a76bd Mon Sep 17 00:00:00 2001 From: Prashant Kumar Pandey Plivo <90573250+prashantp-plivo@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:51:35 +0530 Subject: [PATCH] VT-8537: Machine Detection support in Plivo XML (#225) * VT-8537: Machine Detection support in Plivo XML * VT-8537: Fixed changelog --- CHANGELOG.md | 4 ++++ baseclient.go | 2 +- xml/plivoxml.go | 7 +++++++ xml/plivoxml_test.go | 4 ++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b64f898..e089c24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [7.57.0](https://github.com/plivo/plivo-go/tree/v7.57.0) (2024-12-09) +**Feature - MachineDetection params added in Dial XML Element** +- Support for the `machineDetection` parameter in Dial XML Element. + ## [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. diff --git a/baseclient.go b/baseclient.go index ae267d3..0ec3769 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "7.56.0" +const sdkVersion = "7.57.0" const lookupBaseUrl = "lookup.plivo.com" diff --git a/xml/plivoxml.go b/xml/plivoxml.go index 85c6abd..1e39633 100644 --- a/xml/plivoxml.go +++ b/xml/plivoxml.go @@ -212,6 +212,8 @@ type DialElement struct { SipHeaders *string `xml:"sipHeaders,attr"` + MachineDetection *string `xml:"machineDetection,attr"` + XMLName xml.Name `xml:"Dial"` } @@ -300,6 +302,11 @@ func (e DialElement) SetSipHeaders(value string) DialElement { return e } +func (e DialElement) SetMachineDetection(value string) DialElement { + e.MachineDetection = &value + return e +} + func (e DialElement) SetContents(value []interface{}) DialElement { e.Contents = value return e diff --git a/xml/plivoxml_test.go b/xml/plivoxml_test.go index 1b6f1ed..5649353 100644 --- a/xml/plivoxml_test.go +++ b/xml/plivoxml_test.go @@ -16,14 +16,14 @@ func TestSimpleXML(t *testing.T) { func TestComplexXML(t *testing.T) { rate := "slow" pitch := "low" - assert.Equal(t, "Plivo®123user123textTell us more about your experiencenameurlurlssmlfirst prosodyemphasis on thisALPHABETSslowlow and slow", ResponseElement{ + assert.Equal(t, "Plivo®123user123textTell us more about your experiencenameurlurlssmlfirst prosodyemphasis on thisALPHABETSslowlow and slow", ResponseElement{ Contents: []interface{}{ new(MessageElement).SetSrc("123").SetDst("321").SetType("sms").SetCallbackMethod("POST").SetCallbackUrl("url").SetContents("Plivo®"), new(RecordElement).SetCallbackMethod("POST").SetCallbackUrl("url").SetAction("action").SetFileFormat("fileformat").SetFinishOnKey("key").SetRecordSession(true).SetRedirect(true).SetPlayBeep(true).SetTimeout(10).SetMaxLength(100).SetMethod("POST"), new(DialElement).SetContents([]interface{}{ new(NumberElement).SetContents("123").SetSendOnPreanswer(true).SetSendDigits("123"), new(UserElement).SetContents("user").SetSendOnPreanswer(true).SetSendDigits("123").SetSipHeaders("header=1"), - }).SetTimeLimit(10).SetMethod("POST").SetHangupOnStar(true).SetDigitsMatch("123").SetCallbackMethod("POST").SetCallbackUrl("url").SetRedirect(true).SetAction("action").SetTimeout(10).SetSipHeaders("h=1"), + }).SetTimeLimit(10).SetMethod("POST").SetHangupOnStar(true).SetDigitsMatch("123").SetCallbackMethod("POST").SetCallbackUrl("url").SetRedirect(true).SetAction("action").SetTimeout(10).SetSipHeaders("h=1").SetMachineDetection("true"), new(DTMFElement).SetContents("123").SetAsync(true), new(WaitElement).SetBeep(true).SetLength(10).SetMinSilence(10).SetSilence(true), new(PreAnswerElement).SetContents([]interface{}{