CallXML 3.0 Development Guide Home  |  Frameset Home


<goto>  element


This element can either:
Leap to another block of CallXML actions in the current file, by specifying value="#blocklabel", or
Perform an HTTP(S)/FTP to fetch a new CallXML document, by specifying value="url"

The rule for goto is that you can go to:

When used to fetch a new CallXML document, the submit attribute can be used to pass CallXML browser variables with the HTTP(S)/FTP operation used to request the new document.


usage

<goto cache="(yes|no)" id="(element id)" method="(GET|POST|BIN|ASC)" submit="(variable name)" test="CDATA" value="string - URI" value-is="STRING" value-is-not="STRING">


attributes

cache Data Type: (yes|no) Default: none - attribute is optional
Allows manual override over the caching mechanism. If this attribute is empty the default system caching is used. "yes" should force the system to use the cache all the time, "no" means that no cache should be used at all.
id Data Type: (element id) Default: none - attribute is optional
The new 'id' attribute in CallXML3.0 is applicable to all container and action elements. Specifying this attribute allows yet another level of control and event handling when events occur and are caught by the <on> element. When an event occurs, the handler will first check the event, and then verify that the handler has a handler specific to the 'id' attribute to execute. This allows the developer to plan a specific course of action for events based on where in the application that they occur.
method Data Type: (GET|POST|BIN|ASC) Default: none - attribute is optional
The method attribute specifies the HTTP method to use when sending the request. Allowable values for the method attribute are:
  • "get" for HTTP GET
  • "post" for HTTP POST
  • "bin" for FTP binary transport
  • "asc" for FTP ASCII transport

  • Any other values defined for this attribute will result in a fatal error. If no method is specified, then it will always default to 'GET'.
submit Data Type: (variable name) Default: none - attribute is optional
List of variables to submit to the called URL/URI can be "all" or "*" for everything, or a comma delimited list of variables to submit:

submit = "Variable1, Variable2, Variable3, Variable5, Variable9"

Note that you can also specify "nothing" if no variables are to be submitted. If non-existant variable names are specified a fatal error will result. Also, if "all" or "*" is specified, no other variable names should be listed with it.
test Data Type: CDATA Default: Optional
The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document.
value Data Type: string - URI Default: none - attribute is required
Either a full URL (http://MyServer.com/MyDocument.xml) or a local URI pointing to a <block> label in the same CallXML file (e.g., #main_menu).

Supported URL formats include:
  • http://    Read data
  • https://  Read data (over a secure connection)
  • ftp://      Read data
An empty or invalid value will result in a fatal error. Invalid values are:
  • value="[optional url]#"
  • value="[optional url]#foo", and "foo" does not exist as a label in the document
Domain names can contain port numbers and login information, for instance:

value="ftp://me:door@ftp.me.com:2345/myapp/start.xml"
value-is Data Type: STRING Default: none - attribute is optional
Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution.
value-is-not Data Type: STRING Default: none - attribute is optional
Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution.



code samples

<3.0 goto-value>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <prompt>
      Going places is always fun. Lets go to another container.
    </prompt>
    <goto value="#B3"/>
  </do>

  <do label="B2">
    <prompt>
      Thats right. this container will be skipped entirely.
    </prompt>
  </do>

  <do label="B3">
    <prompt>
      Whee. We are now in container label B 3.
    </prompt>
  </do>

</callxml>



<3.0 goto cache-submit-method<
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">

    <assign var="Var_1" value="Kubrick"/>
    <prompt>
      Lets go to an entirely separate page.
      While we are at it, lets send our variable along
      for the ride as well.
    </prompt>

    <goto value="Goto_Target.xml" submit="Var_1" cache="yes" method="get"/>

  </do>
</callxml>



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

<callxml version="3.0">
  <do label="B1">
    <say>     
      Hey, we made it to our second document.
      And our variable, with a value of $Var_1; made it, too!
    </say>
  </do>
</callxml>


<3.0 goto valueis>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1" value="foo">
    <prompt>
      Going places is always fun. Lets go to another block.
    </prompt>

<!-- this will be skipped, as 'foo' is not equal to 'bar' -->
    <goto value="#B2" value-is="bar"/>

<!-- this will not be skipped, as 'foo' is equal to 'foo' -->
    <goto value="#B3" value-is="foo"/>
  </do>

  <do label="B2">
    <prompt>
      Finally at the end of our long journey,
      we have executed block label B 2.
    </prompt>
  <exit/>
  </do>

  <do label="B3" value="bonk">
    <prompt>
      Whee. We are now in block label B 3.
    </prompt>

<!-- this will be skipped, as 'bonk' is equal to 'bonk' -->
    <goto value="#B2" value-is-not="bonk"/>

<!-- this will not be skipped, as 'honk' is not equal to 'bonk' -->
    <goto value="#B2" value-is-not="honk"/>
  </do>

</callxml>



<3.0 goto-test>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <prompt>
      Going places is always fun. Lets go to another block.
    </prompt>

<!-- this will be skipped, as 'foo' is not equal to 'bar' -->
    <goto value="#B2" test="'foo' = 'bar'"/>

<!-- this will not be skipped, as 'foo' is equal to 'foo' -->
    <goto value="#B3" test="'foo' = 'foo'"/>
  </do>

  <do label="B2">
    <prompt>
      Finally at the end of our long journey,
      we have executed block label B 2.
    </prompt>
  <exit/>
  </do>

  <do label="B3" value="bonk">
    <prompt>
      Whee. We are now in block label B 3.
    </prompt>

<!-- this will be skipped, as 'bonk' is equal to 'bonk' -->
    <goto value="#B2" test="'bonk' != 'bonk'"/>

<!-- this will not be skipped, as 'honk' is not equal to 'bonk' -->
    <goto value="#B2" test="'honk' = 'bonk'"/>
  </do>

</callxml>




additional links

none


  ANNOTATIONS: EXISTING POSTS
emspms
8/17/2007 1:54 PM (EDT)
HUGE Gotcha....
While you can goto another file...
<goto value="Goto_Target.xml" submit="Var_1" method="get"/>

Method may be (GET|POST|BIN|ASC)

This is not always the case.

Some Webservers (IIS verified, others untested) will not allow a "POST" to a .xml page.

There may be custom configurations available for IIS or other servers, but by default you will receive a 405 error when performing POST to 'anyfile.xml'.

This came to light when using <prompt choices="yes, no">
inside a document, choices="" adds a variable called "settings" with a large value-string, overflowing method="GET", the debugger log suggests changing to method "POST" (easy right... No. See above).

Resolution: if you are using CF, ASP, etc. etc. Name your destination document with a post accepting extension (.cfm, .asp, etc etc)
mikethompson
8/17/2007 2:09 PM (EDT)
Hi Aaron,

This is outstanding information for our documentation.  Thank you for contributing to our developer knowledge base. :)

Best,
Mike Thompson
Voxeo Corporation
jpw
2/6/2008 1:31 PM (EST)
this is apparently still undocumented: you do NOT need to use 'submit=' if using static xml files. Eg, if you break a static xml file app into multiple documents, the variable space is shared automatically between docs when you use <goto>.
emspms
4/24/2008 3:11 PM (EDT)
Correct
The submit="variable(s)"
is best used for appending the variables to the URL of the destination document, allowing server side processign languages to read your callXML variables.

IE: coldfusion, java, asp, can read the variables from the url, where they cannot access the callXML variable space.
StanBioMed
2/4/2009 1:50 PM (EST)
<on event="choice:1" >
<goto value="http://localhost/krish/mainmenu.aspx"  submit="*" method="get"/>
</on>


Above coding is not work for me.


but when i gave the goto tag outside the event it is working.

and alos the below coding is also working for me.

<on event="choice:1" >
<goto value="http://localhost:8080/krish/mainmenu.asp"  submit="*" method="get"/>
</on>


I didn't know what was going wrong.

need some help in this code.

Thanks in advance
voxeojeff
2/4/2009 2:12 PM (EST)
Hi there,

While I am not familiar with your local setup, you'll more than likely need to specify the proper port after "localhost" just like you did in the example which worked.  For example,

<goto value="http://localhost:80/krish/mainmenu.aspx"  submit="*" method="get"/>

Have you given this a try yet?

Regards,
Jeff Menkel
Voxeo Corporation

login



© 2012 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site