Summary:ASTERISK-19384: REGRESSION - CLONE - CDR(accountcode) not accessable to 'Local' channels
Reporter:Maciej Krajewski (jamicque)Labels:
Date Opened:2012-02-17 07:22:36.000-0600Date Closed:2012-02-29 13:51:19.000-0600
Versions:Frequency of
is a clone ofASTERISK-18224 CDR(accountcode) not accessable to 'Local' channels
Environment:Cent OSAttachments:( 0) accountcode.patch
Description:Upgrading from 1.6.2 to 1.8.5

When setting an account code using 'Set(CDR(accountcode)=10000)' and then dialling a 'Local/number@context/n' the value is not passed to the local channel that has been created.

In the past this variable and others were accessible in the local channel allowing it to identify the correct account number.

Setting global variables 'Set(__Name=34234)' is carrying over correctly.

CDR(accountcode) used to be passed to local channel.
Comments:By: Walter Doekes (wdoekes) 2012-02-17 16:06:09.772-0600

I was upgrading from 1.6.2 to 10.2 and I noticed this too.

By: Maciej Krajewski (jamicque) 2012-02-20 04:11:53.810-0600

It is a bug - in source code there are proper line to inherit the accountcode from owner channel.

By: Maciej Krajewski (jamicque) 2012-02-20 05:46:54.444-0600

in current trunk the problem still exist

By: Walter Doekes (wdoekes) 2012-02-22 16:17:43.804-0600

Added testcase: https://reviewboard.asterisk.org/r/1765/

By: Walter Doekes (wdoekes) 2012-02-27 06:19:53.684-0600

Here's where we lose the accountcode:

r203638 | russell | 2009-06-26 17:28:53 +0200 (Fri, 26 Jun 2009) | 14 lines

Merge the new Channel Event Logging (CEL) subsystem.

CEL is the new system for logging channel events.  This was inspired after
facing many problems trying to represent what is possible to happen to a call
in Asterisk using CDR records.  For more information on CEL, see the built in
HTML or PDF documentation generated from the files in doc/tex/.

Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard
work developing this code.  Also, thanks to Matt Nicholson (mnicholson) and
Sean Bright (seanbright) for their assistance in the final push to get this
code ready for Asterisk trunk.

Review: https://reviewboard.asterisk.org/r/239/


trunk rev. 203605 (last before 203638)
"third","","3","default","","Local/3@default-f3a4;2","","Hangup","","2012-02-27 10:58:59","2012-02-27 10:58:59","2012-02-27 10:59:00",1,1,"ANSWERED","DOCUMENTATION","1330340339.5",""
"initial","","2","default","","Local/2@default-4007;2","Local/3@default-f3a4;1","Dial","Local/3@default","2012-02-27 10:58:59","2012-02-27 10:58:59","2012-02-27 10:59:00",1,1,"ANSWERED","DOCUMENTATION","1330340339.3",""
"initial","","1","default","","Local/1@default-4682;2","Local/2@default-4007;1","Dial","Local/2@default","2012-02-27 10:58:59","2012-02-27 10:58:59","2012-02-27 10:59:00",1,1,"ANSWERED","DOCUMENTATION","1330340339.1",""

trunk rev. 203638: only two records now, and the accountcode is not copied anymore
"","","2","default","","Local/2@default-58a3;2","Local/3@default-9767;1","Dial","Local/3@default","2012-02-27 10:57:17","2012-02-27 10:57:17","2012-02-27 10:57:18",1,1,"ANSWERED","DOCUMENTATION","1330340237.3",""
"initial","","1","default","","Local/1@default-0f64;2","Local/2@default-58a3;1","Dial","Local/2@default","2012-02-27 10:57:17","2012-02-27 10:57:17","2012-02-27 10:57:18",1,1,"ANSWERED","DOCUMENTATION","1330340237.1",""

trunk.. somewhere between rev.230123 and 240123: the third record is back again
"third","","3","default","","Local/3@default-de90;2","","Hangup","","2012-02-27 11:55:54","2012-02-27 11:55:54","2012-02-27 11:55:55",1,1,"ANSWERED","DOCUMENTATION","1330343754.5",""
"","","2","default","","Local/2@default-fbe5;2","Local/3@default-de90;1","Dial","Local/3@default","2012-02-27 11:55:54","2012-02-27 11:55:54","2012-02-27 11:55:55",1,1,"ANSWERED","DOCUMENTATION","1330343754.3",""
"initial","","1","default","","Local/1@default-c996;2","Local/2@default-fbe5;1","Dial","Local/2@default","2012-02-27 11:55:54","2012-02-27 11:55:54","2012-02-27 11:55:55",1,1,"ANSWERED","DOCUMENTATION","1330343754.1",""

and then between 250123 and 260123 I believe the fourth CDR gets added (the one from the Echo app)

By: Maciej Krajewski (jamicque) 2012-02-28 10:11:50.858-0600

Thanks Walter!!
You've helped very much solving this problem, there was a spelling mistake in r203638 in app_dial.c
ast_string_field_set(tc, accountcode, chan->accountcode);{code}
was changed to
if (!ast_strlen_zero(chan->accountcode)) {
ast_string_field_set(tc, peeraccount, chan->accountcode);
peeracocount should be changed to accountcode.

I will attach patch in a sec.

By: Walter Doekes (wdoekes) 2012-02-28 11:06:18.522-0600

Nice work, that makes my test case pass. Now hope it doesn't break anything else.

By: Maciej Krajewski (jamicque) 2012-02-28 11:13:09.335-0600

I've attached the patch for accountcode