We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Use variable(s) for audio source/expression

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
Sparker
Posts: 14
Joined: Tue Jan 27, 2015 10:48 am

Use variable(s) for audio source/expression

Post by Sparker »

Hi!

I am trying to dynamically create the audio source/expression for my application. In a nutshell, I have questions with a variety of answer options. Based on the question, I need to present the options to the user. I know you are not an ASP/C# shop, however that is what I'm bound to... I have tried for a day and a half to do this and cannot figure it out...even with the examples I've seen...so--here is some code that I've tried--thinking that it should work, but it doesn't. It will ask the question and take my answer--however it will NOT tell me the possible choices--I just have to "guess" at what I can answer. The line in my logs say:
errno: 999 message Something tag-like was found in your expr and is being sent as-is to the TTS engine. This is deprecated.

Code: Select all

        <subdialog name="tryQuest" src="http://XXXXX/playQuestions.aspx">
            <filled>
                <if cond="tryQuest.qSkip==1">
                    <goto next="#questionForm" />
                    <clear />
                <else />
                    <assign name="questionToAsk" expr="tryQuest.qPrompt" />
                    <assign name="questionUrl" expr="tryQuest.aPrompt" />
                    <assign name="questionOptions" expr="tryQuest.oPrompt" />
                    <assign name="optionsUrl" expr="tryQuest.oaPrompt" />                   ***this is the string with my options***
                    <assign name="voiceGrammarExp" expr="tryQuest.gPrompt" />
                    <assign name="dtmfGrammarExp" expr="tryQuest.dPrompt" />
                    <assign name="qSkip" expr="tryQuest.qSkip" />
                    <assign name="qInstruction" expr="tryQuest.qInstruction" />
                </if>
            </filled>
        </subdialog>

      <field name="qAnswer">
            <%--add grammar for voice and dtmf
            as well as grammar for # to repeat question
            and "repeat" to repeat question--%>
            <grammar srcexpr="voiceGrammarExp" />
            <grammar srcexpr="dtmfGrammarExp" />
            <grammar>^"#"$</grammar>
            <grammar>"repeat"</grammar>
            <prompt>
                <value expr ="optionsUrl" />                 
            </prompt>  
according to the log, the string being returned from the subdialog code behind is:
VXI::var_element(name="oaPrompt" expr = "'<audio src="http://dev-tachl.mdc.musc.edu/IVR_Cats/ ... "/></audio>'")

Which is the correct path to the audio file. If I simply use that without returning it from the subdialog, it works fine. However I need to build it like this b/c I may have to return something that actually has TWO or MORE audio sources/expressions, so I would need the ability to return something like:

VXI::var_element(name="oaPrompt" expr = "'<audio src="http://xxxx/IVR_Cats/IVRRecordings/Yes1 ... dio><audio src="http://dev-tachl.mdc.musc.edu/IVR_Cats/ ... "/></audio>'")

Also--I can not build this up ahead of time--I have to do it question by question because the questions/answers are presented in a dynamic way--based on individual responses.

Any assistance would be greatly appreciated! Thanks!
Shawntel

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Use variable(s) for audio source/expression

Post by support »

Hi Shawntel,

We do not recommend outputting VXML using the <value> tag. Since VXML files are generally static, when you attempt to use the value tag to output VXML, the platform will interpret that as plain text for the TTS engine to read, rather than VXML logic.

Instead, you can dynamically pass the url to your audio file to an <audio> tag in your prompt. Here's an example:

Code: Select all

        <subdialog name="tryQuest" src="http://XXXXX/playQuestions.aspx">
            <filled>
                **NOTE: Here, pass the url to the audio instead of the audio vxml**
                <assign name="optionsUrl" expr="tryQuest.oaPrompt" />
            </filled>
        </subdialog>

      <field name="qAnswer">
            <%--add grammar for voice and dtmf
            as well as grammar for # to repeat question
            and "repeat" to repeat question--%>
            <grammar srcexpr="voiceGrammarExp" />
            <grammar srcexpr="dtmfGrammarExp" />
            <grammar>^"#"$</grammar>
            <grammar>"repeat"</grammar>
            <prompt>

                ** NOTE: and here, the audio tag will play the audio from the URL stored in 
                **       "optionsUrl". Note that we use an "expr" property instead of a "src"
                **       property
                <audio expr="optionsUrl"></audio> 

            </prompt>
Regards,
Plum Support

Post Reply