<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_CDR">Asterisk 10 Function_CDR</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_CDR-CDR%28%29"></a>CDR()</h1>

<h3><a name="Asterisk10Function_CDR-Synopsis"></a>Synopsis</h3>
<p>Gets or sets a CDR variable.</p>

<h3><a name="Asterisk10Function_CDR-Description"></a>Description</h3>
<p>All of the CDR field names are read-only, except for <tt>accountcode</tt>, <tt>userfield</tt>, and <tt>amaflags</tt>. You may, however, supply a name not on the above list, and create your own variable, whose value can be changed with this function, and this variable will be stored on the cdr. </p>

<p>For setting CDR values, the For setting CDR values, the <tt>l</tt> flag does not apply to setting the <tt>accountcode</tt>, <tt>userfield</tt>, or <tt>amaflags</tt>. </p>

<p>Raw values for <tt>disposition</tt> : </p>

<p>NO ANSWER </p>

<p>NO ANSWER (NULL record) </p>

<p>FAILED </p>

<p>BUSY </p>

<p>ANSWERED </p>

<p>Raw values for <tt>amaflags</tt> : </p>

<p>OMIT </p>

<p>BILLING </p>

<p>DOCUMENTATION </p>

<p>Example: exten =&gt; 1,1,Set(CDR(userfield)=test)</p>

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

<h5><a name="Asterisk10Function_CDR-Arguments"></a>Arguments</h5>
<ul>
        <li><tt>name</tt> - CDR field name:
        <ul>
                <li><tt>clid</tt> - Caller ID.</li>
                <li><tt>lastdata</tt> - Last application arguments.</li>
                <li><tt>disposition</tt> - ANSWERED, NO ANSWER, BUSY, FAILED.</li>
                <li><tt>src</tt> - Source.</li>
                <li><tt>start</tt> - Time the call started.</li>
                <li><tt>amaflags</tt> - DOCUMENTATION, BILL, IGNORE, etc.</li>
                <li><tt>dst</tt> - Destination.</li>
                <li><tt>answer</tt> - Time the call was answered.</li>
                <li><tt>accountcode</tt> - The channel's account code.</li>
                <li><tt>dcontext</tt> - Destination context.</li>
                <li><tt>end</tt> - Time the call ended.</li>
                <li><tt>uniqueid</tt> - The channel's unique id.</li>
                <li><tt>dstchannel</tt> - Destination channel.</li>
                <li><tt>duration</tt> - Duration of the call.</li>
                <li><tt>userfield</tt> - The channel's user specified field.</li>
                <li><tt>lastapp</tt> - Last application.</li>
                <li><tt>billsec</tt> - Duration of the call once it was answered.</li>
                <li><tt>channel</tt> - Channel name.</li>
                <li><tt>sequence</tt> - CDR sequence number.</li>
        </ul>
        </li>
        <li><tt>options</tt>
        <ul>
                <li><tt>f</tt> - Returns billsec or duration fields as floating point values.</li>
                <li><tt>l</tt> - Uses the most recent CDR on a channel with multiple records</li>
                <li><tt>r</tt> - Searches the entire stack of CDRs on the channel.</li>
                <li><tt>s</tt> - Skips any CDR's that are marked 'LOCKED' due to forkCDR() calls. (on setting/writing CDR vars only)</li>
                <li><tt>u</tt> - Retrieves the raw, unprocessed value. For example, 'start', 'answer', and 'end' will be retrieved as epoch values, when the <tt>u</tt> option is passed, but formatted as YYYY-MM-DD HH:MM:SS otherwise. Similarly, disposition and amaflags will return their raw integral values.</li>
        </ul>
        </li>
</ul>



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


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