<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/2041/1/7/_/styles/combined.css?spaceKey=AST&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/AST/Creating+a+Simple+IVR+Menu">Creating a Simple IVR Menu</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://wiki.asterisk.org/wiki/display/~lmadsen">Leif Madsen</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        Update dialplan to use the A:TDG method.<br />
    </div>
        <br/>
                         <h4>Changes (8)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code}[demo-menu] <br>exten=&gt;s,1,Answer(500) <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">exten=&gt;s,n(loop),Background(press-1&amp;or&amp;press-2) <br>exten=&gt;s,n,WaitExten() <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">   same =&gt; n(loop),Background(press-1&amp;or&amp;press-2) <br>   same =&gt; n,WaitExten() <br></td></tr>
            <tr><td class="diff-unchanged" > <br>exten=&gt;1,1,Playback(you-entered) <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">exten=&gt;1,n,SayNumber(1) <br>exten=&gt;1,n,Goto(s,loop) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">   same =&gt; n,SayNumber(1) <br>   same =&gt; n,Goto(s,loop) <br></td></tr>
            <tr><td class="diff-unchanged" > <br>exten=&gt;2,1,Playback(you-entered) <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">exten=&gt;2,n,SayNumber(2) <br>exten=&gt;2,n,Goto(s,loop){code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">   same =&gt; n,SayNumber(2) <br>   same =&gt; n,Goto(s,loop){code} <br></td></tr>
            <tr><td class="diff-unchanged" >Before we can use the demo menu above, we need to add an extension to the *\[docs:users\]* context to redirect the caller to our menu. Add this line to the *\[docs:users\]* context in your dialplan: <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}exten=&gt;6598,1,Goto(demo-menu,s,1) <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{code}exten =&gt; 6598,1,Goto(demo-menu,s,1) <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br>Reload your dialplan, and then try dialing extension *6598* to test your auto-attendant menu. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>Let's go ahead and apply what we've learned about the various dialplan applications by building a very simple auto-attendant menu. It is common practice to create an auto-attendant or IVR menu in a new context, so that it remains independant of the other extensions in the dialplan. Please add the following to your dialplan (the <b>extensions.conf</b> file) to create a new <b>demo-menu</b> context. In this new context, we'll create a simple menu that prompts you to enter one or two, and then it will read back what you're entered.</p>
<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Sample Sound Prompts</b><br />Please note that the example below (and many of the other examples in this guide) use sound prompts that are part of the <em>extra</em> sounds packages. If you didn't install the extra sounds earlier, now might be a good time to do that.</td></tr></table></div>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<script type="syntaxhighlighter" class="toolbar: false; theme: Confluence; brush: java; gutter: false"><![CDATA[[demo-menu]
exten=&gt;s,1,Answer(500)
   same =&gt; n(loop),Background(press-1&amp;or&amp;press-2)
   same =&gt; n,WaitExten()

exten=&gt;1,1,Playback(you-entered)
   same =&gt; n,SayNumber(1)
   same =&gt; n,Goto(s,loop)

exten=&gt;2,1,Playback(you-entered)
   same =&gt; n,SayNumber(2)
   same =&gt; n,Goto(s,loop)]]></script>
</div></div>
<p>Before we can use the demo menu above, we need to add an extension to the <b>[docs:users]</b> context to redirect the caller to our menu. Add this line to the <b>[docs:users]</b> context in your dialplan:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<script type="syntaxhighlighter" class="toolbar: false; theme: Confluence; brush: java; gutter: false"><![CDATA[exten =&gt; 6598,1,Goto(demo-menu,s,1)
]]></script>
</div></div>
<p>Reload your dialplan, and then try dialing extension <b>6598</b> to test your auto-attendant menu.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://wiki.asterisk.org/wiki/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://wiki.asterisk.org/wiki/display/AST/Creating+a+Simple+IVR+Menu">View Online</a>
        |
        <a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=4817383&revisedVersion=6&originalVersion=5">View Changes</a>
                |
        <a href="https://wiki.asterisk.org/wiki/display/AST/Creating+a+Simple+IVR+Menu?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>