<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2172/18/9/_/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/Asterisk+11+Application_GotoIf">Asterisk 11 Application_GotoIf</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://wiki.asterisk.org/wiki/display/~wikibot">Wiki Bot</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="Asterisk11Application_GotoIf-GotoIf%28%29"></a>GotoIf()</h1>

<h3><a name="Asterisk11Application_GotoIf-Synopsis"></a>Synopsis</h3>

<p>Conditional goto.</p>
<h3><a name="Asterisk11Application_GotoIf-Description"></a>Description</h3>



<p>This application will set the current context, extension, and priority in the channel structure based on the evaluation of the given condition. After this application completes, the pbx engine will continue dialplan execution at the specified location in the dialplan. The labels are specified with the same syntax as used within the Goto application. If the label chosen by the condition is omitted, no jump is performed, and the execution passes to the next instruction. If the target location is bogus, and does not exist, the execution engine will try to find and execute the code in the <tt>i</tt> (invalid) extension in the current context. If that does not exist, it will try to execute the <tt>h</tt> extension. If neither the <tt>h</tt> nor <tt>i</tt> extensions have been defined, the channel is hung up, and the execution of instructions on the channel is terminated. Remember that this command can set the current context, and if the context specified does not exist, then it will not be able to find any 'h' or 'i' extensions there, and the channel and call will both be terminated!.</p>

<h3><a name="Asterisk11Application_GotoIf-Syntax"></a>Syntax</h3>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>GotoIf(conditionlabeliftrue:labeliffalse)</pre>
</div></div>
<h5><a name="Asterisk11Application_GotoIf-Arguments"></a>Arguments</h5>


<ul>
        <li>condition</li>
        <li>destination
        <ul>
                <li>labeliftrue - Continue at <em>labeliftrue</em> if the condition is true. Takes the form similar to Goto() of [<a href="/wiki/pages/createpage.action?spaceKey=AST&amp;title=context%2C&amp;linkCreation=true&amp;fromPageId=20187326" class="createlink">context,</a>extension,]priority.</li>
                <li>labeliffalse - Continue at <em>labeliffalse</em> if the condition is false. Takes the form similar to Goto() of [<a href="/wiki/pages/createpage.action?spaceKey=AST&amp;title=context%2C&amp;linkCreation=true&amp;fromPageId=20187326" class="createlink">context,</a>extension,]priority.</li>
        </ul>
        </li>
</ul>


<h3><a name="Asterisk11Application_GotoIf-SeeAlso"></a>See Also</h3>


<ul>
        <li><a href="/wiki/display/AST/Asterisk+11+Application_Goto" title="Asterisk 11 Application_Goto">Asterisk 11 Application&#95;Goto</a></li>
        <li><a href="/wiki/pages/createpage.action?spaceKey=AST&amp;title=Asterisk+11+Application_GotoIfTime&amp;linkCreation=true&amp;fromPageId=20187326" class="createlink">Asterisk 11 Application&#95;GotoIfTime</a></li>
        <li><a href="/wiki/display/AST/Asterisk+11+Application_GosubIf" title="Asterisk 11 Application_GosubIf">Asterisk 11 Application&#95;GosubIf</a></li>
        <li><a href="/wiki/display/AST/Asterisk+11+Application_MacroIf" title="Asterisk 11 Application_MacroIf">Asterisk 11 Application&#95;MacroIf</a></li>
</ul>


<h3><a name="Asterisk11Application_GotoIf-ImportVersion"></a>Import Version</h3>

<p>This documentation was imported from Asterisk Version SVN-trunk-r370322</p>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;" class="grey">
                        <a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
       <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Application_GotoIf">View Online</a>
              |
       <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Application_GotoIf?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>