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

Workflow question

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
fkuhne
Posts: 21
Joined: Mon Nov 20, 2006 10:21 pm

Workflow question

Post by fkuhne »

Hello,

In our application we have to support the following scenario.

1) Retrieve a list of dates
2) Read the dates to the user

As each date is read to the user we need to update the database to specify that the user heard that date. This update cannot interrupt the workflow for the end user. It must be seamless.

My initial thought is to have a subdialog pointed to an aspx page for each date in the list which accepts some variables from the ivr form (an id related to the date or similar) and submits that to the database. This aspx page would not (or could if it had to) return any vxml.

Something like

Code: Select all

<form id="form1">
    <var name="someidvariable"/>
    <block>
     <assign name="someidvariable" expr="1234"/>
     <subdialog name="submitdata1" src="updatedatesindatabase.aspx" namelist="someidvariable" />
      <prompt>
        <voice name="crystal">
          <break size="medium" />On Monday, December 01, 2008 at 12:00:00 PM you have to take out the trash.</voice>
      </prompt>
    </block>
    <field name="menufield">
      <prompt>
        <voice name="crystal">
          <break size="medium" />Press or say one to Hear again<break size="medium" />Press or say 2 to hear Next Date<break size="medium" />Press or say Star to go back to the Main Menu.</voice>
      </prompt>
      <grammar>1|2|"*"|"star"</grammar>
      <filled>
        <if cond="menufield=='1'">
          <goto next="#form1" />
          <elseif cond="menufield=='2'" />
          <goto next="#form2" />
          <elseif cond="menufield=='star'" />
          <goto next="#mainmenu" />
          <elseif cond="menufield=='*'" />
          <goto next="#mainmenu" />
        </if>
      </filled>
    </field>
  </form>

Page_Load in .aspx page (obvious pseudocode)

Code: Select all

UpdateDatabase(Request.Form("someidvariable"))
I have two questions about that
1) Is that an appropriate use of subdialogs? ... Is there a better way to do that?
2) Does a subdialog have to return VXML or variables? If so, what is the minimum that can be returned for this to function?

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

IVR code uses <subdialog> tag correctly

Post by support »

Hi,

1) Yes, your IVR code appears to be using the IVR tag, <subdialog>, correctly. However, since your aspx isn't returning anything back to your vxml script, you should just use the IVR tag, <submit>, instead of the IVR tag, <subdialog>.

The following documentation should help:

http://www.plumvoice.com/docs/dev/devel ... taexchange
http://www.plumvoice.com/docs/dev/voicexml:tags:submit
http://www.plumvoice.com/docs/dev/voice ... :subdialog

2) Yes, generally, subdialog pages return variables to the main vxml page. The minimum is one variable should be returned.

Regards,
Plum Support
Last edited by support on Wed Feb 24, 2010 3:03 pm, edited 6 times in total.

fkuhne
Posts: 21
Joined: Mon Nov 20, 2006 10:21 pm

Post by fkuhne »

But won't using a submit tag cause the app to navigate away from the current vxml script? That was the impression I was under.

I read the documentation pages you listed before I posted. There wasn't a clear example of the scenario I need.

Can you provide a quick example of a vxml script that will submit data to a web page and continue on with the rest of the script after doing so?

fkuhne
Posts: 21
Joined: Mon Nov 20, 2006 10:21 pm

Post by fkuhne »

fkuhne wrote:But won't using a submit tag cause the app to navigate away from the current vxml script? That was the impression I was under.

I read the documentation pages you listed before I posted. There wasn't a clear example of the scenario I need.

Can you provide a quick example of a vxml script that will submit data to a web page and continue on with the rest of the script after doing so?
The <submit> element is used to submit information to the origin web server and then transition to the document sent back in the response.

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

IVR code to use <subdialog> tag

Post by support »

Hi,

Sorry, I had misread your initial post.

From your IVR code, you could use the <subdialog> to transition to your aspx page (for the date update) and return a variable that doesn't have to be used within your main vxml script.

If you are experiencing IVR issues with your IVR code, you could provide another small snippet of your IVR code and we could help you better implement it.

Regards,
Plum Support
Last edited by support on Wed Feb 24, 2010 3:04 pm, edited 4 times in total.

fkuhne
Posts: 21
Joined: Mon Nov 20, 2006 10:21 pm

Post by fkuhne »

I got it working, thanks. The submission aspx page creates a form level variable which just returns the id passed to it. This is useful for verification of the value in the call log also. For anyone else looking for how to do it the code we are using is below. Now on to logging transfers.

MainVXML snippet

Code: Select all

<form id="form1">
  <var name="DateId" expr="'2'"/>
  <subdialog src="http://domain.com/submitdatenotification.aspx" name="submitdatenotification" namelist="DateId" method="post"/>
  <block>
    <prompt>
      <voice name="crystal">
      <break size="medium"/>
        On Monday, December 01, 2008 at 12:00:00 PM ... rest of prompt
      </voice>
    </prompt>
  </block>
  <field name="menufield">
    <prompt>
      <voice name="crystal">
        <break size="medium"/>
        Press or say one to Hear again
        <break size="medium"/>
        Press or say 2 to hear Next Date
        <break size="medium"/>
        Press or say Star to go back to the Main Menu.
      </voice>
    </prompt>
  <grammar>1|2|"*"|"star"</grammar>
  <filled>
    <if cond="menufield=='1'">
      <goto next="#form1"/>
    <elseif cond="menufield=='2'"/>
      <goto next="#form2"/>
    <elseif cond="menufield=='star'"/>
      <goto next="#mainmenu"/>
    <elseif cond="menufield=='*'"/>
      <goto next="#mainmenu"/>
    </if>
  </filled>
  </field>
</form>
submitdatenotification.aspx

Code: Select all

Response.Write("<?xml version=""1.0""?>" + vbCrLf + "<vxml version=""2.0"">" + vbCrLf + _
                "<form>" + vbCrLf + "<block>" + vbCrLf + _
                "  <var name=""DateSubmitted"" expr=""'" + DateId+ "'"" />    " + vbCrLf + _
                "  <return namelist=""DateSubmitted""/>" + vbCrLf + _
                "  </block>" + vbCrLf + "</form>" + vbCrLf + "</vxml>")
Returned to main VXML Script

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <block>
      <var name="DateSubmitted" expr="'2'"/>
      <return namelist="DateSubmitted"/>
    </block>
  </form>
</vxml>

Post Reply