Summary:ASTERISK-21688: CDR record cannot be modified in 'h' extension when 'g' option is used in Dial application
Reporter:Emiliano (elmemis)Labels:
Date Opened:2013-04-24 21:28:06Date Closed:2013-04-25 09:40:34
Status:Closed/CompleteComponents:Applications/app_dial CDR/General Features
Versions:11.2.1 Frequency of
duplicatesASTERISK-16998 AGI CDR Update bug
Environment:Debian Squeeze 64x Asterisk 11.2-cert1Attachments:
Description:Can't update CDR (cdr_adaptive_odbc) custom fields after hangup.
I tried by setting endbeforehexten with yes or no.

exten => s,1,Dial(SIP/TEST,,g)
same => n,Set(CDR(field)=testing)
same => n,hangup()

exten => h,1,Noop(Set different value for field)
same => n,Set(CDR(field)=hanguptest)
same => n,hangup()
Comments:By: Emiliano (elmemis) 2013-04-24 21:32:01.617-0500

this section works (set var cdr under Dial cmd):
exten => s,1,Set(CDR(field)=testing)
exten => s,2,Dial(SIP/TEST,,g)
same => n,hangup()

this section don't works:
exten => h,1,Noop(Set different value for field)
same => n,Set(CDR(field)=hanguptest)
same => n,hangup()

I need update CDR after hangup.

By: Matt Jordan (mjordan) 2013-04-25 09:40:27.964-0500

Interesting. This only occurs when the 'g' option is present as an option passed to the Dial application.

When the 'g' option is set, the {{AST_FEATURE_NO_H_EXTEN}} is applied to the caller channel's features. This has the result of not running the {{h}} extension on the channel when the peer hangs up, and causes the goofy CDR logic in features to not be executed. In general, this is a 'good' thing, however, when the bridge is broken the CDR is written automatically. This means that when the {{h}} extension is executed on the caller channel, the CDR is already out the door, and you can't catch it. The {{Set}} in the {{h}} extension is actually executing on a non-existant CDR record on the caller channel.

I don't see us changing this behavior.
# It would require us changing CDR behavior in a release branch.
# It is incredibly complex, and attempting to hold the CDR for the bridge after the bridge has been broken would have far-reaching implications.
# There is an easy work around: don't use the 'g' flag if you don't need to.
# Even if you do need the 'g' flag, then set the property on the CDR prior to the bridge being created using one of the various interception macros or subroutines.

By: Emiliano (elmemis) 2013-04-25 11:07:58.039-0500

Dear Matt,
I need to incorporate in the CDR who hangup.

In my Dialplan set this value when hangup communication.

exten => 111,1,Noop(Inbound call)
exten => 111,n,Dial(SIP/111,,g)
exten => 111,n,Set(CDR(term)=CALLED) ;**
exten => 111,n,Noop(Hangup Called)

exten => h,1,Noop(Hangup caller)
exten => h,n,Set(CDR(term)=CALLER) ;**

** Execute this lines but not update in CDR.

I understand that can be done using some agi or some other mechanism. What I wanted to do was add complexity to my DialPlan. In callcenters is very important to have this information.

I appreciate your response and that later would add this information to the CDR.

Sorry to report it as an error but not it.