twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
271 stars 40 forks source link

fix: SSML tag name capitalised issue #212

Closed abhishek-eltropy closed 9 months ago

abhishek-eltropy commented 9 months ago

Fixes

https://github.com/twilio/twilio-go/issues/207

Currently, in twilio go sdk, Ssml tags are capitalized causing error in TwiML apps.

Warning [12200](https://www.twilio.com/docs/api/errors/12200)
Message: XML Validation warning

As per twilio docs, updated the tag name for the supported TwiML tags.

Also, verified the same with the corresponding implementation in java sdk. Ref: https://github.com/twilio/twilio-java/tree/main/src/main/java/com/twilio/twiml/voice Ref Files:

Checklist

AsabuHere commented 9 months ago

These files are auto generated in every release(if there are new changes). This fix need another PR to yoyodyne repo which generates these files. Otherwise these changes will be overwritten in the next release. The yoyodyne changes needs a detailed analysis and more work which may take some more time. We will keep the issue thread posted about the progress

abhishek-eltropy commented 9 months ago

@AsabuHere Ok. Thanks for the review and the explanation.

Since yoyodyne repo is internal to Twilio, I don't have access to it. I will close this PR then. Hope, Twilio team will fix this sooner.

AsabuHere commented 9 months ago

Sure, We are working on this issue in the current sprint. Can you share some code snippets with which this issue can be reproduced? Thanks in Advance

abhishek-eltropy commented 9 months ago
ssmlBreak := twiml.VoiceBreak{
    Time: "1s",
}

chooseQueueSay := twiml.VoiceSay{
    Message:       "Please select one of the following",
    Voice:         "Polly.Joanna-Neural",
    InnerElements: []twiml.Element{ssmlBreak},
}

say1 := twiml.VoiceS{
    Words: "Press 1 for Loans.",
}
say2 := twiml.VoiceS{
    Words: "Pres 2 for queries.",
}

chooseQueueSay.InnerElements = append(chooseQueueSay.InnerElements, say1, ssmlBreak, say2)

voiceResponse, err := twiml.Voice([]twiml.Element{chooseQueueSay})
if err != nil {
    fmt.Println("Error: ", err)
    return
}

fmt.Println("voiceResponse", voiceResponse)
abhishek-eltropy commented 9 months ago

Above snippet will generate following xml:

`<?xml version="1.0" encoding="UTF-8"?>

Please select one of the following Press 1 for Loans. Pres 2 for queries. ` However, it should be - ` Please select one of the following Press 1 for Loans. Pres 2 for queries. ` Please note that break and s tags were capitalized in the generated xml.