CDR on MySQL

Home » Asterisk Users » CDR on MySQL
Asterisk Users 4 Comments

Hi All,

I’ve got this dialplan:

[macro-callout-intl]
exten => s,1,ResetCDR(w)
exten => s,2,Dial(IAX2/${ARG1}/018${OUTBOUND}||t|L(${OUTTIME}00:6000))
exten => s,3,Goto(s-${DIALSTATUS},1)
exten => s,4,Hangup(19)
exten => s-BUSY,1,NoCDR()
exten => s-BUSY,n,Playback(user&is-curntly-busy)
exten => s-BUSY,n,Hangup(19)
exten => s-CONGESTION,1,NoCDR()
exten => s-CONGESTION,n,Playback(user&is-curntly-busy)
exten => s-CONGESTION,n,Hangup(19)
exten => s-CHANUNAVAIL,1,NoCDR()
exten => s-CHANUNAVAIL,n,Playback(user&is-curntly-unavail)
exten => s-CHANUNAVAIL,n,Hangup(19)
exten => s-NOANSWER,1,NoCDR()
exten => s-NOANSWER,n,Playback(number-not-answering)
exten => s-NOANSWER,n,Hangup(19)
;exten => s-ANSWER,1,ResetCDR(w)
;exten => s-ANSWER,n,Set(CDR(UserField)=${SIP_HEADER(From)})
;exten => s-ANSWER,n,Hangup(19)
exten => h,1,DEADAGI(get-unqiueid.php)

on the last line…i would like to get the uniqueid of the call and use
it to compute cost of the call. unfortunately with this setup, after i
hangup, it does not insert the CDR yet. so my AGI get-unqiueid.php does
not find any record. have i placed my ResetCDR(w) correctly?

thank you in advanced.

regards
Ron

4 thoughts on - CDR on MySQL

  • I had the same problem last week, my fix was adding:
    [columns]
    alias uniqueid => uniqueid

    to cdr_mysql.conf

  • Hi I have tried setting endbeforehexten=yes but still CDR does not get
    inserted before h exten. what i tried is setting ResetCDR(w) before the
    DEADAGI. Like this:

    exten => h,1,ResetCDR(w)
    exten => h,2,DEADAGI(get-unqiueid.php)

    it seems to work but it’s inserting 2 record on the CDR, one with
    disposition ANSWERED and one with NO ANSWER.

    any ideas? thanks again.

    regards
    Ron

  • What would it do if you
    exten => h,1,ResetCDR(w)
    exten => h,2,NoCDR()
    exten => h,3,DEADAGI(get-unqiueid.php)

    I have not tried it but in theory it should write the first CDR and then
    kill the write of the second NO ANSWER CDR.

    Let me know if it works for you as I may need to do it on some of my h
    exten code as well.

    Bryant