CCXML 1.0-W3C Development GuideHome  |  Frameset Home


<elseif>  element

The elseif element is used to specify additional content when all other else or if  statements equate to ‘false’.  When a series of if-elseif-else statements are encountered, the application will execute the first one which evaluates to ‘true’.


usage
<elseif cond="(ECMAScript Expression)">


attributes
condData Type: (ECMAScript Expression)Default: none - attribute is required
The cond attribute specifies an ECMAScript expression which can be evaluated to 'true' or 'false'. A condition must evaluate to 'true' in order for any enclosed operations to be performed.



parents
none


children
none


code samples
<1.0 elseif -cond> sample
<ccxml version="1.0">

  <var name="initState" expr="'state_1'"/>
  <var name="MyCallID"/>

  <eventprocessor statevariable="initState">

    <transition event="connection.alerting" state="state_1">
      <assign name="MyCallID" expr="event$.connectionid"/>
        <log expr="'***** MYCALLID =' + MyCallID + '****' "/>
      <send name="'MyEvent'" target="session.id"/> 
    </transition>

    <transition event="MyEvent">
        <accept connectionid="MyCallID"/>     
    </transition>

    <transition event="connection.connected">
      <log expr="'***** CALL WAS ANSWERED *****'"/>
    <if cond="MyCallID == '4075551234'">
        <log expr="'*** \'IF\' CONDITION IS TRUE ***'"/>
        <dialogstart src="'null://?text=Your caller ID must be 4 0 7 5 5 5 1 2 3 4'" type="'application/x-texttospeech'"/>

      <elseif cond="MyCallID == '4075554321'"/>
        <log expr="'*** \'ELSEIF\' CONDITION IS TRUE ***'"/>
      <dialogstart src="'null://?text=Your caller ID must be 4 0 7 5 5 5 4 3 2 1'" type="'application/x-texttospeech'"/> 

      <else/>
        <log expr="'*** \'ELSE\' STATEMENT REACHED ***'"/>
              <dialogstart src="'null://?text=Your caller ID is neither 4 0 7 5 5 5 1 2 3 4,
                            or 4 0 7 5 5 5 4 3 2 1'" type="'application/x-texttospeech'"/>
      </if>
    </transition>

    <transition event="dialog.exit">
      <log expr="'***** CALL EXITING *****'"/>
      <exit/>
    </transition>
  </eventprocessor>

</ccxml>



additional links
W3C Specification


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



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