<div dir="ltr"><div><div><div>Thanks but I willingly choose a standard CDR field (I checked with both accountcode and userfield) which appears in /var/log/asterisk/cdr-csv/Master.csv (to keep cdr-cusdom/Master.csv away to simplify things)<br>
</div>the fact found in Master.csv is  foo, the value set before entering the hangup extension (see previous dialplan)).<br><br></div>To me, this is either a feature (&quot;you can&#39;t set CDR values in hangup exten&quot;) or a bug.<br>
<br></div>How would you qualify this ?<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/3/29 Julian Lyndon-Smith <span dir="ltr">&lt;<a href="mailto:asterisk@dotr.com" target="_blank">asterisk@dotr.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ah, right. Have a look at this documentation:<div><br></div><div>You may need to add some mapping</div><div>
<br></div><div>Julian</div><div><div title="cdr_custom" style="font-size:medium;font-family:serif">
<div><h4 style="font-family:sans-serif;font-size:16px">cdr_custom</h4></div><p><a style="color:blue;text-decoration:underline"></a><a style="color:blue;text-decoration:underline"></a><a style="color:blue;text-decoration:underline"></a><a style="color:blue;text-decoration:underline"></a>This CDR backend allows for custom formatting of CDR records in a log file. This module is most commonly used for customized CSV output. The configuration file used for this module is <code style="font-family:serif;font-style:italic">/etc/asterisk/cdr_custom.conf</code>. A single section called <code>[mappings]</code> should exist in this file. The <code>[mappings]</code> section contains mappings between a filename and the custom template for a CDR. The template is specified using Asterisk dialplan functions.</p>

<p><a style="color:blue;text-decoration:underline"></a>The following example shows a sample configuration for <code>cdr_custom</code> that enables a single CDR log file, <code style="font-family:serif;font-style:italic">Master.csv</code>. This file will be created as <code style="font-family:serif;font-style:italic">/var/log/asterisk/cdr-custom/Master.csv</code>. The template that has been defined uses both the <code>CDR()</code> and <code>CSV_QUOTE()</code> dialplan functions<a style="color:blue;text-decoration:underline"></a><a style="color:blue;text-decoration:underline"></a>. The <code>CDR()</code> function retrieves values from the CDR being logged. The <code>CSV_QUOTE()</code> function ensures that the values are properly escaped for the CSV file <span>format</span>:</p>

<a style="color:blue;text-decoration:underline"></a><pre style="font-size:12px;margin-right:0.25in;margin-left:0.25in;padding:0.5em;background-color:rgb(240,240,240);border-color:black;border-style:dotted solid solid dotted;border-width:1px 2px 2px 1px">
[mappings]

Master.csv =&gt; ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},
   ${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},
   ${CSV_QUOTE(${CDR(channel)})},${CSV_QUOTE(${CDR(dstchannel)})},
   ${CSV_QUOTE(${CDR(lastapp)})},${CSV_QUOTE(${CDR(lastdata)})},
   ${CSV_QUOTE(${CDR(start)})},${CSV_QUOTE(${CDR(answer)})},
   ${CSV_QUOTE(${CDR(end)})},${CSV_QUOTE(${CDR(duration)})},
   ${CSV_QUOTE(${CDR(billsec)})},${CSV_QUOTE(${CDR(disposition)})},
   ${CSV_QUOTE(${CDR(amaflags)})},${CSV_QUOTE(${CDR(accountcode)})},
   ${CSV_QUOTE(${CDR(uniqueid)})},${CSV_QUOTE(${CDR(userfield)})}</pre><div title="Note" style="border:1px solid black;margin:0.125in 0.5in;padding:0px 55px;font-size:14px;background-image:url();background-color:rgb(252,246,220);background-repeat:no-repeat no-repeat">

<p><a style="color:blue;text-decoration:underline"></a>In the actual configuration file, the value in the <code style="font-family:serif;font-style:italic">Master.csv</code> mapping should be on a single line.</p>
</div></div><div title="cdr_manager" style="font-size:medium;font-family:serif"><div><h4 style="font-family:sans-serif;font-size:16px"><a style="color:blue;text-decoration:underline"></a>cdr_manager</h4>
</div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On 29 March 2013 10:02, Olivier <span dir="ltr">&lt;<a href="mailto:oza_4h07@yahoo.fr" target="_blank">oza_4h07@yahoo.fr</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/3/29 Julian Lyndon-Smith <span dir="ltr">&lt;<a href="mailto:asterisk@dotr.com" target="_blank">asterisk@dotr.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">check out the endbeforehexten option in cdr.conf<div><br></div><div>this needs to set to &quot;yes&quot;</div><div><br></div><div>Julian</div></div></blockquote><div><br><br></div><div>Unfortunately, this doesn&#39;t help.<br>


</div><div><br></div><div>Let&#39;s drop the hangup handler at the moment, and focus on the &quot;saving to file&quot; part.<br></div><div>Then my issue is I can&#39;t update CDR value is hangup exten.<br></div><div><br>

</div>
<div>Here is a dialplan that illustrate this:<br><br>[from-foobar]<br>exten =&gt; _X.,1,Verbose(0,Entering context ${CONTEXT} from channel ${CHANNEL(channeltype)} ${CHANNEL} with EXTEN and CID set to ${EXTEN} and ${CALLERID(num)})<br>


  same =&gt; n, Set(CDR(userfield)=foo)<br>  same =&gt; n, Dial(SIP/foobar/${EXTEN})<br>  same =&gt; n, Set(CDR(userfield)=bar)<br>  same =&gt; n, Hangup()<br><br>exten =&gt; h,1,Verbose(0,Entering context ${CONTEXT} from ${CHANNEL(channeltype)} channel ${CHANNEL} with EXTEN and CID set to ${EXTEN} and ${CALLERID(num)})<br>


  same =&gt; n, ExecIf($[&quot;x${CHANNEL(channeltype)}&quot;=&quot;xLocal&quot;]?Set(CDR(userfield)=baz1:baz2)<br><br></div><div>My goal is to get either baz1 or baz2 value in /var/log/asterisk/cdr-csv/Master.csv.<br><br>


</div><div>Typing channel originate Local/7005@from-foobar application Playback tt-monkeys, I can see that the line with ExecIf is run but CDR still contains foo value (the one set before Dial).<br></div><div>The strange thing is :<br>


1. a CDR is written at the moment extension 7005 answers,<br></div><div>2. no other CDR is added when 7005 hangs up (so can&#39;t tell how long extension 7005 listened to monkeys fellows).<br></div><div>(Setting endbeforehexten to either yes or no has no effect on this behaviour.<br>


<br><br></div><div>My question are:<br></div><div>1. Is it simply possible to update CDR in hangup exten ?<br></div><div>2. How can I have a CDR for the application Playback part (see above) ?<br></div><div>3. Any tip or suggestion ?<br>


<br></div><div>Cheers<br></div></div></div></div>
<br></div></div><span class="HOEnZb"><font color="#888888">--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br>
<br clear="all"><div><br></div>-- <br>Julian Lyndon-Smith<br>
IT Director, Dot R Limited<br><br>&quot;I don’t care if it works on your machine!  We are not shipping your machine!”<br><br>The kangaroo dances: <a href="http://www.youtube.com/watch?v=MAWl5iYOaUg" target="_blank">http://www.youtube.com/watch?v=MAWl5iYOaUg</a>
</font></span></div>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br></div>