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

Root document isn't maintaning variables across two files

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
pkeogan
Posts: 4
Joined: Thu Jun 26, 2008 4:07 pm

Root document isn't maintaning variables across two files

Post by pkeogan »

Our Root document isn't maintaning variables across two files. We are defining our variables in our root document. (see code below)

<script><![CDATA[
application.callLength = 0;
application.callstartTime = 0;
application.serviceUrl = 'http://www.liveconx.com/liveconxdev/liv ... .asmx?wsdl';
application.targetNumber = 0;
application.trans_id;
application.callDurationSeconds;
application.date_obj = new Date();
application.audio_folder = 'LUM';
application.INTV_DOC_NAME='Root';
application.INTV_ERROR_COUNT=0;
application.INTV_NOINPUT_COUNT=0;
application.INTV_NOMATCH_COUNT=0;
application.INTV_CONFIRM_COUNT=0;
application.INTV_RETURN_VALUE;
application.INTV_RETURN_LEG;
application.INTV_NULL;
if (typeof(application.INTV_CLEANUP_COMPLETE) == 'undefined')
{
application.INTV_CLEANUP_COMPLETE = false;
}
]]></script>


The second document assigns values to the variables in the root document

Next, a third VXML file is executed. The values passed to this third document revert to the root document, the values assigned in the second documen gt are lost.

We've added voice prompts to both the 2nd and 3rd document. So, we know that the 2nd document is properly assigning values to the variables.


The 2nd document is:http://www.liveconx.com/liveconxdev/vxm ... _plum.aspx.

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

IVR developers unable to replicate issue

Post by support »

Hi,

Could you also provide the 3rd document as well?

We've tried to replicate your IVR issue with the following IVR code, but were unable to do so:

Root.aspx

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1" xml:lang="en-US" xmlns="http://www.w3.org/2001/vxml" >
    <!--  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml 
http://www.w3.org/TR/voicexml21/vxml.xsd"  -->
    <!--  Application: Root was export by  -->
    <!--  Purpose:  -->
    <!--  Date: Mon Jun 23 16:33:00 EDT 2008 -->
    <!--  Studio Version: Version 2.7.1.11920 -->
 <script>
<![CDATA[
      application.callLength = 0;
      application.callstartTime;
      application.serviceUrl = 'http://www.liveconx.com/liveconxdev/liveconx_callservice.asmx?wsdl';
      application.targetNumber = 0;
      application.trans_id;
      application.callDurationSeconds;
      application.date_obj = new Date();
      application.audio_folder = 'LUM';
      application.INTV_DOC_NAME='Root';
      application.INTV_ERROR_COUNT=0;
      application.INTV_NOINPUT_COUNT=0;
      application.INTV_NOMATCH_COUNT=0;
      application.INTV_CONFIRM_COUNT=0;
      application.INTV_RETURN_VALUE;
      application.INTV_RETURN_LEG;
      application.INTV_NULL;
      if (typeof(application.INTV_CLEANUP_COMPLETE) == 'undefined')
      {
         application.INTV_CLEANUP_COMPLETE = false;
      }
]]>
</script>
 
    <script>
     if (typeof(application.voice) != 'object')
     {
        application.voice = new Object();
     }
     if (typeof(application.voice.languageCountry) != 'string')
     {
        application.voice.base = '';
        application.voice.speaker = '0';
        application.voice.languageCountry = '';
     }
     function audiourl(voiceset, msgnumber) {
       if (application.voice.languageCountry.length == 0)
          return String(application.voice.base + voiceset + '/m' + msgnumber.toString() + '.wav');
       else
          return String(application.voice.base + voiceset + '/' + getLanguageCountry() + '/' + getSpeaker() + '/m' + msgnumber.toString() + '.wav');}
     function getLanguageCountry() {
       return application.voice.languageCountry.toString();}
     function getVoiceBase() {
       return application.voice.base.toString();}
     function getSpeaker() {
       if (application.voice.speaker==null)
          return '0';
       else
          return application.voice.speaker.toString();}
     function setSpeaker(newSpeaker) {
       application.voice.speaker = newSpeaker;
       return getSpeaker();}
     function setLanguageCountry(newLanguage,newCountry) {
       application.voice.languageCountry = String(newLanguage) + '-' + String(newCountry);
       return getLanguageCountry();}
     function setVoiceBase(newVoiceBase) {
       application.voice.base = String(newVoiceBase);
       return getVoiceBase();}
     function getMessageArray(voiceset, msgnumber) {
        var vsMsgArray=new Array();
        vsMsgArray[0]=audiourl(voiceset, msgnumber);
       return vsMsgArray;}
     function INTV_CheckTime(anHour, aMin) {
       var time1 = new Date();
       time1.setHours(anHour);
       time1.setMinutes(aMin);
       return time1 < new Date();}
     function buildURL(base,path) {
       var baseLength=base.length;
       var pathLength=path.length;
       var tempBase= (base.lastIndexOf('/') == (baseLength-1) ? base.substring(0,baseLength-1) : base);
       var tempPath= (path.indexOf('/') == 0 ? path.substring(1,pathLength) : path);
       return String(tempBase + '/' + tempPath);}
     function buildPercentValue(value) {
       return String(value) + '%';}
   </script>


   <form id="intvcleanup">
      <catch event="connection.disconnect telephone.disconnect" >
         <!-- Don't Log expected Hangup or Transfer events. -->
      </catch>
      <catch event="." >
         <log label="IVB_HISTORY"><value expr="'Unexpected Event Received in intvcleanup! EVENT='+ _event + '   MESSAGE=' +_message"/></log>

      </catch>
      <property name="fetchtimeout" value="60s" />
      <block>
         <assign name="application.INTV_CLEANUP_COMPLETE" expr="true"/>
         <exit />
      </block>
   </form>



   <catch event="MenuError" >
      <prompt bargein="true">
         <value expr="&apos;Please try your entry again&apos;"/>
      </prompt>
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="MenuTimeout" >
      <throw event="com.intv.application.event.reprompt" />

   </catch>

   <catch event="AskTimeout" >
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="AskError" >
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="RecordError" >
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="HostError" >
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="SpeechError" >
      <throw event="com.intv.application.event.reprompt" />

   </catch>

   <catch event="SpeechConfirm" >
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="SpeechNoMatch" >
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="SpeechNoInput" >
      <throw event="com.intv.application.event.reprompt" />
   </catch>

   <catch event="error.badfetch" >
      <throw event="com.intv.application.event.exit_form" />
   </catch>

   <catch event="error.noresource" >
      <throw event="com.intv.application.event.reprompt" />

   </catch>




   <catch event="connection.disconnect telephone.disconnect" >
      <goto expr="INTV_DOC_NAME == &apos;Root&apos; ? &apos;#intvcleanup&apos; : &apos;./Root.vxml#intvcleanup&apos;"/>
   </catch>

   

   <form id="IVI_DUMPER_ERROR" >
      <block>

         <log label="IVB_HISTORY"><value expr="'InVision VoiceXML File Generation Error.'" /></log>
         <exit/>
      </block>
   </form>
   <catch event="com.intv.application.event.reprompt" >
      <reprompt/>
   </catch>
   <catch event="com.intv.application.event.noreprompt" >
   </catch>

   <error>
      <log label="IVB_HISTORY"><value expr="'ERROR EVENT='+ _event + '   MESSAGE=' +_message"/></log>
      <exit />
   </error>
   <catch event=".">
      <log label="IVB_HISTORY"><value expr="'UNEXPECTED EVENT='+ _event + '   MESSAGE=' +_message"/></log>
      <exit />
   </catch>

</vxml>
Main1.aspx:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" application="Root.aspx">
    <!--  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd"  -->
    <!--  Application: conx_outbound was export by  -->
    <!--  Purpose:  -->
    <!--  Date: Tue May 20 14:41:29 EDT 2008 -->
    <!--  Studio Version: Version 2.7.1.11920 -->

<property name="scriptmaxage" value="0"/>
<property name="scriptmaxstale" value="0"/>

   <form id="INTRO" >
      <block>
        <assign name="application.trans_id" expr="1270" />
        <assign name="application.targetNumber" expr="6107015838" />
        <assign name="application.callLength" expr="0" />

        <prompt>
            The maximum call length is<break/><value expr="application.callLength"/><break/>
            The target number is<break/><value expr="application.targetNumber"/><break/>
            The transaction id is <break/><value expr="application.trans_id"/><break/>
        </prompt>
        <goto next="Main2.aspx" maxage="20" />
      </block>
   </form>
</vxml>
Main2.aspx:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" application="Root.aspx">
    <!--  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd"  -->
    <!--  Application: conx_outbound was export by  -->
    <!--  Purpose:  -->
    <!--  Date: Tue May 20 14:41:29 EDT 2008 -->
    <!--  Studio Version: Version 2.7.1.11920 -->

<property name="scriptmaxage" value="0"/>
<property name="scriptmaxstale" value="0"/>

   <form id="INTRO" >
      <block>
        <prompt>
            The maximum call length is<break/><value expr="application.callLength"/><break/>
            The target number is<break/><value expr="application.targetNumber"/><break/>
            The transaction id is <break/><value expr="application.trans_id"/><break/>
        </prompt>
      </block>
   </form>
</vxml>
When we call into Main1.aspx, the <var>s get assigned properly and when it transitions to Main2.aspx, the <var>s retain the assignments given to them in Main1.aspx.

Hope this helps.

Regards,
Plum Support
Last edited by support on Thu Feb 18, 2010 4:48 pm, edited 4 times in total.

pkeogan
Posts: 4
Joined: Thu Jun 26, 2008 4:07 pm

The resolution was to place the files in the same folder

Post by pkeogan »

We decided to place all of our files in the same folder so that your platform wouldn’t have any issues resolving relative URLs.

It is interesting that platform resolved the URLS correctly, but internally your platform identified the file as two different sources.

Maybe it's already in your documentation, but you should inform people to have all of their files in the same folder.

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

IVR system alternative to storing all files in one folder

Post by support »

Hi,

Alternatively, when using the IVR platform, you can just use an absolute full URL when specifying the root document in all of your leaf documents instead of putting all of your files into one folder.

We advise against using relative URLs when specifying the root attribute across leaf documents in disparate directories.

Regards,
Plum Support

Post Reply