<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2171/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+10+Application_Macro">Asterisk 10 Application_Macro</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="Asterisk10Application_Macro-Macro%28%29"></a>Macro()</h1>

<h3><a name="Asterisk10Application_Macro-Synopsis"></a>Synopsis</h3>
<p>Macro Implementation.</p>

<h3><a name="Asterisk10Application_Macro-Description"></a>Description</h3>
<p>Executes a macro using the context macro- <em>name</em>, jumping to the <tt>s</tt> extension of that context and executing each step, then returning when the steps end. </p>

<p>The calling extension, context, and priority are stored in The calling extension, context, and priority are stored in <tt>None</tt> - <tt>MACRO_EXTEN</tt>, The calling extension, context, and priority are stored in <tt>None</tt> - <tt>MACRO_CONTEXT</tt> and The calling extension, context, and priority are stored in <tt>None</tt> - <tt>MACRO_PRIORITY</tt> respectively. Arguments become The calling extension, context, and priority are stored in <tt>None</tt> - <tt>ARG1</tt>, The calling extension, context, and priority are stored in <tt>None</tt> - <tt>ARG2</tt>, etc in the macro context. </p>

<p>If you Goto out of the Macro context, the Macro will terminate and control will be returned at the location of the Goto. </p>

<p>If If <tt>None</tt> - <tt>MACRO_OFFSET</tt> is set at termination, Macro will attempt to continue at priority MACRO_OFFSET + N + 1 if such a step exists, and N + 1 otherwise. </p>

<p>Because of the way Macro is implemented (it executes the priorities contained within it via sub-engine), and a fixed per-thread memory stack allowance, macros are limited to 7 levels of nesting (macro calling macro calling macro, etc.); It may be possible that stack-intensive applications in deeply nested macros could cause asterisk to crash earlier than this limit. It is advised that if you need to deeply nest macro calls, that you use the Gosub application (now allows arguments like a Macro) with explict Return() calls instead. </p>

<p>Use of the application <tt>WaitExten</tt> within a macro will not function as expected. Please use the <tt>Read</tt> application in order to read DTMF from a channel currently executing a macro.</p>

<h3><a name="Asterisk10Application_Macro-Syntax"></a>Syntax</h3>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>Macro(name[,arg1[,arg2[,...]]])</pre>
</div></div>

<h5><a name="Asterisk10Application_Macro-Arguments"></a>Arguments</h5>

<ul>
        <li><tt>name</tt> - The name of the macro</li>
        <li><tt>args</tt>
        <ul>
                <li><tt>arg1</tt></li>
                <li><tt>arg2</tt></li>
        </ul>
        </li>
</ul>



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

<p><a href="/wiki/pages/createpage.action?spaceKey=AST&amp;title=Asterisk+10+Application_MacroExit&amp;linkCreation=true&amp;fromPageId=19005699" class="createlink">Asterisk 10 Application&#95;MacroExit</a><br/>
<a href="/wiki/pages/createpage.action?spaceKey=AST&amp;title=Asterisk+10+Application_Goto&amp;linkCreation=true&amp;fromPageId=19005699" class="createlink">Asterisk 10 Application&#95;Goto</a><br/>
<a href="/wiki/pages/createpage.action?spaceKey=AST&amp;title=Asterisk+10+Application_Gosub&amp;linkCreation=true&amp;fromPageId=19005699" class="createlink">Asterisk 10 Application&#95;Gosub</a></p>


<h3><a name="Asterisk10Application_Macro-ImportVersion"></a>Import Version</h3>
<p>This documentation was imported from Asterisk version SVN-branch-10-r340810.</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+10+Application_Macro">View Online</a>
              |
       <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+10+Application_Macro?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>