[Home]

Summary:ASTERISK-11431: Problem adding ${CDR(foo)} while using .call file
Reporter:Marcin Kowalczyk (kowalma)Labels:
Date Opened:2008-02-13 13:38:01.000-0600Date Closed:2008-02-20 12:48:49.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_cdr
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080213__bug11986.diff.txt
( 1) dialplan.txt
Description:I've noticed problem with adding additional fields into CDR file. Call which cames from ZAP gets CDR fileds, but when I create call via .call file this extra fields are not added. I use same macro to make a call at calling directly and via .call.

[macro-nagrywaj]
exten => s,1,Set(SPYGROUP=${ARG3})
exten => s,n,Set(CDR(PROJEKT)=IT)
exten => s,n,Set(CDR(TYP)=energis)
exten => s,n,Set(CDR(EMPLOYEE)=test)
<cut>

when using .call file rasterisk says:

[Feb 13 20:30:15] VERBOSE[5481] logger.c:     -- Executing [s@macro-nagrywaj:1] Set("Zap/111-1", "SPYGROUP=231") in new stack
[Feb 13 20:30:15] DEBUG[5481] app_macro.c: Executed application: Set
[Feb 13 20:30:15] VERBOSE[5481] logger.c:     -- Executing [s@macro-nagrywaj:2] Set("Zap/111-1", "CDR(PROJEKT)=IT") in new stack
[Feb 13 20:30:15] DEBUG[5481] app_macro.c: Executed application: Set
[Feb 13 20:30:15] VERBOSE[5481] logger.c:     -- Executing [s@macro-nagrywaj:3] Set("Zap/111-1", "CDR(TYP)=energis") in new stack
[Feb 13 20:30:15] DEBUG[5481] app_macro.c: Executed application: Set
[Feb 13 20:30:15] VERBOSE[5481] logger.c:     -- Executing [s@macro-nagrywaj:4] Set("Zap/111-1", "CDR(EMPLOYEE)=test") in new stack
[Feb 13 20:30:15] DEBUG[5481] app_macro.c: Executed application: Set

but Master.csv does not contain CDR info.

cdr_custom.conf

[mappings]
Master.csv => "${CDR(clid)}","${CDR(src)}","${CDR(dst)}","${CDR(dcontext)}","${CDR(lastapp)}","${CDR(lastdata)}","${CDR(start)}","${CDR(answer)}","${CDR(end)}","${CDR(duration)}","${CDR(billsec)}","${CDR(disposition)}","${CDR(amaflags)}","${CDR(account
code)}","${CDR(userfield)}","${CDR(uniqueid)}","${CDR(TYP)}","${CDR(SIEC)}","${CDR(PROJEKT)}","${CDR(EMPLOYEE)}"

Checked also on 1.4.16
Comments:By: Tilghman Lesher (tilghman) 2008-02-13 16:03:21.000-0600

Is it not producing a record at all or are the fields blank?

By: Tilghman Lesher (tilghman) 2008-02-13 16:06:09.000-0600

For the record, I'm able to get cdr_custom not to produce a record at all, but not to produce a record with blank fields.  In the case of not producing a record, it is because cdr_custom, if it has not registered a handler at boot, due to absence of any configuration parameters, then it will not subsequently register a handler at reload, even if a record then exists in cdr_custom.conf.

The workaround is to first unload the module and load it back.  Is this what you're seeing?

By: Tilghman Lesher (tilghman) 2008-02-13 16:12:30.000-0600

and here's a fix for that reload problem...

By: Marcin Kowalczyk (kowalma) 2008-02-13 16:18:43.000-0600

produces cdr like this:
"291","291","291","na-miasto-click","Monitor","wav|2008.02.13-23.20.04-291-|Xm","2008-02-13 23:20:00","2008-02-13 23:20:04","2008-02-13 23:20:11","11","7","ANSWERED","DOCUMENTATION","","","1202941200.0","","","",""

but should like this:

"235","235","63507","na-miasto","Monitor","wav|2008.02.13-20.56.02-963507-235|Xm","2008-02-13 20:56:02","2008-02-13 20:56:15","2008-02-13 20:56:30","28","15","ANSWERED","DOCUMENTATION","","komorka","1202932562.313","energis","","IT","test"

module cdr_custom loaded.

applying patch doesn't solve the problem.



By: Tilghman Lesher (tilghman) 2008-02-13 17:57:46.000-0600

Can you provide any additional information about your system?  Are you running any 3rd party patches or anything unusual?  Are you using ForkCDR or ResetCDR in your dialplan?

I am completely unable to reproduce the reported problem.  The only thing obviously different about my test configuration is that I am not running a macro.



By: Tilghman Lesher (tilghman) 2008-02-13 17:59:49.000-0600

For the record, I get:

"","","s","digium","Answer","","2008-02-13 16:05:34","2008-02-13 16:05:37","2008-02-13 16:05:37","3","0","ANSWERED","DOCUMENTATION","","","1202940334.7","energis","","IT","test"
"","","s","digium","Answer","","2008-02-13 17:59:12","2008-02-13 17:59:14","2008-02-13 17:59:14","2","0","ANSWERED","DOCUMENTATION","","","1202947152.0","energis","","IT","test"

By: Tilghman Lesher (tilghman) 2008-02-13 18:02:32.000-0600

If you can provide all of the parts of the dialplan that you're using to produce the problem, I'd be happy to try to reproduce it.

By: Marcin Kowalczyk (kowalma) 2008-02-14 01:35:25.000-0600

sample .call file looks like that:

CallerID: 291
Channel: Local/291@do-centrali

MaxRetries: 0
RetryTime: 60
WaitTime: 15

Context: na-miasto-click
Extension: 291
Priority: 1
Set: employee=marcin.kowalczyk
Set: team=it

I use Asterisk from tarball, no patches (except this cdr patch) included



By: Marcin Kowalczyk (kowalma) 2008-02-16 05:50:34.000-0600

Found resolution - Set(CDR) should be just before hangup() not before dial application

FIX - this does not solve the problem.



By: Marcin Kowalczyk (kowalma) 2008-02-16 14:09:28.000-0600

While starting a call with .call file I have two positions in my CDR file:

1st:
"","","291","do-centrali","Dial","ZAP/g1/291|600","2008-02-16 20:52:39","2008-02-16 20:52:44","2008-02-16 20:52:44","5","0","ANSWERED","DOCUMENTATION","","","1203191559.21","energis","","IT","marcin.kowalczyk",

2nd:
"291","291","0227291","na-miasto-click","Monitor","wav|IT-2008.02.16-20.52.44-227291--marcin.kowalczyk|Xm","2008-02-16 20:52:39","2008-02-16 20:52:44","2008-02-16 20:52:51","12","7","ANSWERED","DOCUMENTATION","","","1203191559.20","","","","",""

1st is for me unusable becouse it doesn't contain billsec so I use NoCDR in context do-centrali. Almost all information I need is in 2nd line of CDR (billsec, src number, dst number) but it doesn't contain infromation I try to append via Set(CDR(XXX))

rasterisk says:

   -- Executing [0227291@na-miasto-click:2] Set("Local/291@do-centrali-c305,1", "CDR(team)=IT") in new stack
   -- Executing [0227291@na-miasto-click:3] Set("Local/291@do-centrali-c305,1", "CDR(typ)=ORANGE") in new stack
   -- Executing [0227291@na-miasto-click:4] Set("Local/291@do-centrali-c305,1", "CDR(employee)=marcin.kowalczyk") in new stack
   -- Executing [0227291@na-miasto-click:5] Set("Local/291@do-centrali-c305,1", "CDR(projekt)=brak") in new stack
   -- Executing [0227291@na-miasto-click:6] Set("Local/291@do-centrali-c305,1", "CDR(numer)=0227291") in new stack

so information stored via SET(CDR) should be available in 2nd CDR



By: Tilghman Lesher (tilghman) 2008-02-18 16:54:34.000-0600

Please store the value of CDR(channel), so I can properly see which channel is getting which values.  I think the problem is that CDR variables are NOT inherited, the way regular channel variables can be (if you prefix them with '_').  You could enable this, by setting channel variables with those names prior to invoking the Local channel and setting the CDR variables to the values of the channel variables after the Local channel is invoked.

By: Marcin Kowalczyk (kowalma) 2008-02-20 06:04:38.000-0600

I've chcked channel like you said:

   -- Executing [1495791@na-miasto-click:1] Set("Local/289@do-centrali-3074,1", "SPYGROUP=289") in new stack
   -- Executing [1495791@na-miasto-click:2] Set("Local/289@do-centrali-3074,1", "CALLFILENAME=pomarancza-utrzymanie-anyn.kaws-2008.02.20-12.59.01-495791-289") in new stack
   -- Executing [1495791@na-miasto-click:3] Set("Local/289@do-centrali-3074,1", "CDR(team)=orange") in new stack
   -- Executing [1495791@na-miasto-click:4] Set("Local/289@do-centrali-3074,1", "CDR(typ)=ORANGE") in new stack
   -- Executing [1495791@na-miasto-click:5] Set("Local/289@do-centrali-3074,1", "CDR(employee)=anya.kaws") in new stack
   -- Executing [1495791@na-miasto-click:6] Set("Local/289@do-centrali-3074,1", "CDR(projekt)=utrzymanie") in new stack
   -- Executing [1495791@na-miasto-click:8] Set("Local/289@do-centrali-3074,1", "CDR(channel)=Local/289@do-centrali-3074,1") in new stack

so channel name is from "internal" context (there I call agent, and there is NoCDR() on this channel), is it possible to change it to detination?

By: Tilghman Lesher (tilghman) 2008-02-20 10:18:05.000-0600

You misunderstood.  I want you to add ${CDR(channel)} to your cdr_custom.conf, so we can both see which channel name the information was set.  And please remove the NoCDR, so we can see both records.

By: Marcin Kowalczyk (kowalma) 2008-02-20 10:39:59.000-0600

it looks like that:


"262" <262>","262","262","do-centrali","Dial","ZAP/g1/262|600","2008-02-20 17:37:14","2008-02-20 17:37:16","2008-02-20 17:37:16","2","0","ANSWERED","DOCUMENTATION","","","1203525434.32522","pomarancza","","utrzymanie","marcjan.zebka","","Local/262@do
-centrali-d172,2"


"262","262","949433","na-miasto-click","Monitor","wav|pomarancza-utrzymanie-marcjan.zebeka-2008.02.20-17.37.16-949433-262|mX","2008-02-20 17:37:14","2008-02-20 17:37:16","2008-02-20 17:37:59","45","43","ANSWERED","DOCUMENTATION","","","1203525434.32521","","","","","","Zap/69-1"



By: Tilghman Lesher (tilghman) 2008-02-20 10:57:43.000-0600

Okay, so in the source channel, do:

Set(_employee=${CDR(EMPLOYEE)})

and in the destination channel, do:

Set(CDR(EMPLOYEE)=${employee})

By: Marcin Kowalczyk (kowalma) 2008-02-20 11:14:45.000-0600

Still didn't help.

[do-centrali]
exten => _ZXX,1,Set(_team=${CDR(team)})
exten => _ZXX,n,Set(_employee=${EMPLOYEE})
exten => _ZXX,n,Set(_projekt=${CDR(projekt)})
exten => _ZXX,n,Set(_numer=${CDR(numer)})
exten => _ZXX,n,Dial(${CENTRALA_OUT}/${EXTEN},600)
exten => _ZXX,n,Macro(dial-result,${EXTEN})
exten => _ZXX,n,Hangup(${HANGUPCAUSE})

[na-miasto-click]
exten => _1XXXXXXXXX,1,Set(SPYGROUP=${CALLERID(name)})
exten => _1XXXXXXXXX,n,Set(CALLFILENAME=${TEAM}-${PROJEKT}-${EMPLOYEE}-${STRFTIME(${EPOCH},,%Y.%m.%d-%H.%M.%S)}-${EXTEN:1}-${CALLERID(name)})
exten => _1XXXXXXXXX,n,Set(CDR(team)=${TEAM})
exten => _1XXXXXXXXX,n,Set(CDR(typ)=ORANGE)
exten => _1XXXXXXXXX,n,Set(CDR(employee)=${EMPLOYEE})
exten => _1XXXXXXXXX,n,Set(CDR(projekt)=${PROJEKT})
exten => _1XXXXXXXXX,n,Set(CDR(numer)=${NUMER})
exten => _1XXXXXXXXX,n,Monitor(wav,${CALLFILENAME},mb)
exten => _1XXXXXXXXX,n,Dial(${ORANGE_OUT}/${EXTEN},60)


do-centrali is source context, na-miasto-click is destiation.

Dialplan You provided unfortunately produces same output in CDR (without employee, etc in destination number)

By: Tilghman Lesher (tilghman) 2008-02-20 11:57:22.000-0600

Then I'm afraid there is no way to do what you want, because you're sending the call outside of the PBX.

By: Marcin Kowalczyk (kowalma) 2008-02-20 12:05:14.000-0600

Maybe there is some way to store valid billsec in CDR of source channel ? Any idea?

By: Tilghman Lesher (tilghman) 2008-02-20 12:48:49.000-0600

May be, but this is not a generic help forum.  Please ask on the -users list.