<p dir="ltr"><br>
Le 29 mars 2013 18:26, "Julian Lyndon-Smith" <<a href="mailto:asterisk@dotr.com">asterisk@dotr.com</a>> a écrit :<br>
><br>
> you can't set values in the h extension _unless_ you use the<br>
> endbeforehexten option in cdr.conf<br>
I did and couldn't get it to work :-(<br>
><br>
> you may need to reload the cdr module or restart asterisk for the<br>
> option to take effect.<br>
><br>
> It works.<br>
You mean it does work in asterisk 11 ?<br>
Which CDR variables did you then play with ?</p>
<p dir="ltr"> I know it does, as I use hangup handlers all the time. Much<br>
> better than the h extension ;)<br>
I fully agree !<br></p>
<p dir="ltr">><br>
><br>
> Julian<br>
><br>
> On 29 March 2013 14:06, Olivier <<a href="mailto:oza_4h07@yahoo.fr">oza_4h07@yahoo.fr</a>> wrote:<br>
> > Thanks but I willingly choose a standard CDR field (I checked with both<br>
> > accountcode and userfield) which appears in<br>
> > /var/log/asterisk/cdr-csv/Master.csv (to keep cdr-cusdom/Master.csv away to<br>
> > simplify things)<br>
> > the fact found in Master.csv is foo, the value set before entering the<br>
> > hangup extension (see previous dialplan)).<br>
> ><br>
> > To me, this is either a feature ("you can't set CDR values in hangup exten")<br>
> > or a bug.<br>
> ><br>
> > How would you qualify this ?<br>
> ><br>
> ><br>
> > 2013/3/29 Julian Lyndon-Smith <<a href="mailto:asterisk@dotr.com">asterisk@dotr.com</a>><br>
> >><br>
> >> Ah, right. Have a look at this documentation:<br>
> >><br>
> >> You may need to add some mapping<br>
> >><br>
> >> Julian<br>
> >><br>
> >> cdr_custom<br>
> >><br>
> >> This CDR backend allows for custom formatting of CDR records in a log<br>
> >> file. This module is most commonly used for customized CSV output. The<br>
> >> configuration file used for this module is /etc/asterisk/cdr_custom.conf. A<br>
> >> single section called [mappings] should exist in this file. The [mappings]<br>
> >> section contains mappings between a filename and the custom template for a<br>
> >> CDR. The template is specified using Asterisk dialplan functions.<br>
> >><br>
> >> The following example shows a sample configuration for cdr_custom that<br>
> >> enables a single CDR log file, Master.csv. This file will be created as<br>
> >> /var/log/asterisk/cdr-custom/Master.csv. The template that has been defined<br>
> >> uses both the CDR() and CSV_QUOTE() dialplan functions. The CDR() function<br>
> >> retrieves values from the CDR being logged. The CSV_QUOTE() function ensures<br>
> >> that the values are properly escaped for the CSV file format:<br>
> >><br>
> >> [mappings]<br>
> >><br>
> >> Master.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},<br>
> >> ${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},<br>
> >> ${CSV_QUOTE(${CDR(channel)})},${CSV_QUOTE(${CDR(dstchannel)})},<br>
> >> ${CSV_QUOTE(${CDR(lastapp)})},${CSV_QUOTE(${CDR(lastdata)})},<br>
> >> ${CSV_QUOTE(${CDR(start)})},${CSV_QUOTE(${CDR(answer)})},<br>
> >> ${CSV_QUOTE(${CDR(end)})},${CSV_QUOTE(${CDR(duration)})},<br>
> >> ${CSV_QUOTE(${CDR(billsec)})},${CSV_QUOTE(${CDR(disposition)})},<br>
> >> ${CSV_QUOTE(${CDR(amaflags)})},${CSV_QUOTE(${CDR(accountcode)})},<br>
> >> ${CSV_QUOTE(${CDR(uniqueid)})},${CSV_QUOTE(${CDR(userfield)})}<br>
> >><br>
> >> In the actual configuration file, the value in the Master.csv mapping<br>
> >> should be on a single line.<br>
> >><br>
> >> cdr_manager<br>
> >><br>
> >><br>
> >><br>
> >> On 29 March 2013 10:02, Olivier <<a href="mailto:oza_4h07@yahoo.fr">oza_4h07@yahoo.fr</a>> wrote:<br>
> >>><br>
> >>><br>
> >>><br>
> >>><br>
> >>> 2013/3/29 Julian Lyndon-Smith <<a href="mailto:asterisk@dotr.com">asterisk@dotr.com</a>><br>
> >>>><br>
> >>>> check out the endbeforehexten option in cdr.conf<br>
> >>>><br>
> >>>> this needs to set to "yes"<br>
> >>>><br>
> >>>> Julian<br>
> >>><br>
> >>><br>
> >>><br>
> >>> Unfortunately, this doesn't help.<br>
> >>><br>
> >>> Let's drop the hangup handler at the moment, and focus on the "saving to<br>
> >>> file" part.<br>
> >>> Then my issue is I can't update CDR value is hangup exten.<br>
> >>><br>
> >>> Here is a dialplan that illustrate this:<br>
> >>><br>
> >>> [from-foobar]<br>
> >>> exten => _X.,1,Verbose(0,Entering context ${CONTEXT} from channel<br>
> >>> ${CHANNEL(channeltype)} ${CHANNEL} with EXTEN and CID set to ${EXTEN} and<br>
> >>> ${CALLERID(num)})<br>
> >>> same => n, Set(CDR(userfield)=foo)<br>
> >>> same => n, Dial(SIP/foobar/${EXTEN})<br>
> >>> same => n, Set(CDR(userfield)=bar)<br>
> >>> same => n, Hangup()<br>
> >>><br>
> >>> exten => h,1,Verbose(0,Entering context ${CONTEXT} from<br>
> >>> ${CHANNEL(channeltype)} channel ${CHANNEL} with EXTEN and CID set to<br>
> >>> ${EXTEN} and ${CALLERID(num)})<br>
> >>> same => n,<br>
> >>> ExecIf($["x${CHANNEL(channeltype)}"="xLocal"]?Set(CDR(userfield)=baz1:baz2)<br>
> >>><br>
> >>> My goal is to get either baz1 or baz2 value in<br>
> >>> /var/log/asterisk/cdr-csv/Master.csv.<br>
> >>><br>
> >>> Typing channel originate Local/7005@from-foobar application Playback<br>
> >>> tt-monkeys, I can see that the line with ExecIf is run but CDR still<br>
> >>> contains foo value (the one set before Dial).<br>
> >>> The strange thing is :<br>
> >>> 1. a CDR is written at the moment extension 7005 answers,<br>
> >>> 2. no other CDR is added when 7005 hangs up (so can't tell how long<br>
> >>> extension 7005 listened to monkeys fellows).<br>
> >>> (Setting endbeforehexten to either yes or no has no effect on this<br>
> >>> behaviour.<br>
> >>><br>
> >>><br>
> >>> My question are:<br>
> >>> 1. Is it simply possible to update CDR in hangup exten ?<br>
> >>> 2. How can I have a CDR for the application Playback part (see above) ?<br>
> >>> 3. Any tip or suggestion ?<br>
> >>><br>
> >>> Cheers<br>
> >>><br>
> >>> --<br>
> >>> _____________________________________________________________________<br>
> >>> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">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">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">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> --<br>
> >> Julian Lyndon-Smith<br>
> >> IT Director, Dot R Limited<br>
> >><br>
> >> "I don’t care if it works on your machine! We are not shipping your<br>
> >> machine!”<br>
> >><br>
> >> The kangaroo dances: <a href="http://www.youtube.com/watch?v=MAWl5iYOaUg">http://www.youtube.com/watch?v=MAWl5iYOaUg</a><br>
> >><br>
> >> --<br>
> >> _____________________________________________________________________<br>
> >> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">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">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">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > _____________________________________________________________________<br>
> > -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">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">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">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
><br>
><br>
><br>
> --<br>
> Julian Lyndon-Smith<br>
> IT Director, Dot R Limited<br>
><br>
> "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">http://www.youtube.com/watch?v=MAWl5iYOaUg</a><br>
><br>
> --<br>
> _____________________________________________________________________<br>
> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">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">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">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</p>