Summary:ASTERISK-21215: Unexpected Behavior in Adaptive CDR when U() used on Dial
Reporter:JoshE (n8ideas)Labels:
Date Opened:2013-03-06 18:19:40.000-0600Date Closed:2013-03-06 21:33:17.000-0600
Versions:11.2.1 Frequency of
Description:Issuing these two lines in dialplan:

same => n,Set(CDR(extension_family)=My Family)
same => n,Dial(SIP/1-Tenant&SIP/2-Tenant,60,grU(set-CallGroupInfo,s,1))

Where, set-CallGroupInfo =

exten => s,1,NoOp(Setting Call Group Information)
same => n,Set(TEMP=${CUT(CHANNEL,/,2)})
same => n,Set(EXTENSION=${CUT(TEMP,-,1)})
same => n,ExecIf($[ "${TENANT}" = "" ]?Set(__TENANT=${CUT(TEMP,-,2)}))
same => n,Set(CDR(extension)=${EXTENSION})
same => n,Set(CDR(extension_name)=${EXT_NAME})
same => n,Set(CDR(extension_location)=${EXT_LOCATION})

Does not write those fields to the CDR line generated for the call.  The adaptive CDR simply ignores them when writing out the record.

However, the line above Dial (extension_family) is written properly.  I believe the expected behavior, based on the documentation I have, is that those fields should be written when called from GoSub.
Comments:By: Matt Jordan (mjordan) 2013-03-06 21:33:02.338-0600

No, this isn't a bug.

U - Execute via Gosub the routine x for the called channel before connecting to the calling channel. Arguments can be specified to the Gosub using ^ as a delimiter. The Gosub routine can set the variable GOSUB_RESULT to specify the following actions after the Gosub returns.

The U option is executed on the called channels, not the calling channel. The CDR function is modifying properties on the called channels in the subroutine, while the CDR that gets written is for the calling channel.

If you want to modify properties on the calling channel, use the B pre-dial option.