Possible Bug (Include ${HANGUPCAUSE} in CDR)

Home » Asterisk Users » Possible Bug (Include ${HANGUPCAUSE} in CDR)
Asterisk Users 9 Comments

Ok I can’t get my CDR values to set from the h extension in either 1.6.2 or
1.8 What is wrong? Here is what I found in the cdr.conf

; Normally, CDR’s are not closed out until after all extensions are
finished
; executing. By enabling this option, the CDR will be ended before
executing
; the “h” extension so that CDR values such as “end” and “billsec” may be
; retrieved inside of of this extension. The default value is “no”.
endbeforehexten=no

The default is set to no so why can’t I store any CDR values in my h
extension.

exp..
exten => h,n,Set(CDR(cause_code)=${HANGUPCAUSE})
I need the cause code stored.

Really what I need to be able to do is in the h quickly store some values
to the CDR then.
For the write of the CDR and stopping the billing seconds. Then continue
to process some cleanup funcitons.

How can I work arround asterisk not honoring the endbeforehexten=no.
Is there some other way to achieve this?

Bryant I need the cause code stored.Really what I need to be able to do is
in the h quickly store some values to the CDR then.For the write of the CDR
and stopping the billing seconds. Then continue to process some cleanup
funcitons.How can I work arround asterisk not honoring the
endbeforehexten=no.Is there some other way to achieve this?Bryant

9 thoughts on - Possible Bug (Include ${HANGUPCAUSE} in CDR)

  • Is the CDR line your only h line? I ask because if you only have one
    priority for h then you MUST have:

    exten => h,1,Set(CDR(cause_code)=${HANGUPCAUSE})

    This is because the dialplan will not use n for the first priority and
    thus will never run.

  • _____

    href=”mailto:asterisk-users-bounces@lists.digium.com”>asterisk-users-bounces@lists.digium.com
    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Bryant
    Zimmerman
    Sent: Wednesday, December 22, 2010 11:43 AM
    Cc: Asterisk Developers Mailing List

    Ok I can’t get my CDR values to set from the h extension in either 1.6.2 or
    1.8 What is wrong? Here is what I found in the cdr.conf

    ; Normally, CDR’s are not closed out until after all extensions are finished

    ; executing. By enabling this option, the CDR will be ended before executing
    ; the “h” extension so that CDR values such as “end” and “billsec” may be
    ; retrieved inside of of this extension. The default value is “no”.
    endbeforehexten=no

    The default is set to no so why can’t I store any CDR values in my h
    extension.

    exp..
    exten => h,n,Set(CDR(cause_code)=${HANGUPCAUSE})
    I need the cause code stored.

    Really what I need to be able to do is in the h quickly store some values to
    the CDR then.
    For the write of the CDR and stopping the billing seconds. Then continue to
    process some cleanup funcitons.

    How can I work arround asterisk not honoring the endbeforehexten=no.
    Is there some other way to achieve this?

    Bryant

    I need the cause code stored.Really what I need to be able to do is in the h
    quickly store some values to the CDR then.For the write of the CDR and
    stopping the billing seconds. Then continue to process some cleanup
    funcitons.How can I work arround asterisk not honoring the
    endbeforehexten=no.Is there some other way to achieve this?Bryant

    Okay, this is a “mentally challenged” solution, but at the h extension you
    have ${UNIQUEID} and ${HANGUPCAUSE} available to you. Use DeadAGI to
    “stuff” these values into the CDR or into another file that you can
    cross-reference. If you use the two-file method, you would just select the
    matching file using uniqueid. That’s what I did when I had this problem on
    a version of 1.4.

  • Sounds like your “h” extension is in the wrong context. Try including some
    information about where you are putting the “h” extension and what includes
    you’re doing.

  • My “h” extension is in the same context as my Dial commands. Here is a cut
    back version of the code.
    The cause_code value is never stored in the mysql databae even when set in
    the “h” extension or the
    when set in “rc-ANSWER’ OR “doDialStd”

    [macro-OBD-DoOutboundDial]
    exten => s,1,Macro(${ARG1})
    exten => s,n,Set(CALLERID(name)=${siteDefaultCIDName})
    exten => s,n,Set(CALLERID(number)=${siteDefaultCIDNumber})
    exten => s,n,SipAddHeader(X-interNetGR-linetype:${gbl_ibclinetype})
    exten => s,n,SipAddHeader(X-interNetGR-actlineid:${gbl_actlineid})
    exten => s,n,Set(GROUP()=${siteGrpLineCount})
    exten => s,n,Set(c_DialArg=${ARG2})
    exten => s,n,Set(c_DialExten=${MACRO_EXTEN})
    exten => s,n,GoSub(DoLineCountCheck,1)
    exten => s,n,GotoIf($[${siteOverLineCount}=1]?OverLineCount,1)
    exten => s,n,GosubIf($[“${c_DialExten}”=”${siteDirSer}”]?OverLineCount,1)
    exten => s,n,GosubIf($[“${c_DialExten}”=”411”]?nofeature,1)
    exten => s,n,GosubIf($[“${siteUseE164}”=”1”]?doDialE164,1:doDialStd,1)
    exten => s,n,Goto(rc-${DIALSTATUS},1)
    exten => s,n,Busy(60)
    exten => s,n,Hangup()

    exten => h,1,NoOp(Cause Code = ${HANGUPCAUSE})
    exten => h,n,Set(CDR(cause_code)=${HANGUPCAUSE})
    exten => h,n,Goto(rc-${DIALSTATUS},1)

    exten => doDialStd,1,NoOp(Calling Using No E164)
    exten =>
    doDialStd,n,Macro(OBD-CheckOutboundNumber,${c_DialArg}${c_DialExten})
    exten =>
    doDialStd,n,Dial(${siteDefaultOutboundTrunk}/${c_DialArg}${c_DialExten},120,
    ge${siteDialOptionsPublic})
    exten => doDialStd,n,Set(CDR(cause_code)=${HANGUPCAUSE})
    exten => doDialStd,n,Return

    exten => rc-ANSWER,1,NoOp(Do Return ANSWER)
    exten => rc-ANSWER,n,Set(CDR(cause_code)=${HANGUPCAUSE})
    exten => rc-ANSWER,n,Hangup()

    exten => rc-BUSY,1,NoOp(Do Return BUSY)
    exten => rc-BUSY,n,Busy()
    exten => rc-BUSY,n,Hangup()

    exten => rc-NOANSWER,1,NoOp(Do Return NOANSWER)
    exten => rc-NOANSWER,n,NoOp(Cause Code = ${HANGUPCAUSE})
    exten => rc-NOANSWER,n,Hangup()

    Any more feed back would be appercaited.

    Bryant

  • No this is just a snip of the much larger code.
    The “h” extension is runing but no values port dial function aer being written. If I do a Set(CDR(field)=Value) before the dial
    The value is stored. See my other response for a larger snip of code.

    Bryant

  • There’s the problem. The “h” extension should be in whatever context is
    calling the Macro, not in the Macro context itself.

  • Tilghman

    This does not make any sense. In the voip-info posting for the “h”
    extension it specifically states that to handle “h” while in a macro that
    the macro needs an “h” extension. The “h” extension runs inside the macro
    but the CDR data is not being updated correctly. Also the rc-ANSWER entry
    in the macro does not update the CDR with the ${HANGUPCAUSE} either after
    the far end hangs up. This is diffently inconsistent behavior here. Both
    the DIAL and “h” extension are inside the macro so the behaivior should be
    consistent. If I am understanding you correctly the only way we can get a
    CDR to update after a dial is to not do any DIAL calls in a MACRO is this
    what you are saying? Otherwise your logic may be flawed or we have a very
    big logic bug in the Asterisk Macro system.

    Be aware: Macros require their own h extension as they do not make use
    of the calling context’s h extension!

    Tilghamn thanks for the feed back the back and forth here is great and
    helps a lot it is giving me more ideas to test against.

    Bryant

  • Right here is why you fail. Voip-info is very often wrong. Refer to the
    documentation that comes with Asterisk for definitive information. In
    this case, the “h” extension should be in the calling context, not within
    the Macro itself.