[Home]

Summary:ASTERISK-14466: Setting CDR(userfield) fails when called from inside a Macro initiated from a feature.
Reporter:Russell Brown (ruffle)Labels:
Date Opened:2009-07-14 08:33:18Date Closed:2011-06-07 14:00:30
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_features
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I use a feature code to enable recording with MixMonitor (mapped to the Record button on a snom FWIW).

The feature calls a macro and in that macro I set CDR(userfield) with the recording filename.

When the cdr record is written out (in cdr_mysql and in cdr-customer csv format) the CDR(userfield) is blank.

If I set CDR(userfield) elsewhere in my dialplan, it does propogate through to the CDR records correctly.

As I use the CDR(userfield) to get the recording filename in my web interface this is a bit annoying :-(

****** ADDITIONAL INFORMATION ******

Here's a boiled down example:

Feature:

testfeature2 => *8,self,Macro,russelltest

The Macro from extensions.conf:

[macro-russelltest]
exten => s,1,Set(CDR(userfield)="Banana")
exten => s,n,MacroExit

The console log when the feature code was pressed (on SIP/112, the call was initiated from SIP/117):

-- Executing [s@macro-russelltest:1] Set("SIP/112-0087d380", "CDR(userfield)="Banana"") in new stack
-- Executing [s@macro-russelltest:2] MacroExit("SIP/112-0087d380", "") in new stack

and finally, the cdr-customer csv record for the call:

""Aastra" <117>","117","112","from-sip","SIP/117-008b7850","SIP/112-0087d380","Dial","SIP/112|20|wWtTkK","2009-07-14 14:26:06","2009-07-14 14:26:08","2009-07-14 14:26:26","20","18","ANSWERED","DOCUMENTATION","","lls-1247577966.4810",""

(the userfield is the blank pair of quotes at the end of the line).



Comments:By: Tilghman Lesher (tilghman) 2009-07-14 10:03:00

Actually, this is completely expected, because the CDR is located on the calling channel, not the callee channel.

By: Russell Brown (ruffle) 2009-07-14 12:48:31

Oh. :-(

Sorry if this isn't the right forum to ask but how does one set the CDR(userfield) on the calling channel from within a feature/macro then?

By: Tilghman Lesher (tilghman) 2009-07-14 17:00:57

I don't think you can, from the callee channel.  Everything must be done from the caller channel, as that is where the CDR is located.  Another approach might be to create an inheritable variable before you create the slave channel, then post a record to a database with the value in that inherited variable, along with the value you want set, then associate the two records together later.

By: Russell Brown (ruffle) 2009-07-15 03:27:34

OK I'll explore that thanks.

However.... in my example above, the CDR(userfield) still doesn't make it to the cdr records if I use the *8 feature on the originating (calling) channel.

Console log when call originated from SIP/112 to SIP/117

-- Executing [s@macro-russelltest:1] Set("SIP/112-00860da0", "CDR(userfield)="Banana"") in new stack
-- Executing [s@macro-russelltest:2] MacroExit("SIP/112-00860da0", "") in new stack

and the CDR record:

""Russell Brown" <01780XXXXXX>","01780XXXXXX","117","from-sip","SIP/112-00860da0","SIP/117-008b7850","Dial","SIP/117|20|wWtTkK","2009-07-15 09:17:35","2009-07-15 09:17:36","2009-07-15 09:17:57","22","21","ANSWERED","DOCUMENTATION","Sales","lls-1247645855.5020",""

as you can see the userfield is still blank even though the CDR(userfield) was set on the calling channel.

By: Leif Madsen (lmadsen) 2009-09-18 09:41:23

I'm closing this issue for now due to the comments from Tilghman. If there is an alternate issue going on here, please open a new issue. This is pretty old now, and I know a LOT of work happened over the last few months on the CDR system by mnicholson, so it would be worth it to re-test any issues you had with a recent version of Asterisk.

Thanks!