2011-01-10 3 views
1

사용자가 "help"라고 말하면 다음 필드가 채워지지 않고 사용자가 가능한 모든 옵션을 가져옵니다.외부 문법의 voicexml 출력 및 필드 요소 다시 채우기

<form id="test">  
    <field name="var1"> 


<prompt bargein="true" bargeintype="hotword" >say xy </prompt> 

<grammar src = "grammar.grxml" type="application/srgs+xml" /> 



    <filled> 
    <assign name="myProdukt" expr="var1" /> 
    you said <value expr="myProdukt"/> 
    </filled> 

</field> 

(의 외부 문법에 생각한 것은 "P1", "P2"및 "P3"입니다, 사용자는 말한다 "도움", 그리고 시스템은 "P1", "P2", "P3"를 말한다 사용자가 다시 선택할 수 있습니다 - 따라서 단어 "도움"뿐만 아니라 외부의 문법에 있어야한다,하지 않습니다 그것을)

사전에 감사하는

답변

2

예, 활성 문법은 "도움"을 포함해야한다 'help'값을 반환하는 발언. 그런 다음 help 태그 이벤트를 잡을 :

<?xml version="1.0" encoding="UTF-8"?> 
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0" 
    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"> 
    <form id="test">  
     <field name="var1"> 
      <prompt bargein="true" bargeintype="hotword" >say xy </prompt> 
      <grammar src = "grammar.grxml" type="application/srgs+xml" /> 
      <filled> 
       <assign name="myProdukt" expr="var1" /> 
       you said <value expr="myProdukt"/> 
      </filled> 
      <help> 
       To choose a product, say, 
       <!-- whatever the product choices are --> 
       frobinator, submarine, curling iron, .. 
       <reprompt/> 
      </help> 
     </field> 
    </form> 
</vxml> 

또는, DRY principle 다음,이 효과는 link 요소를 포함하는 응용 프로그램 루트 문서를 사용하여 응용 프로그램에 대한 전 세계적으로을 수행 할 수 있습니다. app-root.vxml 문서 아래의 예에서 help 이벤트에 글로벌 문법 "도움"발언 바인딩 link가 :

<?xml version="1.0"?> 
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml"> 
    <link event="help"> 
     <grammar mode="voice" root="root_rule" tag-format="semantics/1.0" 
       type="application/srgs+xml" version="1.0" xml:lang="en-US"> 
      <rule id="root_rule" scope="public"> 
        <one-of> 
         <item weight="1.0"> 
           help 
         </item> 
        </one-of> 
      </rule> 
     </grammar> 
    </link> 
</vxml> 

이 문법은 사방 활성화됩니다 - 효과적으로 각 활성 필드 문법과 합병. 애플리케이션 루트 문서에 대한 추가 정보가 필요하면 VoiceXML 사양 Executing a Multi-Document Application 섹션을 참조하십시오.

<?xml version="1.0" encoding="UTF-8"?> 
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0" 
    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="app-root.vxml"> 
    <form id="test">  
     <field name="var1"> 
      <prompt bargein="true" bargeintype="hotword" >say xy </prompt> 
      <grammar src = "grammar.grxml" type="application/srgs+xml" /> 
      <filled> 
       <assign name="myProdukt" expr="var1" /> 
       you said <value expr="myProdukt"/> 
      </filled> 
      <help> 
       To choose a product, say, 
       <!-- whatever the product choices are --> 
       frobinator, submarine, curling iron, .. 
       <reprompt/> 
      </help> 
     </field> 
    </form> 
</vxml> 
: 또한 vxml 요소의 application 속성을 통해 응용 프로그램 루트 문서를 참조 할 수와 help catch 블록에 적절하게 말하고, 응용 프로그램의 페이지에,

그런 다음 텔미 스튜디오 문서에서 Handling Events를 참조

물론 양식과 동일한 페이지에 link 코드를 넣을 수도 있지만 특정 필드의 문법에 무언가가 충돌하지 않는 한 응용 프로그램의 모든 필드에 대해 help을 활성화해야 할 수 있습니다.

관련 문제