Keep dst CDR Record If Context Change

Home » Asterisk Users » Keep dst CDR Record If Context Change
Asterisk Users 8 Comments

Hello nice group,

Having a Problem with CDRs. If i change the context with Goto() Asterisk write the new exten in “dst” cdr field. How can i keep the old entry? Any ideas makes me very happy.

Thanks for helping me.
Daniel

8 thoughts on - Keep dst CDR Record If Context Change

  • Hi Danny,
    Thank you for answer.

    I’m using Asterisk 1.8.7.0

    Daniel

    Am 30.03.2012 um 20:18 schrieb “Danny Nicholas” :

  • So you have a situation like so:
    [default]
    Exten => _X.,1,Answer
    Exten => _X.,n,Goto(foo,s,1)
    [foo[
    Exten => s,1,playback(vm-goodbye)
    Exten => s,n,hangup()

    And you get two CDR records, 1 with default and 1 with foo?

  • No, he should be getting 1 record with “s” in the dst field.

    To the OP: have you tried setting a channel variable to “${EXTEN} before
    your Goto() command, and then in the “h” exten write it back into the cdr?
    Something like:

    [incoming]
    exten => _X.,1,Verbose(New call coming in – verify routing)
    exten => _X.,n,Set(finaldst=${EXTEN})
    exten => _X.,n,Goto(mainmenu,s,1)

    exten => h,1,Verbose(Hanging up)
    exten => h,n,Set(CDR(dst)=${finaldst})

  • No, he should be getting 1 record with “s” in the dst field.

    To the OP: have you tried setting a channel variable to “${EXTEN} before
    your Goto() command, and then in the “h” exten write it back into the cdr?
    Something like:

    [incoming]
    exten => _X.,1,Verbose(New call coming in – verify routing)
    exten => _X.,n,Set(finaldst=${EXTEN})
    exten => _X.,n,Goto(mainmenu,s,1)

    exten => h,1,Verbose(Hanging up)
    exten => h,n,Set(CDR(dst)=${finaldst})

  • Looks nice, was also my first idea, but field dst is read only. I can’t overwrite this and get an error like this

    ERROR[2474]: cdr.c:345 ast_cdr_setvar: Attempt to set the ‘dst’ read-only variable!.

    Am 30.03.2012 um 22:00 schrieb Warren Selby:

  • I was afraid of that. Does it absolutely have to be dst that you store
    this information in? You can create custom cdr fields that are both
    readable and writeable. Something like:

    [incoming]
    exten => _X.,1,Verbose(New call coming in)
    exten => _X.,n,Set(CDR(original_dst)=${EXTEN})
    exten => _X.,n,Goto(mainmenu,s,1)

  • Create a field called ‘dnid’, this then is the original called number, no
    matter now much you jump around with contexts.

    Alec Davis