Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VT-8537: Machine Detection support in Plivo XML #225

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion baseclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
7 changes: 7 additions & 0 deletions xml/plivoxml.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ type DialElement struct {

SipHeaders *string `xml:"sipHeaders,attr"`

MachineDetection *string `xml:"machineDetection,attr"`

XMLName xml.Name `xml:"Dial"`
}

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions xml/plivoxml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ func TestSimpleXML(t *testing.T) {
func TestComplexXML(t *testing.T) {
rate := "slow"
pitch := "low"
assert.Equal(t, "<Response><Message src=\"123\" dst=\"321\" type=\"sms\" callbackUrl=\"url\" callbackMethod=\"POST\">Plivo®</Message><Record action=\"action\" method=\"POST\" fileFormat=\"fileformat\" redirect=\"true\" timeout=\"10\" maxLength=\"100\" playBeep=\"true\" finishOnKey=\"key\" recordSession=\"true\" callbackUrl=\"url\" callbackMethod=\"POST\"></Record><Dial action=\"action\" method=\"POST\" hangupOnStar=\"true\" timeLimit=\"10\" timeout=\"10\" callbackUrl=\"url\" callbackMethod=\"POST\" redirect=\"true\" digitsMatch=\"123\" sipHeaders=\"h=1\"><Number sendDigits=\"123\" sendOnPreanswer=\"true\">123</Number><User sendDigits=\"123\" sendOnPreanswer=\"true\" sipHeaders=\"header=1\">user</User></Dial><DTMF async=\"true\">123</DTMF><Wait length=\"10\" silence=\"true\" minSilence=\"10\" beep=\"true\"></Wait><PreAnswer><Speak voice=\"MAN\" language=\"en\" loop=\"10\">text</Speak></PreAnswer><GetDigits action=\"action\" timeout=\"10\" digitTimeout=\"10\" finishOnKey=\"#\" numDigits=\"10\" retries=\"10\" redirect=\"true\" playBeep=\"true\" validDigits=\"123\" invalidDigitsSound=\"sound\"></GetDigits><GetInput action=\"action\" method=\"GET\" inputType=\"Speech\" executionTimeout=\"10\" digitEndTimeout=\"20\" speechEndTimeout=\"30\" finishOnKey=\"#\" numDigits=\"10\" speechModel=\"default\" hints=\"1 2 3\" language=\"en-us\" interimSpeechResultsCallback=\"interimCallback\" interimSpeechResultsCallbackMethod=\"POST\" redirect=\"true\" log=\"false\"><Speak voice=\"WOMAN\" language=\"en-US\" loop=\"1\">Tell us more about your experience</Speak></GetInput><Conference muted=\"true\" enterSound=\"sound\" exitSound=\"sound\" startConferenceOnEnter=\"true\" endConferenceOnExit=\"true\" stayAlone=\"true\" waitSound=\"sound\" maxMembers=\"10\" record=\"true\" recordFileFormat=\"rff\" timeLimit=\"10\" hangupOnStar=\"true\" action=\"action\" method=\"method\" callbackUrl=\"url\" callbackMethod=\"method\" digitsMatch=\"123\" floorEvent=\"true\" redirect=\"true\" relayDTMF=\"true\">name</Conference><Redirect method=\"POST\">url</Redirect><Play loop=\"10\">url</Play><Speak voice=\"Polly.Mads\" language=\"da-DK\" loop=\"10\">ssml<prosody pitch=\"pitch\">first prosody</prosody><emphasis level=\"strong\">emphasis on this</emphasis><say-as interpret-as=\"characters\">ALPHABETS</say-as><prosody rate=\"slow\">slow<prosody pitch=\"low\">low and slow</prosody></prosody></Speak><Hangup reason=\"test\" schedule=\"10\"></Hangup></Response>", ResponseElement{
assert.Equal(t, "<Response><Message src=\"123\" dst=\"321\" type=\"sms\" callbackUrl=\"url\" callbackMethod=\"POST\">Plivo®</Message><Record action=\"action\" method=\"POST\" fileFormat=\"fileformat\" redirect=\"true\" timeout=\"10\" maxLength=\"100\" playBeep=\"true\" finishOnKey=\"key\" recordSession=\"true\" callbackUrl=\"url\" callbackMethod=\"POST\"></Record><Dial action=\"action\" method=\"POST\" hangupOnStar=\"true\" timeLimit=\"10\" timeout=\"10\" callbackUrl=\"url\" callbackMethod=\"POST\" redirect=\"true\" digitsMatch=\"123\" sipHeaders=\"h=1\" machineDetection=\"true\"><Number sendDigits=\"123\" sendOnPreanswer=\"true\">123</Number><User sendDigits=\"123\" sendOnPreanswer=\"true\" sipHeaders=\"header=1\">user</User></Dial><DTMF async=\"true\">123</DTMF><Wait length=\"10\" silence=\"true\" minSilence=\"10\" beep=\"true\"></Wait><PreAnswer><Speak voice=\"MAN\" language=\"en\" loop=\"10\">text</Speak></PreAnswer><GetDigits action=\"action\" timeout=\"10\" digitTimeout=\"10\" finishOnKey=\"#\" numDigits=\"10\" retries=\"10\" redirect=\"true\" playBeep=\"true\" validDigits=\"123\" invalidDigitsSound=\"sound\"></GetDigits><GetInput action=\"action\" method=\"GET\" inputType=\"Speech\" executionTimeout=\"10\" digitEndTimeout=\"20\" speechEndTimeout=\"30\" finishOnKey=\"#\" numDigits=\"10\" speechModel=\"default\" hints=\"1 2 3\" language=\"en-us\" interimSpeechResultsCallback=\"interimCallback\" interimSpeechResultsCallbackMethod=\"POST\" redirect=\"true\" log=\"false\"><Speak voice=\"WOMAN\" language=\"en-US\" loop=\"1\">Tell us more about your experience</Speak></GetInput><Conference muted=\"true\" enterSound=\"sound\" exitSound=\"sound\" startConferenceOnEnter=\"true\" endConferenceOnExit=\"true\" stayAlone=\"true\" waitSound=\"sound\" maxMembers=\"10\" record=\"true\" recordFileFormat=\"rff\" timeLimit=\"10\" hangupOnStar=\"true\" action=\"action\" method=\"method\" callbackUrl=\"url\" callbackMethod=\"method\" digitsMatch=\"123\" floorEvent=\"true\" redirect=\"true\" relayDTMF=\"true\">name</Conference><Redirect method=\"POST\">url</Redirect><Play loop=\"10\">url</Play><Speak voice=\"Polly.Mads\" language=\"da-DK\" loop=\"10\">ssml<prosody pitch=\"pitch\">first prosody</prosody><emphasis level=\"strong\">emphasis on this</emphasis><say-as interpret-as=\"characters\">ALPHABETS</say-as><prosody rate=\"slow\">slow<prosody pitch=\"low\">low and slow</prosody></prosody></Speak><Hangup reason=\"test\" schedule=\"10\"></Hangup></Response>", 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{}{
Expand Down
Loading