[Home]

Summary:ASTERISK-26818: cdr: Problem setting variables in h exten
Reporter:Sebastian Gutierrez (sum)Labels:
Date Opened:2017-02-23 14:16:15.000-0600Date Closed:2017-03-24 17:46:14
Priority:MajorRegression?
Status:Closed/CompleteComponents:CDR/cdr_adaptive_odbc CDR/General
Versions:13.14.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 1314NOTWORKING.txt
( 1) 1314NOTWORKING2.txt
( 2) 1314WORKING.txt
( 3) ASTERISK-26818.diff
( 4) cdr.conf
( 5) full
Description:If I set on the h extension   CDR(userfield) = test

the insert created never has the userfield (using cdr_adaptative) and other variables are also not setted

{noformat}
[Feb 23 17:02:26] DEBUG[2634]: pbx_variables.c:474 ast_str_substitute_variables_full: Evaluating 'CDR(userfield)' (from 'CDR(userfield)})' len 14)
[Feb 23 17:02:26] DEBUG[2634]: pbx_variables.c:508 ast_str_substitute_variables_full: Function CDR(userfield) result is ''
[Feb 23 17:02:26] DEBUG[2634]: pbx_variables.c:508 ast_str_substitute_variables_full: Function CSV_QUOTE() result is '""'
[Feb 23 17:02:26] DEBUG[2634]: pbx_variables.c:474 ast_str_substitute_variables_full: Evaluating 'CSV_QUOTE(${CDR(uniqueid)})' (from 'CSV_QUOTE(${CDR(uniqueid)})},${CSV_QUOTE(${CDR(type)})},${CSV_QUOTE(${CDR(guid)})},${CSV_QUOTE(${CDR(causecode)})},${CSV_QUOTE(${CDR(campaign)})},${CSV_QUOTE(${CDR(direction)})},${CSV_QUOTE(${CDR(carrier)})},${CSV_QUOTE(${CDR(linkedid)})},${CSV_QUOTE(${CDR(peeraccount)})},${CDR(sequence)},${CDR(charged_balance)},${CDR(real_balance)},${CSV_QUOTE(${CDR(note)})},${CDR(contact)},${CSV_QUOTE(${CDR(dialerbase)})},


[INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,type,guid,causecode,campaign,direction,linkedid,peeraccount,sequence,contact,dialerbase,parandvalues) VALUES ({ ts '2017-02-23 17:01:38' },'"PowerDialer:PTI<-:5556446467:f4c9f887-d830-4e49-b339-6f93ba632af020170223T1538','5556446467','5556446467','PowerDialer','SIP/TRK_TELEMDIC-00000012','SIP/2502-00000014','Queue','PTI<-,TtKk,,,600,,,,,',47,47,'ANSWERED',3,'PowerDialer','1487880093.30','record','38c9889c-757b-4fb8-ad02-13b8b66f3caa','16','PTI<-','outgoing','1487880093.30','URIELMONTER',18,113086,'f4c9f887-d830-4e49-b339-6f93ba632af020170223T153800','Documento=PROTOTELEM63_02858')]
{noformat}


userfield is shown on core show channel XXXXXX and is setted on an h extension



seems to be that all variables existing before h execution are not overwritten with the new values that are setted on h exten, this worked in 13.13


this function ast_str_substitute_variables_full (line 398) gives empty string for variables that I try to overwrite on h exten


there is also an UTF-8 problem I think accents are not saved ok
example: I set CDR(userfield) from AMI before hangup, then I have this on the database:
;No Contactación|Telefono buzón|PROTOTELEM63_09015
the ; seems to concat both channels data and as I just setting one channel one is empty, I repeat that this worked fine on 13.13 accents were ok and not using the ;
is this the intended behaviour now? I think this is a breaking change for this branch...
Comments:By: Asterisk Team (asteriskteam) 2017-02-23 14:16:16.612-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Joshua C. Colp (jcolp) 2017-02-24 06:29:43.660-0600

Can you please provide a log with this under 13.13.0 to show what happens there?

I looked at the commits and there have been no changes to CDRs (or ODBC, or adaptive CDR) in this area between 13.13.0 and 13.14.0 so knowing for sure the behavior difference would help to narrow down what happened.

By: Sebastian Gutierrez (sum) 2017-02-27 07:31:08.006-0600

I think this has to be with if the channel is bridged or not

1) NOTWORKING on 1314 is an outbound call and userfield is set on h exten and then on cdr is null

2) WORKING is a simple inbound call that there is no dstchannel no bridge and works ok

3) NOTWORKING2 is the same as 2 but is connected to a dstchannel, in this case the userfield is null


13.13 has the same behaviour I will try to find in wich version stopped working

By: Sebastian Gutierrez (sum) 2017-02-27 09:01:24.807-0600

seems that has been happening for quite some time on 13, tested 13.12, 13.10 same thing, I cannot override on h the variables when bridged I think, because if for example a Dial fails and the h is executed the variable is overwritten maybe this is because was not generated on the channel before the bridge??

By: Joshua C. Colp (jcolp) 2017-03-02 08:59:17.339-0600

If you try this attached patch does it resolve the problem?

If not please provide the dialplan that can be used to reproduce the problem, the full console output, as well as your cdr.conf so that it can be reproduced and isolated.

By: Juan Elzaurdia (jelzaurdia) 2017-03-02 17:55:31.771-0600

Hi i work with sebastian.
We tested with this fix but the problem remains.

Here is the dialplan:
{noformat}
[testuserfield]

exten=> h,1,Set(CDR(userfield)=test hoy)

exten=> _9[124].,1,GUID(__guid)
exten=> _9[124].,2,Set(CDR(guid)=${guid})
exten=> _9[124].,3,Set(CDR(campaign)=LOCALES)
exten=> _9[124].,4,Set(CDR(type)=record)
exten=> _9[124].,5,MixMonitor(${guid}.gsm,b,)
exten=> _9[124].,6,Dial(Khomp/B0C30/${EXTEN:1},60,TtKk,)
exten=> _9[124].,7,Hangup()
{noformat}


By: Juan Elzaurdia (jelzaurdia) 2017-03-02 17:56:45.045-0600

also attaching the full with debug level.

By: Sebastian Gutierrez (sum) 2017-03-20 13:34:55.139-0500

any update on this?

By: Joshua C. Colp (jcolp) 2017-03-20 13:43:10.206-0500

The issue has been triaged and accepted. Any updates will be posted here, as well as any questions (if there are any) when work begins. If you'd like to see it completed faster we've recently published a blog post[1] which has some pointers.

[1] http://blogs.asterisk.org/2017/03/15/five-shocking-tips-get-asterisk-bugs-resolved-quickly/

By: Sebastian Gutierrez (sum) 2017-03-21 09:59:10.123-0500

I change a bit the patch uploaded and added the same condition to the function



{noformat}
ast_cdr_setuserfield

&& it_cdr->next != NULL
{noformat}
and seems to work but I would like if you could validate if is ok doing that validation



By: Friendly Automation (friendly-automation) 2017-03-24 17:46:15.362-0500

Change 5276 merged by zuul:
cdr: Allow setting of user field from 'h' extension

[https://gerrit.asterisk.org/5276|https://gerrit.asterisk.org/5276]

By: Friendly Automation (friendly-automation) 2017-03-24 17:49:26.608-0500

Change 5281 merged by zuul:
cdr: Allow setting of user field from 'h' extension

[https://gerrit.asterisk.org/5281|https://gerrit.asterisk.org/5281]

By: Friendly Automation (friendly-automation) 2017-03-24 18:03:25.135-0500

Change 5282 merged by Joshua Colp:
cdr: Allow setting of user field from 'h' extension

[https://gerrit.asterisk.org/5282|https://gerrit.asterisk.org/5282]