[asterisk-users] cdr_adaptive_odbc writing CDR before h extension is processed
Eric Chamberlain
eric at rf.com
Fri Sep 12 19:27:30 CDT 2008
We are using Asterisk 1.6rc6 and are trying to set some values before
the cdr is inserted into the database, but the cdr is inserted before
the h extension is processed.
What are we doing wrong? How can we get these extra values in the CDR?
In cdr.conf we have:
endbeforehexten=no
And our dial plans end with:
exten => h,1,Macro(create-cdr)
The macro:
[macro-create-cdr]
; populate all the CDR fields
exten => s,1,NoOp("HANGUPCAUSE: ${HANGUPCAUSE} Call-ID: $
{BRIDGEPVTCALLID}")
exten => s,n,Set(CDR(hangupcause)=${HANGUPCAUSE})
exten => s,n,Set(CDR(call_id)=${BRIDGEPVTCALLID})
And the logs show:
When the call is answered:
-- Executing [s at macro-hunt-dial:3] Dial("SIP/
192.168.93.170-090493c8", "SIP/echo123 at skype1") in new stack
== Using SIP RTP CoS mark 5
-- Called echo123 at skype1
-- SIP/skype1-0903b6e8 is ringing
-- SIP/skype1-0903b6e8 answered SIP/192.168.93.170-090493c8
-- Packet2Packet bridging SIP/192.168.93.170-090493c8 and SIP/
skype1-0903b6e8
> [INSERT INTO dialer_cdr
(channel
,clid
,src
,dcontext
,dst
,dstchannel
,lastapp
,lastdata
,start,answer,end_time,duration,billsec,disposition,amaflags,uniqueid)
VALUES ('SIP/192.168.93.170-090493c8','5107109260','5107109260','cgp-
in','echo123','SIP/skype1-0903b6e8','Dial','SIP/echo123 at skype1',{ ts
'2008-09-12 20:13:29' },{ ts '2008-09-12 20:13:43' },{ ts '2008-09-12
20:13:47' },18,4,8,3,'1221264809.96')]
== Spawn extension (macro-hunt-dial, s, 3) exited non-zero on 'SIP/
192.168.93.170-090493c8' in macro 'hunt-dial'
== Spawn extension (macro-hunt-dial, s, 3) exited non-zero on 'SIP/
192.168.93.170-090493c8'
-- Executing [h at macro-hunt-dial:1] Macro("SIP/
192.168.93.170-090493c8", "create-cdr") in new stack
-- Executing [s at macro-create-cdr:1] NoOp("SIP/
192.168.93.170-090493c8", ""HANGUPCAUSE: 16 Call-ID: 7ad208f11942bb1f074207521f66141b at 10.225.199.190
"") in new stack
-- Executing [s at macro-create-cdr:2] Set("SIP/
192.168.93.170-090493c8", "CDR(hangupcause)=16") in new stack
-- Executing [s at macro-create-cdr:3] Set("SIP/
192.168.93.170-090493c8", "CDR(call_id)=7ad208f11942bb1f074207521f66141b at 10.225.199.190
") in new stack
When the callee hangs up before the call is answered:
-- Executing [s at macro-hunt-dial:3] Dial("SIP/
192.168.93.170-090493c8", "SIP/echo123 at skype1") in new stack
== Using SIP RTP CoS mark 5
-- Called echo123 at skype1
-- SIP/skype1-0903b6e8 is ringing
== Spawn extension (macro-hunt-dial, s, 3) exited non-zero on 'SIP/
192.168.93.170-090493c8' in macro 'hunt-dial'
== Spawn extension (macro-hunt-dial, s, 3) exited non-zero on 'SIP/
192.168.93.170-090493c8'
-- Executing [h at macro-hunt-dial:1] Macro("SIP/
192.168.93.170-090493c8", "create-cdr") in new stack
-- Executing [s at macro-create-cdr:1] NoOp("SIP/
192.168.93.170-090493c8", ""HANGUPCAUSE: 0 Call-ID: "") in new stack
-- Executing [s at macro-create-cdr:2] Set("SIP/
192.168.93.170-090493c8", "CDR(hangupcause)=0") in new stack
-- Executing [s at macro-create-cdr:3] Set("SIP/
192.168.93.170-090493c8", "CDR(call_id)=") in new stack
-- Executing [s at macro-create-cdr:4] Set("SIP/
192.168.93.170-090493c8", "CDR(agent)=") in new stack
> [INSERT INTO dialer_cdr
(channel
,clid
,src
,dcontext
,dst
,dstchannel
,lastapp
,lastdata
,start,answer,end_time,duration,billsec,disposition,amaflags,uniqueid)
VALUES ('SIP/192.168.93.170-090493c8','5107109260','5107109260','cgp-
in','echo123','SIP/skype1-0903b6e8','Dial','SIP/echo123 at skype1',{ ts
'2008-09-12 20:23:28' },{ ts '2008-09-12 20:23:28' },{ ts '2008-09-12
20:23:33' },5,0,4,3,'1221265408.98')]
--
Eric Chamberlain
More information about the asterisk-users
mailing list