<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_ChanSpy">Asterisk 11 Application_ChanSpy</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_ChanSpy-ChanSpy%28%29"></a>ChanSpy()</h1>

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

<p>Listen to a channel, and optionally whisper into it.</p>
<h3><a name="Asterisk11Application_ChanSpy-Description"></a>Description</h3>



<p>This application is used to listen to the audio from an Asterisk channel. This includes the audio coming in and out of the channel being spied on. If the <tt>chanprefix</tt> parameter is specified, only channels beginning with this string will be spied upon.</p>

<p>While spying, the following actions may be performed:</p>

<ul class="alternate" type="square">
        <li>Dialing <tt>#</tt> cycles the volume level.</li>
</ul>


<ul class="alternate" type="square">
        <li>Dialing <tt>*</tt> will stop spying and look for another channel to spy on.</li>
</ul>


<ul class="alternate" type="square">
        <li>Dialing a series of digits followed by <tt>#</tt> builds a channel name to append to 'chanprefix'. For example, executing ChanSpy(Agent) and then dialing the digits '1234#' while spying will begin spying on the channel 'Agent/1234'. Note that this feature will be overridden if the 'd' option is used
<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>Note</b><br />The <em>X</em> option supersedes the three features above in that if a valid single digit extension exists in the correct context ChanSpy will exit to it. This also disables choosing a channel based on <tt>chanprefix</tt> and a digit sequence.</td></tr></table></div></li>
</ul>



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

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>ChanSpy(chanprefix,options)</pre>
</div></div>
<h5><a name="Asterisk11Application_ChanSpy-Arguments"></a>Arguments</h5>


<ul>
        <li>chanprefix</li>
        <li>options
        <ul>
                <li>b - Only spy on channels involved in a bridged call.</li>
                <li>B - Instead of whispering on a single channel barge in on both channels involved in the call.</li>
                <li>c
                <ul>
                        <li>digit - Specify a DTMF digit that can be used to spy on the next available channel.</li>
                </ul>
                </li>
                <li>d - Override the typical numeric DTMF functionality and instead use DTMF to switch between spy modes.
                <ul>
                        <li>4 - spy mode</li>
                        <li>5 - whisper mode</li>
                        <li>6 - barge mode</li>
                </ul>
                </li>
                <li>e - Enable <b>enforced</b> mode, so the spying channel can only monitor extensions whose name is in the <em>ext</em> : delimited list.
                <ul>
                        <li>ext</li>
                </ul>
                </li>
                <li>E - Exit when the spied-on channel hangs up.</li>
                <li>g
                <ul>
                        <li>grp - Only spy on channels in which one or more of the groups listed in <em>grp</em> matches one or more groups from the <tt>SPYGROUP</tt> variable set on the channel to be spied upon.</li>
                </ul>
                </li>
                <li>n - Say the name of the person being spied on if that person has recorded his/her name. If a context is specified, then that voicemail context will be searched when retrieving the name, otherwise the <tt>default</tt> context be used when searching for the name (i.e. if SIP/1000 is the channel being spied on and no mailbox is specified, then <tt>1000</tt> will be used when searching for the name).
                <ul>
                        <li>mailbox</li>
                        <li>context</li>
                </ul>
                </li>
                <li>o - Only listen to audio coming from this channel.</li>
                <li>q - Don't play a beep when beginning to spy on a channel, or speak the selected channel name.</li>
                <li>r - Record the session to the monitor spool directory. An optional base for the filename may be specified. The default is <tt>chanspy</tt>.
                <ul>
                        <li>basename</li>
                </ul>
                </li>
                <li>s - Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.</li>
                <li>S - Stop when no more channels are left to spy on.</li>
                <li>v - Adjust the initial volume in the range from <tt>-4</tt> to <tt>4</tt>. A negative value refers to a quieter setting.
                <ul>
                        <li>value</li>
                </ul>
                </li>
                <li>w - Enable <tt>whisper</tt> mode, so the spying channel can talk to the spied-on channel.</li>
                <li>W - Enable <tt>private whisper</tt> mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.</li>
                <li>x
                <ul>
                        <li>digit - Specify a DTMF digit that can be used to exit the application.</li>
                </ul>
                </li>
                <li>X - Allow the user to exit ChanSpy to a valid single digit numeric extension in the current context or the context specified by the <tt>SPY_EXIT_CONTEXT</tt> channel variable. The name of the last channel that was spied on will be stored in the <tt>SPY_CHANNEL</tt> variable.</li>
        </ul>
        </li>
</ul>


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


<ul>
        <li><a href="/wiki/pages/createpage.action?spaceKey=AST&amp;title=Asterisk+11+Application_ExtenSpy&amp;linkCreation=true&amp;fromPageId=20186970" class="createlink">Asterisk 11 Application&#95;ExtenSpy</a></li>
</ul>


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