[asterisk-users] automonitor and CDR(userfiled)

Nenad Radosavljevic nenadr at deltaplan.co.yu
Mon Apr 2 14:50:51 MST 2007


Hi all !

I'm trying to make a automonitor generated filename to "make its way"
into CRD(usrefiled), so I can keep track of recorded conversations in
CDR logs. Looking how to do that, I have found cool (but almost
undocumented) option of res_monitor: if you set monitor format in form
of "format:<string>" (i.e. "wav:monitor"), res_monitor will prefix the
monitored file name with <string> and append that resulting string to
a CDRs userfiled all by itself.

So 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
monitor/auto-{UNIXTIMESTAMP}-${TOUCH_MONITOR}.wav


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

[101]
...
...
setvar=DYNAMIC_FEATURES=automon
...
...

and in dial plan:


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

Macro "setutomon" looks like:

[macro-setautomon]
exten=>s,1,SetTOUCH_MONITOR_FORMAT=wav:monitor)
           exten=>s,n,Set(TOUCH_MONITOR=${ARG1}-${ARG2})


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), automon feature DOES work and when I press code
defined in features.conf conversation GETS  recorded, BUT instead of
getting CDR(userfiled) willed with file name I get following NOTICES
and WARRNINGS on CLI like this:

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:


"","","","","","","","","",,,"2007-04-02
23:04:38",0,0,"FAILED","Unknown","","monitor/auto-1175547871-101-24xxxxx.wav"

"","101","924xxxxx","interenational","""Home SIP""
<101>","SIP/101-b5d09318","Zap/5-1","Dial","Zap/r1/24xxxxx||TWM(setautomon^101^24xxxxx)|","2007-04-02
23:04:22","2007-04-02 23:04:27","2007-04-02
23:04:38",16,11,"ANSWERED","BILLING","1175547862.2519",""

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 something) CDR record for the call.

Does anyone knows the way to make this work, or knows the alternate
way to find out file name of auto-monitored call and add it to a
CDR(userfiled) on Asterisk 1.2.16(or 17) ?

Thanks for any info on this issue !

-- 
Kind regards,
            Nenad Radosavljevic
            email: nenadr at deltaplan.co.yu


More information about the asterisk-users mailing list