[asterisk-users] Asterisk 11 - Change CDR in hangup exten [Was: CDR values changed in hangup handler not saved]
Julian Lyndon-Smith
asterisk at dotr.com
Fri Mar 29 07:49:52 CDT 2013
Ah, right. Have a look at this documentation:
You may need to add some mapping
Julian
cdr_custom
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 /etc/asterisk/cdr_custom.conf. A
single section called [mappings] should exist in this file. The
[mappings] section
contains mappings between a filename and the custom template for a CDR. The
template is specified using Asterisk dialplan functions.
The following example shows a sample configuration for cdr_custom that
enables a single CDR log file, Master.csv. This file will be created as
/var/log/asterisk/cdr-custom/Master.csv. The template that has been defined
uses both the CDR() and CSV_QUOTE() dialplan functions. The CDR() function
retrieves values from the CDR being logged. The CSV_QUOTE() function
ensures that the values are properly escaped for the CSV file format:
[mappings]
Master.csv => ${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)})}
In the actual configuration file, the value in the Master.csv mapping
should be on a single line.
cdr_manager
On 29 March 2013 10:02, Olivier <oza_4h07 at yahoo.fr> wrote:
>
>
>
> 2013/3/29 Julian Lyndon-Smith <asterisk at dotr.com>
>
>> check out the endbeforehexten option in cdr.conf
>>
>> this needs to set to "yes"
>>
>> Julian
>>
>
>
> Unfortunately, this doesn't help.
>
> Let's drop the hangup handler at the moment, and focus on the "saving to
> file" part.
> Then my issue is I can't update CDR value is hangup exten.
>
> Here is a dialplan that illustrate this:
>
> [from-foobar]
> exten => _X.,1,Verbose(0,Entering context ${CONTEXT} from channel
> ${CHANNEL(channeltype)} ${CHANNEL} with EXTEN and CID set to ${EXTEN} and
> ${CALLERID(num)})
> same => n, Set(CDR(userfield)=foo)
> same => n, Dial(SIP/foobar/${EXTEN})
> same => n, Set(CDR(userfield)=bar)
> same => n, Hangup()
>
> exten => h,1,Verbose(0,Entering context ${CONTEXT} from
> ${CHANNEL(channeltype)} channel ${CHANNEL} with EXTEN and CID set to
> ${EXTEN} and ${CALLERID(num)})
> same => n,
> ExecIf($["x${CHANNEL(channeltype)}"="xLocal"]?Set(CDR(userfield)=baz1:baz2)
>
> My goal is to get either baz1 or baz2 value in
> /var/log/asterisk/cdr-csv/Master.csv.
>
> Typing channel originate Local/7005 at 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).
> The strange thing is :
> 1. a CDR is written at the moment extension 7005 answers,
> 2. no other CDR is added when 7005 hangs up (so can't tell how long
> extension 7005 listened to monkeys fellows).
> (Setting endbeforehexten to either yes or no has no effect on this
> behaviour.
>
>
> My question are:
> 1. Is it simply possible to update CDR in hangup exten ?
> 2. How can I have a CDR for the application Playback part (see above) ?
> 3. Any tip or suggestion ?
>
> Cheers
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
Julian Lyndon-Smith
IT Director, Dot R Limited
"I don’t care if it works on your machine! We are not shipping your
machine!”
The kangaroo dances: http://www.youtube.com/watch?v=MAWl5iYOaUg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130329/956e30cf/attachment.htm>
More information about the asterisk-users
mailing list