[Home]

Summary:ASTERISK-23069: Custom CDR variable not recorded when set in macro called from app_queue
Reporter:Bryan Anderson (shadow431)Labels:
Date Opened:2013-12-24 17:06:34.000-0600Date Closed:2014-02-19 20:41:01.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:CDR/cdr_custom CDR/General
Versions:1.8.20.0 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-23174 CDR documentation issues
is related toASTERISK-23046 Custom CDR fields set during a GoSUB called from app_queue are not inserted
Environment:CentOS 6.5Attachments:( 0) cdr_custom.conf
( 1) debug
( 2) extensions.conf
( 3) full
( 4) logger.conf
( 5) queues.conf
( 6) results.txt
Description:When setting CDR variable within a Macro called by a Queue only the predefined Variables can be set. (CDR(userfield)=works, CDR(myvariable)=Notworks)

extensions.conf = http://pastebin.com/CQmdwJhc
cdr_custom.conf = http://pastebin.com/DnLCY28L
queues.conf = http://pastebin.com/8HAbLcmX

results = http://pastebin.com/gAZ9FiBc
Comments:By: Rusty Newton (rnewton) 2013-12-30 19:18:26.157-0600

We just opened this bug ASTERISK-23046, I'll bet these are the same root issue.

By: Rusty Newton (rnewton) 2013-12-30 19:19:50.719-0600

@Bryan

Please attach all of your configuration files and debug as per the guidelines. (Don't link to an external host) https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

By: Bryan Anderson (shadow431) 2014-01-16 10:59:03.821-0600

debug is just debug, full should be everything.  refer to logger.conf for config of log files

By: Bryan Anderson (shadow431) 2014-01-16 11:02:01.115-0600

I have attached the configs and some log output.  If you need other configs let me know.  The debug and the full logs show the same call.

Thanks,
Bryan

By: Rusty Newton (rnewton) 2014-01-21 21:18:22.007-0600

I wasn't able to reproduce this in 12, with the normal format like

{noformat}
[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)})},${CDR(sequence)},${CSV_QUOTE(${CDR(acustomfield1)})},${CSV_QUOTE(${CDR(acustomfield2)})}
{noformat}

and output printing to cdr-custom/Master.csv. Do you get the same behavior with the csv format?

I'll try it in 1.8 when I get a chance as well.

By: Bryan Anderson (shadow431) 2014-01-21 21:30:36.167-0600

yes i do get this weather its CSV or like above.  The first thing I tried was to use the CSV.  I haven't tried any other version as its not in the repo we use.  I would be willing to try just haven't had time.  The JSON usage came about to easily kick it out to log stash for a dash board for sales.

Bryan

By: Rusty Newton (rnewton) 2014-01-21 21:41:11.305-0600

When using dialplan like the following:

{noformat}
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no

[globals]

[from-internal]
;set the acustomfield1 and userfield CDR fields on the calling channel before hitting the queue
exten => 602,1,Set(CDR(acustomfield1)=something1)
same => n,Set(CDR(userfield)=ISetThisOnTheCALLINGChannel)
same => n,Queue(support,,,,30,,my-queue-macro)
;same => n,Queue(support,,,,30,,,submytest)
same => n,Hangup

[macro-my-queue-macro]
;set the userfield and acustomfield2 CDR fields on the *called* channel after the two channels are bridged
exten => s,1,Set(CDR(userfield)=ISetThisOnTheCalledChannel)
same => n,Set(CDR(acustomfield2)=something2)
{noformat}

I get output like the following (using the JSON format):
{noformat}
{"Source":"6002","Destination":"602","Context":"from-internal","SourceChannel":"SIP/6002-0000002d","DestinationChannel":"SIP/6001-0000002e","LastAPP":"Queue","LastData":"support,,,,30,,my-queue-macro","Start":"2014-01-21 21:38:05","Answer":"2014-01-21 21:38:06","End":"2014-01-21 21:38:07","Duration":"0.002000","BillSec":"0.001000","Disposition":"ANSWERED","amaFlags":"DOCUMENTATION","AccountCode":"","UniqueID":"1390361885.67","UserField":"ISetThisOnTheCALLINGChannel;ISetThisOnTheCalledChannel","Sequence":45,"acustomfield1":"something1","acustomfield2":"something2"}
{noformat}

So I get values set in the userfield on both channels, plus both of the custom fields set on the calling and called channels.

By: Bryan Anderson (shadow431) 2014-01-21 21:45:41.393-0600

is this in version 12 or 1.8?

By: Rusty Newton (rnewton) 2014-02-19 20:31:41.773-0600

Sorry to add to the confusion. I had tested with 12 forgetting that CDR is different in many ways in 12.

A few items to clarify:

1. The documentation for the app_queue Macro parameter is incorrect. It is executed by the *called* channel, in this case the queue member. We will fix this.

2. In 1.8 and 11, you can't set the custom fields on Party B's channel. Which is what we are doing here when we try to set a custom field in the Macro called by app_queue. Trying to change that behavior would likely result in other bugs in CDR as there are known issues with the internal architecture, hence the changes in 12.

3. You can set the "userfield" field on both the Party A and Party B channels. The values will be delimited by a semi-colon "like;this"

4. There is an open bug with 3: ASTERISK-20046 where the first value will be duplicated resulting in output "likelike;this"


We'll track the documentation fix (1) in this issue and close it out once the documentation is patched.