<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/2041/1/7/_/styles/combined.css?spaceKey=AST&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/Goto+Application+and+Priority+Labels">Goto Application and Priority Labels</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>
Add example code for Goto().<br />
</div>
<br/>
<h4>Changes (1)</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" > <br>The *Goto()* application can be called with either one, two, or three parameters. If you call the *Goto()* application with a single parameter, Asterisk will jump to the specified priority (or its label) within the current extension. If you specify two parameters, Asterisk will read the first as an extension within the current context to jump to, and the second parameter as the priority (or label) within that extension. If you pass three parameters to the application, Asterisk will assume they are the context, extension, and priority (respectively) to jump to. <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;"> <br>{code:lang=javascript}[StartingContext] <br>exten => 100,1,Goto(monkeys) <br>same => n,NoOp(We skip this) <br>same => n(monkeys),Playback(tt-monkeys) <br>same => n,Hangup() <br> <br>exten => 200,1,Goto(start,1) ; play tt-weasels then tt-monkeys <br> <br>exten => 300,1,Goto(start,monkeys) ; only play tt-monkeys <br> <br>exten => 400,1,Goto(JumpingContext,start,1) ; play hello-world <br> <br>exten => start,1,NoOp() <br>same => n,Playback(tt-weasels) <br>same => n(monkeys),Playback(tt-monkeys) <br> <br>[JumpingContext] <br>exten => start,1,NoOp() <br>same => n,Playback(hello-world) <br>same => n,Hangup() <br>{code} <br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<p>Before we create a simple auto-attendant menu, let's cover a couple of other useful dialplan applications. The <b>Goto()</b> application allows us to jump from one position in the dialplan to another. The parameters to the <b>Goto()</b> application are slightly more complicated than with the other applications we've looked at so far, but don't let that scare you off.</p>
<p>The <b>Goto()</b> application can be called with either one, two, or three parameters. If you call the <b>Goto()</b> application with a single parameter, Asterisk will jump to the specified priority (or its label) within the current extension. If you specify two parameters, Asterisk will read the first as an extension within the current context to jump to, and the second parameter as the priority (or label) within that extension. If you pass three parameters to the application, Asterisk will assume they are the context, extension, and priority (respectively) to jump to.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<script type="syntaxhighlighter" class="toolbar: false; theme: Confluence; brush: javascript; gutter: false"><![CDATA[[StartingContext]
exten => 100,1,Goto(monkeys)
same => n,NoOp(We skip this)
same => n(monkeys),Playback(tt-monkeys)
same => n,Hangup()
exten => 200,1,Goto(start,1) ; play tt-weasels then tt-monkeys
exten => 300,1,Goto(start,monkeys) ; only play tt-monkeys
exten => 400,1,Goto(JumpingContext,start,1) ; play hello-world
exten => start,1,NoOp()
same => n,Playback(tt-weasels)
same => n(monkeys),Playback(tt-monkeys)
[JumpingContext]
exten => start,1,NoOp()
same => n,Playback(hello-world)
same => n,Hangup()
]]></script>
</div></div>
</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/Goto+Application+and+Priority+Labels">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=4817387&revisedVersion=5&originalVersion=4">View Changes</a>
|
<a href="https://wiki.asterisk.org/wiki/display/AST/Goto+Application+and+Priority+Labels?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>