Detailed CDR

I’m not sure if what I want to do can be done at least with CDR.

I want to configure a call center in with agents will earn money based on time talking with callers.

If one agent transfer call to another I need to get a line in cdr Master.csv with total time agent has been talking with caller and then another line with the transfer (call duration of the second agent)

Is CDR only write on call ends?

I have seen column “lastapp” is only showing last “Application” executed like “Dial” or “Hangup”… is it possible to generate a line for each instruction in dialplan?

For exaple for:

exten => s,1,Answer
exten => s,n,GotoIfTime(9:00-14:00|mon-fri||?queue,s,1)
exten => s,n,Playback(out-of-time)
exten => s,n,Hangup

With CDR I only get or Hangup as lastapp or another thing that I cant remember but is something about call answer by an agent.

Is it possible to get something like:

555,answer,1 seconds, 1 second
555,gotoiftime,1 seconds, 2 seconds
555,playback,15 seconds, 17 seconds
555,hangup,1 second, 18 seconds.

Now I just can now 1,hangup,18 seconds… can CDR or asterisk get more detailed information about transfers and actions?

Thank in advance.

Any expert can tell me if what I was looking for is ForkCDR?


exten => s,1,Answer
exten => s,2,Playback(welcome)
exten => s,3,ForkCDR()
exten => s,4,GotoIfTime(9:00-14:00|mon-fri||?queue,s,1)
exten => s,5,ForkCDR()
exten => s,6,Hangup

If I have understood this, this command is going to write CDR with time elapsed since answer to the end of the playback of “welcome” and after agent answer the call another CDR will be write, isn’t it?

I have not very much idea of ForkCDR but you can do it as follows:-

exten => s,1,Answer

exten => s,n,ResetCDR(w)
exten => s,n,Set(CDR(userfield)=STEP-1)
exten => s,n,Playback(welcome)

exten => s,n,ResetCDR(w)
exten => s,n,Set(CDR(userfield)=STEP-2)
exten => s,n,GotoIfTime(9:00-14:00|mon-fri||?queue,s,1)

exten => s,n,ResetCDR(w)
exten => s,n,Set(CDR(userfield)=STEP-1)
exten => s,n,Hangup

This will write 3 lines for the whole call. In cdr the value of the field ‘userfiled’ will be STEP-1, STEP-2, STEP-3 respectively.

Adnan Raza

i’ve dealt with such queries before, and i think all what you are looking for can be generated through running the proper queries over the queue log generated by Asterisk, which usually resides at /var/log/asterisk/queue_log.
you can transfer all queue log information into a database and then manipulate it in whatever way you want.
have a look here: … +queue_log

There is a radical redesign of Asterisk call logging (now to become event logging) in progress at the moment, because of its inadequacies in complex cases.

Thanks for all the answers I will test adnanraza and Mustafa_saa sugestions.