Re: [asterisk-users] Asterisk 11 - Change CDR in hangup exten [Was: CDR values changed in hangup handler not saved]
Le 29 mars 2013 18:26, "Julian Lyndon-Smith" a écrit : > > you can't set values in the h extension _unless_ you use the > endbeforehexten option in cdr.conf I did and couldn't get it to work :-( > > you may need to reload the cdr module or restart asterisk for the > option to take effect. > > It works. You mean it does work in asterisk 11 ? Which CDR variables did you then play with ? I know it does, as I use hangup handlers all the time. Much > better than the h extension ;) I fully agree ! > > > Julian > > On 29 March 2013 14:06, Olivier wrote: > > 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) > > the fact found in Master.csv is foo, the value set before entering the > > hangup extension (see previous dialplan)). > > > > To me, this is either a feature ("you can't set CDR values in hangup exten") > > or a bug. > > > > How would you qualify this ? > > > > > > 2013/3/29 Julian Lyndon-Smith > >> > >> 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 wrote: > >>> > >>> > >>> > >>> > >>> 2013/3/29 Julian Lyndon-Smith > > 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@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 > >>> > >>> -- > >>> ___
Re: [asterisk-users] Asterisk 11 - Change CDR in hangup exten [Was: CDR values changed in hangup handler not saved]
you can't set values in the h extension _unless_ you use the endbeforehexten option in cdr.conf you may need to reload the cdr module or restart asterisk for the option to take effect. It works. I know it does, as I use hangup handlers all the time. Much better than the h extension ;) Julian On 29 March 2013 14:06, Olivier wrote: > 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) > the fact found in Master.csv is foo, the value set before entering the > hangup extension (see previous dialplan)). > > To me, this is either a feature ("you can't set CDR values in hangup exten") > or a bug. > > How would you qualify this ? > > > 2013/3/29 Julian Lyndon-Smith >> >> 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 wrote: >>> >>> >>> >>> >>> 2013/3/29 Julian Lyndon-Smith 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@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, D
Re: [asterisk-users] Asterisk 11 - Change CDR in hangup exten [Was: CDR values changed in hangup handler not saved]
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) the fact found in Master.csv is foo, the value set before entering the hangup extension (see previous dialplan)). To me, this is either a feature ("you can't set CDR values in hangup exten") or a bug. How would you qualify this ? 2013/3/29 Julian Lyndon-Smith > 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 wrote: > >> >> >> >> 2013/3/29 Julian Lyndon-Smith >> >>> 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@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 > > -- > _ > -- 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 UNSUBSC
Re: [asterisk-users] Asterisk 11 - Change CDR in hangup exten [Was: CDR values changed in hangup handler not saved]
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 wrote: > > > > 2013/3/29 Julian Lyndon-Smith > >> 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@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 -- _ -- 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
Re: [asterisk-users] Asterisk 11 - Change CDR in hangup exten [Was: CDR values changed in hangup handler not saved]
2013/3/29 Julian Lyndon-Smith > 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@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