<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+Function_SHARED">Asterisk 10 Function_SHARED</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="Asterisk10Function_SHARED-SHARED%28%29"></a>SHARED()</h1>

<h3><a name="Asterisk10Function_SHARED-Synopsis"></a>Synopsis</h3>
<p>Gets or sets the shared variable specified.</p>

<h3><a name="Asterisk10Function_SHARED-Description"></a>Description</h3>
<p>Implements a shared variable area, in which you may share variables between channels. </p>

<p>The variables used in this space are separate from the general namespace of the channel and thus The variables used in this space are separate from the general namespace of the channel and thus <tt>None</tt> - <tt>SHARED(foo)</tt> and The variables used in this space are separate from the general namespace of the channel and thus <tt>None</tt> - <tt>foo</tt> represent two completely different variables, despite sharing the same name. </p>

<p>Finally, realize that there is an inherent race between channels operating at the same time, fiddling with each others' internal variables, which is why this special variable namespace exists; it is to remind you that variables in the SHARED namespace may change at any time, without warning. You should therefore take special care to ensure that when using the SHARED namespace, you retrieve the variable and store it in a regular channel variable before using it in a set of calculations (or you might be surprised by the result).</p>

<h3><a name="Asterisk10Function_SHARED-Syntax"></a>Syntax</h3>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>SHARED(varname[,channel])</pre>
</div></div>

<h5><a name="Asterisk10Function_SHARED-Arguments"></a>Arguments</h5>
<ul>
        <li><tt>varname</tt> - Variable name</li>
        <li><tt>channel</tt> - If not specified will default to current channel. It is the complete channel name:<br/>
<tt>SIP/12-abcd1234</tt> or the prefix only <tt>SIP/12</tt>.</li>
</ul>



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


<h3><a name="Asterisk10Function_SHARED-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+Function_SHARED">View Online</a>
              |
       <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+10+Function_SHARED?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>