# <mark>

Description

(VoiceXML 2.1 feature) This feature is not supported in Dialogic IP Media Server release 2.4.

As described in section 3.3.2 of [SSML], the `<mark>` element places a marker into the text/tag sequence. An SSML processor must either allow the VoiceXML interpreter to retrieve information, or must inform the interpreter, when a `<mark>` is executed during audio output. The `<mark>` element provides a convenient way to detect at which point a user barge-in has occurred.

For details on using `<mark>` within SSML, click here.

Note: The `<vxml>` `version` attribute must be specified as 2.1 (or higher) to use this feature. If the `version` is specified otherwise, the `<mark>` element will not be recognized and will be treated as an invalid child element.

Syntax

    <mark
        name="string"
        nameexpr="ECMAScript_Expression"/>

Attributes

Attribute | Description
name | The name of this mark. This name is used when setting appropriate shadow variables as described below. Optional.
nameexpr | An ECMAScript expression to be evaluated and used as the `name` of the mark, as above. Optional.

Attribute Notes

- If `nameexpr` cannot be evaluated, an `error.semantic` event is thrown.

Shadow Variables

The following two properties on the `application.lastresult$` object are set whenever the `application.lastresult$` object is assigned (e.g. a `<link>` is matched) and a `<mark>` has been executed:

- `application.lastresult$.markname` - the name of the mark last executed by the SSML processor before barge-in occurred or the end of audio playback occurred. If no mark was executed, this variable is `undefined`.
- `application.lastresult$.marktime` - the number of milliseconds that elapsed since the last mark was executed by the SSML processor, until barge-in occurred or the end of audio playback occurred. If no mark was executed, this variable is `undefined`.

Note: When a `<mark>` is executed during the processing of a form item (ex. `<field>`, `<record>`, etc.), the interpreter also sets `itemName$.markname` and `itemName$.marktime` shadow variables for the form item, with the same values used for the lastresult shadow variables above.

Parents

<foreach>, <prompt>

Children

None.

Extensions

None.

Limitations/Restrictions

- Currently, `<mark>` is not supported as a child of `<audio>`, `<enumerate>`, or any SSML tag.
- `<mark>` is only supported as a child of `<foreach>` when `<foreach>` is used within `<prompt>`.
- Use of this feature depends on whether or not the SSML processor (i.e., the TTS engine) supports `<mark>`. That is, when a `<mark>` is executed during audio output, if the SSML processor neither allows the VoiceXML interpreter to retrieve the mark information nor informs the interpreter about the mark, then the interpreter will not have any mark information to store in the `markname` and `marktime` variables. Refer to your TTS vendor documentation for support details.

Example

Note: Some versions of RealSpeak may only support numeric mark names (ex., "1234"). In that case, the following example would need to be modified. Please see vendor documentation for details.

    <?xml version="1.0"?>
    <vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
      <var name="played_ad" expr="false"/>
      <form>
        <field name="field1" type="boolean">
          <prompt>
            <mark name="ad_start"/>
            Baseball scores brought to you by Elephant Peanuts.
            There's nothing like the taste of fresh roasted peanuts.
            Elephant Peanuts. Ask for them by name.
            <mark name="ad_end"/>
            <break time="500ms"/>
            Would you like to continue?
          </prompt>
          <filled>
            <if cond="typeof(field1$.markname) == 'string' &amp;&amp;
               (field1$.markname=='ad_end' ||
               (field1$.markname=='ad_start' &amp;&amp;
                  field1$.marktime &gt;= 5000))">
              <assign name="played_ad" expr="true"/>
            <else/>
              <assign name="played_ad" expr="false"/>
            </if>
          </filled>
        </field>
      </form>
    </vxml>