<dtmf ...> element


The dtmf element is used in telephony applications to specify possible DTMF inputs and a means of dealing with the collected results and other DTMF events. Like listen, its main elements are grammar and bind, and it holds resources for configuring the DTMF collection process and handling DTMF platform and collection events.


Attributes

Name Data type Default
endSilience
milliseconds
implied

id

ID
implied
initialTimeOut
milliseconds
implied

interDigitTimeOut

milliseconds
implied
onError
script.statement
implied
onKeyPress
script.statement
implied
onNoReco
script.statement
implied
onReco
script.statement
implied
onSilence
script.statement
implied
preFlush
boolean
"false"

Children

Parents

Properties

Methods

Examples

<html xmlns:salt="http://www.saltforum.org/2002/SALT">
...
    <input type="text" name="iptAreaCode" onFocus="dtmfAreaCode.Start()" />
    <input type="text" name="iptPhoneNumber" />
...
    <salt:dtmf id="dtmfAreaCode" onReco="dtmfPhoneNumber.Start()">
        
<!-- grammar result will contain "smlAreaCode" node -->
        <salt:grammar src="3digits.grxml" />
        <salt:bind value="//smlAreaCode" targetelement="iptAreaCode" />

    </salt:dtmf>
    <salt:dtmf id="dtmfPhoneNumber">
        
<!-- grammar result will contain "smlPhoneNumber" node -->
        <salt:grammar src="7digits.grxml" />
        <salt:bind value="//smlPhoneNumber"
                targetelement="iptPhoneNumber" />

    </salt:dtmf>

...
</html>

 

<html xmlns:salt="http://www.saltforum.org/2002/SALT">
...
    <body onload="RunAsk()">
        <form id="f1" action="http://www.example.com/savewaveform.aspx"
                 method="get">
            <input name="vmail" type="hidden" />
        </form>

         <!-- Prompts -->
        <salt:prompt id="p_record" oncomplete="l_recordvm.Start()">
            Please speak after the tone. You may press any key to end your recording.
        </salt:prompt>
        <salt:prompt id="p_save">
            Do you want to save this voicemail?
        </salt:prompt>

        <!-- listens -->
        <!-- Recording session - max 60 seconds recording -->
        <salt:listen id="l_recordvm"
                initialtimeout="3000"
                endsilence="1500"
                babbletimeout="60000"
                onreco="saveAudio()"
                onnoreco="saveAudio()"
                onsilence="RunAsk()" >
            <salt:record />
        </salt:listen>

         <!-- listen for capturing whether user wants to save voice mail -->
        <salt:listen id="l_save" onreco="processSave()">
            <salt:grammar src="./yesno.grxml" />
        </salt:listen>

        <!-- listen for key being pressed to stop recording -->
        <salt:dtmf id="d_stop_rec" onReco="saveAudio()">
            <grammar src="alldigits.grxml" />
        </salt:dtmf>


         <!-- HTML + script controlling dialog flow -->
        <script>
            function RunAsk() {
                if (voicemail.value=="") {
                    p_record.Start();
                }
            }
            // Ask user if they are satisfied with their recording
            function saveAudio () {
                p_save.Start();
                l_save.Start();
            }
            // If user is satisfied post file name back to web server
            // otherwise start again
            function processSave () {
                smlResult = event.srcElement.recoresult;
                origNode = smlResult.selectSingleNode("//answer/text()");
                if (origNode.value == "Yes") {
                    vmail.value = l_recordvm.recordlocation;
                    f1.submit();
                } else {
                    RunAsk();
                }
            }
        </script>
    </body>
</html>

 

Extra info

For details on usage of this element, see the SALT Specification, Version 1.0.