[Asterisk-Users] CDR manipulation in macros

Herchi Silviu Silviu.Herchi at arcelor.com
Thu Dec 8 03:11:04 MST 2005


Hi all,

I'm trying to change the CDR userfield in a macro which is executed upon
call pickup (option M in Dial command). The goal is to log the answer
time (in the default CDR it is not correct as the call is picked up to
play music on hold to the caller before Dialing the called extension). I
use Asterisk 1.0.9, with asterisk-oh323 0.6.5.

Here is my dialplan:
...
exten => s,8,Dial(OH323/1234 at 10.253.3.27:1720,20,mM(CdrAnswerDate))  ;
execute macro-CdrAnswerDate when the called extension 1234 is picked up
exten => s,9,AppendCDRUserField(no_answer )   ; if no answer after 20
sec.
...

The macro-CdrAnswerDate is defined as follows:

[macro-CdrAnswerDate]
exten => s,1,AGI(getCurrentTimeDate.sh) ; shell script that sets the
variable ANSWER_DATE to the pickup date
exten => s,2,AppendCDRUserField(answered ${ANSWER_DATE})

Here is what I get in the console:

    -- Started music on hold, class 'default', on
OH323/HiPath4000, at 10.253.3.27-393a
       > H.323 call 'ip$localhost/18575', exception CALL_ALERTED.
    -- OH323/1234 at 10.253.3.27-e5a5 is ringing
       > H.323 call 'ip$localhost/18575', exception CALL_ESTABLISHED.
    -- OH323/1234 at 10.253.3.27-e5a5 answered
OH323/HiPath4000, at 10.253.3.27-393a
    -- Executing AGI("OH323/1234 at 10.253.3.27-e5a5",
"getCurrentTimeDate.sh") in new stack
    -- Launched AGI Script /usr/local/asterisk/agi/getCurrentTimeDate.sh
       >  getCurrentTimeDate.sh: Call answered 2005-12-08 11:04:51
    -- AGI Script getCurrentTimeDate.sh completed, returning 0
    -- Executing AppendCDRUserField("OH323/1234 at 10.253.3.27-e5a5",
"answered 2005-12-08 11:04:51") in new stack
    -- Stopped music on hold on OH323/HiPath4000, at 10.253.3.27-393a
    -- H.323 call 'ip$localhost/18575' cleared, reason 4 (Cleared by
remote user), established (2 sec)
    -- Hungup 'OH323/2135 at 10.253.3.27-e5a5'

Which seems to indicate that it is OK.

However the recorded CDR Userfield (I use MySQL for that) is not
updated:  it contains only the values I had Append-ed before...

Is there a problem with changing CDRs in macros? My previous tests
showed that using ForkCDR or ResetCDR in macros doesn't work either.

Theank you for your help.

Regards,

Silviu




More information about the asterisk-users mailing list