[Home]

Summary:ASTERISK-05766: [patch] Channel hangs after second ForkCDR+SetCDRUserField
Reporter:Alex Zhilyakov (azhilyakov)Labels:
Date Opened:2005-12-02 17:44:07.000-0600Date Closed:2008-01-15 16:06:33.000-0600
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:[custom-astcard]
exten => s,1,Answer()
exten => s,2,ForkCDR()
exten => s,3,SetCDRUserField(aaaaa)
exten => s,4,ForkCDR()
exten => s,5,SetCDRUserField(bbbbb)
exten => s,6,NoOp(OKEY)
exten => s,7,HangUp()

This script hangs after executing step 5 and never reaches step 6.

I'm using Asterisk@Home 1.5 which features Asterisk 1.0.9.


****** ADDITIONAL INFORMATION ******

pbx*CLI>
   -- Executing SetVar("SIP/66.193.176.47-0856d298", "FROM_DID=12123794030") in new stack
   -- Executing Goto("SIP/66.193.176.47-0856d298", "custom-astcard|s|1") in new stack
   -- Goto (custom-astcard,s,1)
   -- Executing Answer("SIP/66.193.176.47-0856d298", "") in new stack
   -- Executing ForkCDR("SIP/66.193.176.47-0856d298", "") in new stack
   -- Executing SetCDRUserField("SIP/66.193.176.47-0856d298", "aaaaa") in new stack
   -- Executing ForkCDR("SIP/66.193.176.47-0856d298", "") in new stack
   -- Executing SetCDRUserField("SIP/66.193.176.47-0856d298", "bbbbb") in new stack
pbx*CLI>

[ ** STUCK FOREVER ** ]

Comments:By: Olle Johansson (oej) 2005-12-02 18:56:21.000-0600

You are using an old version of Asterisk. Please test with 1.2 and see if the problem remains.

By: Alex Zhilyakov (azhilyakov) 2005-12-02 20:11:58.000-0600

I would love to use Asterisk 1.2.0, but there is no Asterisk@Home featuring Asterisk 1.2.0 released yet, and I'm bound to @Home due to nature of the projects.

I would highly appreciate any help and advice how to resolve the given problem.

Thank you.

By: Alex Zhilyakov (azhilyakov) 2005-12-05 09:32:04.000-0600

I fixed it. The patch is below.
The problem was that cdr->next was not cleared upon cdr duplication, creating a loop on second ForkCDR().


--- apps/app_forkcdr.c.orig     2005-12-05 11:12:36.000000000 -0500
+++ apps/app_forkcdr.c  2005-12-05 11:13:36.000000000 -0500
@@ -37,6 +37,7 @@
static void ast_cdr_clone(struct ast_cdr *cdr) {
       struct ast_cdr *newcdr = ast_cdr_alloc();
       memcpy(newcdr,cdr,sizeof(struct ast_cdr));
+       newcdr->next = NULL;
       ast_cdr_append(cdr,newcdr);
       gettimeofday(&newcdr->start, NULL);
       memset(&newcdr->answer, 0, sizeof(newcdr->answer));

By: Russell Bryant (russell) 2005-12-13 00:39:36.000-0600

This is not an issue in 1.2 or the trunk, but I'll go ahead and stick this in the 1.0 branch since the patch is obviously correct.

By: Russell Bryant (russell) 2005-12-13 00:42:19.000-0600

This fix has been committed to the 1.0 branch.  It will be in 1.0.11 whenever that gets released.  I have a security fix that will be going in soon.  After that, I'll probably release it.

By: Digium Subversion (svnbot) 2008-01-15 16:06:33.000-0600

Repository: asterisk
Revision: 7467

U   branches/1.0/apps/app_forkcdr.c

------------------------------------------------------------------------
r7467 | russell | 2008-01-15 16:06:32 -0600 (Tue, 15 Jan 2008) | 2 lines

properly reset the 'next' pointer when duplicating the cdr (issue ASTERISK-5766)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=7467