Eric Chamberlain
2008-Sep-13 00:27 UTC
[asterisk-users] cdr_adaptive_odbc writing CDR before h extension is processed
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
Tilghman Lesher
2008-Sep-13 03:11 UTC
[asterisk-users] cdr_adaptive_odbc writing CDR before h extension is processed
On Friday 12 September 2008 19:27:30 Eric Chamberlain wrote:> 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)I have to turn this over to Steve Murphy, as you're asking a question about when the driver is actually called. Steve? -- Tilghman
Steve Murphy
2008-Sep-15 14:02 UTC
[asterisk-users] cdr_adaptive_odbc writing CDR before h extension is processed
On Fri, 2008-09-12 at 17:27 -0700, Eric Chamberlain wrote:> 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 >Sorry, Eric-- It's all my fault. I've been working on CDR bugs for the last year or two, on and off. And one fix in one place usually knocks something else out of commission in another place. I've spent the last week working on various CDR issues, tho, and one of them was Mantis bug 13251, (http://bugs.digium.com/view.php?id=13251) "endbeforehexten=yes is useless now" I've had branches open for a week or two now, and committed the fix late last week, to 1.4, trunk, 1.6.0, and 1.6.1. So, feel free to update your release svn and give it a spin. Let me know about any problems with the h extension. My CDR concerns at the moment: A. I have one bug posted on a devilishly tricky crash due to my changes, involving a transfer situation, that I'm working on at the moment (http://bugs.digium.com/view.php?id=13467); I hope to have it fixed ASAP, if I can reproduce it. B. Single-channel CDRs (see http://bugs.digium.com/view.php?id=12946) The criteria for filtering out which to ignore, and which to post isn't quite perfect. I need to study this out and get it working right. murf> > > 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 > > > > > > > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > AstriCon 2008 - September 22 - 25 Phoenix, Arizona > Register Now: http://www.astricon.net > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-- Steve Murphy Software Developer Digium -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3227 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20080915/db608620/attachment.bin