[Home]

Summary:ASTERISK-08695: After ForkCDR AGI cant set CDR(userfield)
Reporter:kokoskarokoska (kokoskarokoska)Labels:
Date Opened:2007-01-31 03:40:04.000-0600Date Closed:2011-06-07 14:03:19
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_agi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:In AGI if I use ForkCDR and than set CDR(userfield), the value in CDR stay unchanged. If I do it thru the dialplan everything works OK.

BTW: settings of CDR(accouncode) works fine...

Than! k.r.


DEBUG:
// --------------------------------------------------------
pbx3*CLI>
   -- Executing [2302@fake1:1] NoOp("SIP/2301-b7d0bcf8", "fake1 context") in new stack
   -- Executing [2302@fake1:2] Set("SIP/2301-b7d0bcf8", "CDR(accountcode)=1234") in new stack
   -- Executing [2302@fake1:3] Set("SIP/2301-b7d0bcf8", "CDR(userfield)=6789") in new stack
   -- Executing [2302@fake1:4] NoOp("SIP/2301-b7d0bcf8", "CDR(accountcode)=1234") in new stack
   -- Executing [2302@fake1:5] NoOp("SIP/2301-b7d0bcf8", "CDR(userfield)=6789") in new stack
   -- Executing [2302@fake1:6] AGI("SIP/2301-b7d0bcf8", "fake.php") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/fake.php
AGI Tx >> agi_request: fake.php

AGI Tx >> agi_channel: SIP/2301-b7d0bcf8

AGI Tx >> agi_language: en

AGI Tx >> agi_type: SIP

AGI Tx >> agi_uniqueid: 1170235680.36

AGI Tx >> agi_callerid: 2301

AGI Tx >> agi_calleridname: qwerty

AGI Tx >> agi_callingpres: 0

AGI Tx >> agi_callingani2: 0

AGI Tx >> agi_callington: 0

AGI Tx >> agi_callingtns: 0

AGI Tx >> agi_dnid: 2302

AGI Tx >> agi_rdnis: unknown

AGI Tx >> agi_context: fake1

AGI Tx >> agi_extension: 2302

AGI Tx >> agi_priority: 6

AGI Tx >> agi_enhanced: 0.0

AGI Tx >> agi_accountcode: 1234

AGI Tx >>

AGI Rx << EXEC ForkCDR
   -- AGI Script Executing Application: (ForkCDR) Options: ((null))
AGI Tx >> 200 result=0

AGI Rx << SET VARIABLE CDR(accountcode) abcd
AGI Tx >> 200 result=1

AGI Rx << SET VARIABLE CDR(userfield) xxxx
AGI Tx >> 200 result=1

   -- AGI Script fake.php completed, returning 0
   -- Executing [2302@fake1:7] NoOp("SIP/2301-b7d0bcf8", "CDR(accountcode)=1234") in new stack
   -- Executing [2302@fake1:8] NoOp("SIP/2301-b7d0bcf8", "CDR(userfield)=6789") in new stack
   -- Executing [2302@fake1:9] Set("SIP/2301-b7d0bcf8", "CDR(accountcode)=a1b2c3") in new stack
   -- Executing [2302@fake1:10] Set("SIP/2301-b7d0bcf8", "CDR(userfield)=7x8y9z") in new stack
   -- Executing [2302@fake1:11] NoOp("SIP/2301-b7d0bcf8", "CDR(accountcode)=1234") in new stack
   -- Executing [2302@fake1:12] NoOp("SIP/2301-b7d0bcf8", "CDR(userfield)=6789") in new stack
   -- Executing [2302@fake1:13] Hangup("SIP/2301-b7d0bcf8", "") in new stack
 == Spawn extension (fake1, 2302, 13) exited non-zero on 'SIP/2301-b7d0bcf8'
pbx3*CLI>
// --------------------------------------------------------

And in CDR I have got this:
// --------------------------------------------------------
""qwerty" <2301>","2301","2302","fake1","SIP/2301-b7d0bcf8","","ForkCDR","","2007-01-31 10:28:00","","2007-01-31 10:28:00","0","0","NO ANSWER","DOCUMENTATION","1234","1170235680.36","6789"

""qwerty" <2301>","2301","2302","fake1","SIP/2301-b7d0bcf8","","Hangup","","2007-01-31 10:28:00","","2007-01-31 10:28:00","0","0","NO ANSWER","DOCUMENTATION","a1b2c3","1170235680.36","7x8y9z"
// --------------------------------------------------------


Extensions.conf
// --------------------------------------------------------
[fake1]
exten => _X.,1,NoOp(fake1 context)
exten => _X.,n,Set(CDR(accountcode)=1234)
exten => _X.,n,Set(CDR(userfield)=6789)
exten => _X.,n,NoOp(CDR(accountcode)=${CDR(accountcode)})
exten => _X.,n,NoOp(CDR(userfield)=${CDR(userfield)})
exten => _X.,n,AGI(fake.php)
exten => _X.,n,NoOp(CDR(accountcode)=${CDR(accountcode)})
exten => _X.,n,NoOp(CDR(userfield)=${CDR(userfield)})
exten => _X.,n,Set(CDR(accountcode)=a1b2c3)
exten => _X.,n,Set(CDR(userfield)=7x8y9z)
exten => _X.,n,NoOp(CDR(accountcode)=${CDR(accountcode)})
exten => _X.,n,NoOp(CDR(userfield)=${CDR(userfield)})
exten => _X.,n,Hangup
// --------------------------------------------------------
Comments:By: Kenneth Shumard (kshumard) 2007-05-24 17:21:37

Are you sure this is related to AGI? I've tried on 1.4.0 and 1.4-branch (r65978) and I do see weirdness, but not the exact same thing you report. Specifically, a ForkCDR called from AGI followed by a call to set a CDR variable does not appear to display properly when using Noops in the dialplan to show it. However, my actual CDRs were written with the proper values. I could get the exact same behavior by calling ForkCDR in the dialplan without using AGI. Here's output:

   -- Executing [s@test:1] Answer("IAX2/ksh_digium-3", "") in new stack
   -- Executing [s@test:2] Set("IAX2/ksh_digium-3", "CDR(accountcode)=acctcode1") in new stack
   -- Executing [s@test:3] Set("IAX2/ksh_digium-3", "CDR(userfield)=uf1") in new stack
   -- Executing [s@test:4] NoOp("IAX2/ksh_digium-3", "CDR(accountcode) = "acctcode1"") in new stack
   -- Executing [s@test:5] NoOp("IAX2/ksh_digium-3", "CDR(userfield) = "uf1"") in new stack
   -- Executing [s@test:6] ForkCDR("IAX2/ksh_digium-3", "v") in new stack
   -- Executing [s@test:7] Set("IAX2/ksh_digium-3", "CDR(accountcode)=acctcode2") in new stack
   -- Executing [s@test:8] Set("IAX2/ksh_digium-3", "CDR(userfield)=uf2") in new stack
   -- Executing [s@test:9] NoOp("IAX2/ksh_digium-3", "CDR(accountcode) = "acctcode1"") in new stack
   -- Executing [s@test:10] NoOp("IAX2/ksh_digium-3", "CDR(userfield) = "uf1"") in new stack
   -- Executing [s@test:11] Hangup("IAX2/ksh_digium-3", "") in new stack

Behavior was the same whether I passed the 'v' option to ForkCDR or not. The apparent behavior is that the CDR posts properly, but the CDR() dialplan function refers to the original CDR instead of the forked CDR (though I haven't looked at the code to see if this is true).

Does this match your experience?

By: Joshua C. Colp (jcolp) 2007-06-19 12:58:24

This isn't a bug, you want to use the 'l' option to the CDR dialplan function to get the last record.