Summary:ASTERISK-09229: problem with CDR record when using AUTOMON fetaure or res_monitor on outgoing calls (phone->*->telco)
Reporter:nenadr (nenadr)Labels:
Date Opened:2007-04-09 00:33:04Date Closed:2011-06-07 14:08:09
Versions:Frequency of
Description:when i try to use (almost undocumented) option of res_monitor: if you set monitor format in form of "format:<string>" (i.e. "wav:monitor"), res_monitor prefixes the monitored file name with <string> and appends that resulting string to a CDR(userfiled) all by itself, I get warrnings and one fake CSV CDR record before real CDR record for conversation. please see description below.


Basicaly for INCOMING calls I do something like this:

exten => 100,1,Set(DYNAMIC_FETAURES=automon)
exten => 100,n,Set(TOUCH_MONITOR_FORMAT=wav:monitor)
exten => 100,n,Set(TOUCH_MONITOR=${CALLERID}-${EXTEN})
exten => 100,n,Dial(SIP/100,,tw)

and in that case (of incoming calls) everything is great and my CDR
has userfiled set to something like

Poblem is of outgoing calls:
I use SIP phones so I have set in sip.conf:


and in dial plan:

exten => _9x.,1,Dial(Zap/g1/${EXTEN:1},,TWM(setautomon^${CALLERID}^${EXTEN:1})

Macro "setutomon" looks like:


So when I dial from SIP phone 101 some number starting with 9, the
call GETS answered, the macro setautomon GETS executed, and channel
variables TOUCH_MONITOR_FORMAT and TOUCH_MOINITOR GET set on outbound
channel (Zap/x-y in my case), automon feature DOES work and when I press code
defined in features.conf conversation GETS recorded, BUT instead of
getting CDR(userfiled) filled with file name I get following NOTICES
and WARRNINGS on CLI like this (they appear after call is ended):

Apr  2 23:04:38 WARNING[28970]: cdr.c:664 ast_cdr_end: CDR on channel
'<unknown>' has not started
Apr  2 23:04:38 NOTICE[28970]: cdr.c:813 post_cdr: CDR on channel
'<unknown>' lacks start
Apr  2 23:04:38 NOTICE[28970]: cdr.c:447 ast_cdr_free: CDR on channel
'<unknown>' lacks start

and one "almost empty" CDR record in Master.csv before "real" CDR
record for that conversation, like this:


"","101","924xxxxx","interenational","""Home SIP""
23:04:22","2007-04-02 23:04:27","2007-04-02

BTW: "fake" CDR doesn't get logged in MySQL database !

I have also tried to set TOUCH_MONITOR_FORMAT and TOUCH_MONITOR vars
before Dial (not from macro) on caller channel (SIP/101-xyzq) but with
same result as shown above.

It seems to me that execution of macro-setautomon happens before Dial
applications has "opened" (or did "something" with) CDR record for the call.
Comments:By: nenadr (nenadr) 2007-05-19 01:26:26

I see a lot of bug-fix commits regarding CDR engine lately, so I wonder did anyone managed to take a look at this ? I really can't figure out where to start looking....

By: Ognjen Seslija (sekil) 2007-06-16 08:26:37

I use TOUCH_MONITOR_FORMAT and TOUCH_MONITOR as global variables and have same problems in 1.2.18. Not using macro after Dial but simple record in middle of the call.

By: Jason Parker (jparker) 2007-11-07 13:44:49.000-0600

Has anybody confirmed that this is an issue in 1.4?

By: nenadr (nenadr) 2007-11-22 07:06:37.000-0600

I cannot confirm it for 1.4 since I have to stay on 1.2 because almost all of  my customers still need my support for their 1.2 installations.
On the other hand I see that bug is now confirmed.
I'm very interested to see a solution for 1.4 and try to backport it to a 1.2. Unfotunatly I didn't got too far (read it as didn't got anywhere) with understanding of how CDR works in Asterisk, to be able to find a solution myself.

By: Jason Parker (jparker) 2008-02-04 14:53:16.000-0600

Closing, as nobody has answered whether this can be confirmed as an issue with 1.4.