Summary:ASTERISK-05615: Asterisk crashes if ForkCDR is used in macro called from Dial()
Reporter:Radek Kochlewski (falkinhan)Labels:
Date Opened:2005-11-15 18:20:03.000-0600Date Closed:2011-06-07 14:00:59
Versions:Frequency of
Environment:Attachments:( 0) agi-test-awk.agi
( 1) asterisk_tty9.log
( 2) extensions.conf
( 3) screenlog.0
Description:Asterisk crashes if ForkCDR is used in macro called from Dial()

CDR is recorded succesfully

****** STEPS TO REPRODUCE ******

put in extensions.conf

exten => 11,1,Dial(Zap/2|20|gM(mytestmacro))

exten => s,1,ForkCDR(macro)

call 11 from mycontext


console output:
Nov 16 00:32:01 DEBUG[6236]: chan_zap.c:3802 zt_handle_event: channel 2 answered
   -- Zap/2-1 answered SIP/71422-afb4
   -- Executing ForkCDR("Zap/2-1", "macro") in new stack                                                                                                                                            
Comments:By: BJ Weschke (bweschke) 2005-11-15 18:41:14.000-0600

This wasn't reproducible in the lab environment here at IP4IT using today's CVS-HEAD code. Please post your extensions.conf that's causing this crash.

By: Tilghman Lesher (tilghman) 2005-11-15 19:22:15.000-0600

If this is a crash, then you MUST send us a gdb stack backtrace generated from the core file.  Please see the notes on the Main page as to how to generate a stack backtrace from a core file.

By: Radek Kochlewski (falkinhan) 2005-11-16 04:08:41.000-0600

some additional information.
- output on tty9 is a bit better then the others (full screen attached)
Nov 16 10:19:15 DEBUG[8869]: pbx.c:1667 pbx_extension_helper: Launching 'ForkCDR'
   -- Executing ForkCDR("Zap/2-1", "macro") in new stack
Nov 16 10:19:15 DEBUG[6548]: devicestate.c:187 do_state_change: Changing state for Zap/2 - state 2 (In use)
Ouch ... error while writing audio data: : Broken pipe
Warning, flexibel rate not heavily tested!

- there is not core dump
- my simple script is not runned (result is the same when is commented in extensions.conf), but if somebody need, is attached
- about extensions.conf:
 - used context is [default]
 - in attached extensions.conf line 388 is commented, uncomment it and put right prioritys (sorry).

      exten => s,1,ForkCDR(macro)
      exten => s,2,NoOp(mamy makro)

- system is mandrivalinux 2006.0

By: Serge Vecher (serge-v) 2005-11-16 08:44:07.000-0600

falkinhan, you have to build asterisk with "make dont-optimize" instead of "make install" and then run ansterisk with -g option to produce the core file. This is all outlined in README.backtrace

By: Radek Kochlewski (falkinhan) 2005-11-16 11:10:06.000-0600

bactrace is in screenlog.0
if you want to enter the system, please let me know out of public.

By: Kevin P. Fleming (kpfleming) 2005-11-16 13:32:08.000-0600

Fixed in CVS HEAD... ForkCDR should not be called in this way (since the channel doesn't have a CDR to fork), but at least now it won't segfault.

By: Radek Kochlewski (falkinhan) 2005-11-16 16:07:57.000-0600

now it's working fine (no crash - there is the most important),
CRD is not generated from macro (I think You right, there is not good idea to call CDR this way, but I tried this, because I want to get information how caller is connected),
but all CDRs are dropped at the end of whole procedure.
I think there is not good and not standatd behavior.
on the serial calls (and transfers)
CDR should be dropped imidiatelly at the end of each call (or after each transfer).
With out this there is a problem to control on line account of caller.
Aditionally, as standard of many PBXes, if call is transferred, you can choose, who will be charged (transferring or transferred party) and CDR has special mark of transfer.

By: BJ Weschke (bweschke) 2005-11-16 16:12:56.000-0600

This isn't really the same issue, and it's also not a bug. We're going to close this one out again. Please take your question to the -users list.

By: Digium Subversion (svnbot) 2008-01-15 15:56:25.000-0600

Repository: asterisk
Revision: 7118

U   trunk/ChangeLog
U   trunk/apps/app_forkcdr.c

r7118 | kpfleming | 2008-01-15 15:56:24 -0600 (Tue, 15 Jan 2008) | 2 lines

issue ASTERISK-5615