[asterisk-commits] murf: branch murf/newcdr r63965 - in /team/murf/newcdr: doc/ funcs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 11 12:32:44 MST 2007


Author: murf
Date: Fri May 11 14:32:44 2007
New Revision: 63965

URL: http://svn.digium.com/view/asterisk?view=rev&rev=63965
Log:
some doc updates

Added:
    team/murf/newcdr/doc/cel-doc.tex   (with props)
Modified:
    team/murf/newcdr/funcs/func_cel.c

Added: team/murf/newcdr/doc/cel-doc.tex
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/doc/cel-doc.tex?view=auto&rev=63965
==============================================================================
--- team/murf/newcdr/doc/cel-doc.tex (added)
+++ team/murf/newcdr/doc/cel-doc.tex Fri May 11 14:32:44 2007
@@ -1,0 +1,875 @@
+
+\section(Design Goals)
+
+CEL is being written with the hopes that it will help solve some of the problems
+that were difficult to address in CDR records. Some difficulties in CDR generation
+are the fact that the CDR record stores three events: the "Start" time, the "Answer" 
+time, and the "End" time. Billing time is usually the difference between "Answer" and
+"End", and total call duration was the difference in time from "Start" to "End".
+The trouble with this direct and simple approach is the fact that calls can be 
+transferred, put on hold, conferenced, forwarded, etc. In general, those doing billing
+applications in Asterisk find they have to do all sorts of very creative things to 
+overcome the shortcomings of CDR records, often supplementing the CDR records with
+AGI scripts and manager event filters.
+
+CEL is an acronym, taken from "Channel Event Logging".
+
+The fundamental assumption is that the Channel is the fundamental communication object in asterisk,
+which basically provides a communication channel between two communication ports. It makes
+sense to have an event system aimed at recording important events on channels. Each 
+Event is attached to a channel, like ANSWER or HANGUP. Some events are meant to connect
+two or more channels, like the BRIDGE_START event. Some events, like BLINDTRANSFER, are initiated
+by one channel, but affect two others. These events use the Peer field, like BRIDGE would,
+to point to the target channel.
+
+The design philosophy of CEL is to generate event data that can grouped together to form
+a billing record. This may not be a simple task, but we hope to provide a few different 
+examples that could be used as a basis for those involved in this effort.
+
+There are definite parallels between Manager events and CEL events; but there are some differences. 
+Some events that are generated by CEL are not generated by the Manager interface (yet). CEL is
+optimized for databases, and Manager events are not. The focus of CEL is billing. The Manager interface
+is targeted to real-time monitoring and control of asterisk.
+
+To give the reader a feel for the complexities involved in billing, please take note of the
+following sequence of events:
+
+Remember that 150, 151, and 152 are all Zap extension numbers, and their respective devices are
+Zap/50, Zap/51, and Zap/52.
+
+152 dials 151; 151 answers.  152 parks 151; 152 hangs up.  150 picks up the park (dials 701).  150 and 151 converse.
+151 flashes hook; dials 152, talks to 152, then 151 flashes hook again for 3-way conference. 151 converses with the
+other two for a while, then hangs up. 150 and 152 keep conversing, then hang up. 150 hangs up first.(not that it matters).
+
+This sequence of actions will generate the following annotated list of 42 CEL events:
+
+\begin{verbatim}
+"EV_CHAN_START","2007-05-09 12:46:16","fxs.52","152","","","","s","extension","Zap/52-1","","","DOCUMENTATION","","1178736376.3","",""                                   ;;; 152 takes the phone off-hook
+"EV_APP_START","2007-05-09 12:46:18","fxs.52","152","152","","","151","extension","Zap/52-1","Dial","Zap/51|30|TtWw","DOCUMENTATION","","1178736376.3"                   ;;; 152 finishes dialing 151
+"EV_CHAN_START","2007-05-09 12:46:18","fxs.51","151","","","","s","extension","Zap/51-1","","","DOCUMENTATION","","1178736378.4","",""                                   ;;; 151 channel created, starts ringing
+--151 is ringing
+"EV_ANSWER","2007-05-09 12:46:19","","151","152","","","151","extension","Zap/51-1","AppDial","(Outgoing Line)","DOCUMENTATION","","1178736378.4","",""                  ;;; 151 answers
+"EV_ANSWER","2007-05-09 12:46:19","fxs.52","152","152","","","151","extension","Zap/52-1","Dial","Zap/51|30|TtWw","DOCUMENTATION","","1178736376.3","",""                ;;; so does 152 (???)
+"EV_BRIDGE_START","2007-05-09 12:46:20","fxs.52","152","152","","","151","extension","Zap/52-1","Dial","Zap/51|30|TtWw","DOCUMENTATION","","1178736376.3","","Zap/51-1"  ;;; 152 and 151 are bridged
+--151 and 152 are conversing
+"EV_BRIDGE_END","2007-05-09 12:46:25","fxs.52","152","152","","","151","extension","Zap/52-1","Dial","Zap/51|30|TtWw","DOCUMENTATION","","1178736376.3","",""            ;;; after 5 seconds, the bridge ends (152 dials #700?)
+"EV_BRIDGE_START","2007-05-09 12:46:25","fxs.52","152","152","","","151","extension","Zap/52-1","Dial","Zap/51|30|TtWw","DOCUMENTATION","","1178736376.3","","Zap/51-1"  ;;; extraneous 0-second bridge?
+"EV_BRIDGE_END","2007-05-09 12:46:25","fxs.52","152","152","","","151","extension","Zap/52-1","Dial","Zap/51|30|TtWw","DOCUMENTATION","","1178736376.3","",""            ;;;
+"EV_PARK_START","2007-05-09 12:46:27","","151","152","","","","extension","Zap/51-1","Parked Call","","DOCUMENTATION","","1178736378.4","",""                            ;;; 151 is parked
+"EV_HANGUP","2007-05-09 12:46:29","fxs.52","152","152","","","h","extension","Zap/52-1","","","DOCUMENTATION","","1178736376.3" ,"",""                                   ;;; 152 hangs up 2 sec later
+"EV_CHAN_END","2007-05-09 12:46:29","fxs.52","152","152","","","h","extension","Zap/52-1","","","DOCUMENTATION","","1178736376.3","",""                                  ;;; 152's channel goes away
+--151 is parked and listening to MOH! now, 150 picks up, and dials 701
+"EV_CHAN_START","2007-05-09 12:47:08","fxs.50","150","","","","s","extension","Zap/50-1","","","DOCUMENTATION","","1178736428.5","",""                                   ;;; 150 picks up the phone, dials 701
+"EV_PARK_END","2007-05-09 12:47:11","","151","152","","","","extension","Zap/51-1","Parked Call","","DOCUMENTATION","","1178736378.4","",""                              ;;; 151's park comes to end
+"EV_ANSWER","2007-05-09 12:47:11","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","",""                     ;;; 150 gets answer (twice)
+"EV_ANSWER","2007-05-09 12:47:12","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","",""                     ;;;
+"EV_BRIDGE_START","2007-05-09 12:47:12","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"       ;;; bridge begins between 150 and recently parked 151
+--150 and 151 are conversing, then 151 hits flash
+"EV_CHAN_START","2007-05-09 12:47:51","fxs.51","151","","","","s","extension","Zap/51-2","","","DOCUMENTATION","","1178736471.6","",""                                   ;;; 39 seconds later, 51-2 channel is created. (151 flashes hook)
+"EV_HOOKFLASH","2007-05-09 12:47:51","","151","152","","","","extension","Zap/51-1","Bridged Call","Zap/50-1","DOCUMENTATION","","1178736378.4","","Zap/51-2"            ;;; a marker to record that 151 flashed the hook
+"EV_BRIDGE_END","2007-05-09 12:47:51","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"         ;;; bridge ends between 150 and 151
+"EV_BRIDGE_START","2007-05-09 12:47:51","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"       ;;; 0-second bridge from 150 to ?  150 gets no sound at all
+"EV_BRIDGE_END","2007-05-09 12:47:51","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"         ;;;
+"EV_BRIDGE_START","2007-05-09 12:47:51","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"       ;;; bridge start on 150
+--151 has dialtone after hitting flash; dials 152
+"EV_APP_START","2007-05-09 12:47:55","fxs.51","151","151","","","152","extension","Zap/51-2","Dial","Zap/52|30|TtWw","DOCUMENTATION","","1178736471.6","",""             ;;; 151-2 dials 152 after 4 seconds
+"EV_CHAN_START","2007-05-09 12:47:55","fxs.52","152","","","","s","extension","Zap/52-1","","","DOCUMENTATION","","1178736475.7" ,"",""                                  ;;; 152 channel created to ring 152.
+--152 ringing
+"EV_ANSWER","2007-05-09 12:47:58","","152","151","","","152","extension","Zap/52-1","AppDial","(Outgoing Line)","DOCUMENTATION","","1178736475.7","",""                  ;;; 3 seconds later, 152 answers
+"EV_ANSWER","2007-05-09 12:47:58","fxs.51","151","151","","","152","extension","Zap/51-2","Dial","Zap/52|30|TtWw","DOCUMENTATION","","1178736471.6","",""                ;;;   ... and 151-2 also answers
+"EV_BRIDGE_START","2007-05-09 12:47:59","fxs.51","151","151","","","152","extension","Zap/51-2","Dial","Zap/52|30|TtWw","DOCUMENTATION","","1178736471.6","","Zap/51-1"  ;;; 1 second later, bridge formed betw. 151-2 and 151
+--152 answers, 151 and 152 convering; 150 is listening to silence; 151 hits flash again... to start a 3way
+"EV_3WAY_START","2007-05-09 12:48:58","","151","152","","","","extension","Zap/51-1","Bridged Call","Zap/50-1","DOCUMENTATION","","1178736378.4","","Zap/51-2"           ;;; another hook-flash to begin a 3-way conference
+"EV_BRIDGE_END","2007-05-09 12:48:58","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"         ;;; -- almost 1 minute later, the bridge ends (151 flashes hook again)
+"EV_BRIDGE_START","2007-05-09 12:48:58","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"       ;;; 0-second bridge at 150. (3 way conf formed)
+"EV_BRIDGE_END","2007-05-09 12:48:58","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"         ;;;
+"EV_BRIDGE_START","2007-05-09 12:48:58","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"       ;;; bridge starts for 150
+--3way now, then 151 hangs up.
+"EV_BRIDGE_END","2007-05-09 12:49:26","fxs.50","150","150","","","701","extension","Zap/50-1","ParkedCall","701","DOCUMENTATION","","1178736428.5","","Zap/51-1"         ;;; 28 seconds later, bridge ends
+"EV_HANGUP","2007-05-09 12:49:26","","151","152","","","","extension","Zap/51-1","Bridged Call","Zap/50-1","DOCUMENTATION","","1178736378.4","",""                       ;;; 151 hangs up, leaves 150 and 152 connected
+"EV_CHAN_END","2007-05-09 12:49:26","","151","152","","","","extension","Zap/51-1","Bridged Call","Zap/50-1","DOCUMENTATION","","1178736378.4","",""                     ;;; 151 channel ends
+"EV_CHAN_END","2007-05-09 12:49:26","fxs.51","151","151","","","h","extension","Zap/51-2<ZOMBIE>","","","DOCUMENTATION","","1178736428.5","",""                          ;;; 152-2 channel ends (zombie)
+--just 150 and 152 now
+"EV_BRIDGE_END","2007-05-09 12:50:13","fxs.50","150","150","","","152","extension","Zap/50-1","Dial","Zap/52|30|TtWw","DOCUMENTATION","","1178736471.6","",""            ;;; 47 sec later, the bridge from 150 to 152 ends
+"EV_HANGUP","2007-05-09 12:50:13","","152","151","","","","extension","Zap/52-1","Bridged Call","Zap/50-1","DOCUMENTATION","","1178736475.7","",""                       ;;; 152 hangs up
+"EV_CHAN_END","2007-05-09 12:50:13","","152","151","","","","extension","Zap/52-1","Bridged Call","Zap/50-1","DOCUMENTATION","","1178736475.7","",""                     ;;; 152 channel ends
+"EV_HANGUP","2007-05-09 12:50:13","fxs.50","150","150","","","h","extension","Zap/50-1","","","DOCUMENTATION","","1178736471.6","",""                                    ;;; 150 hangs up
+"EV_CHAN_END","2007-05-09 12:50:13","fxs.50","150","150","","","h","extension","Zap/50-1","","","DOCUMENTATION","","1178736471.6","",""                                  ;;; 150 ends
+\end{verbatim}
+
+In terms of Manager events, the above Events correspond to the following 80 Manager events:
+
+\begin{verbatim}
+Event: Newchannel
+Privilege: call,all
+Channel: Zap/52-1
+State: Rsrvd
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801102.5
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/52-1
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801102.5
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/52-1
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801102.5
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/52-1
+State: Ring
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801102.5
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/52-1
+Context: extension
+Extension: 151
+Priority: 1
+Application: Set
+AppData: CDR(myvar)=zingo
+Uniqueid: 1178801102.5
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/52-1
+Context: extension
+Extension: 151
+Priority: 2
+Application: Dial
+AppData: Zap/51|30|TtWw
+Uniqueid: 1178801102.5
+
+Event: Newchannel
+Privilege: call,all
+Channel: Zap/51-1
+State: Rsrvd
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801108.6
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/51-1
+State: Ringing
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801108.6
+
+Event: Dial
+Privilege: call,all
+SubEvent: Begin
+Source: Zap/52-1
+Destination: Zap/51-1
+CallerIDNum: 152
+CallerIDName: fxs.52
+SrcUniqueID: 1178801102.5
+DestUniqueID: 1178801108.6
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/51-1
+CallerIDNum: 151
+CallerIDName: <Unknown>
+Uniqueid: 1178801108.6
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/52-1
+State: Ringing
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801102.5
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/51-1
+State: Up
+CallerIDNum: 151
+CallerIDName: <unknown>
+Uniqueid: 1178801108.6
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/52-1
+State: Up
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801102.5
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/52-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801102.5
+Uniqueid2: 1178801108.6
+CallerID1: 152
+CallerID2: 151
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/52-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801102.5
+Uniqueid2: 1178801108.6
+CallerID1: 152
+CallerID2: 151
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/52-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801102.5
+Uniqueid2: 1178801108.6
+CallerID1: 152
+CallerID2: 151
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/52-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801102.5
+Uniqueid2: 1178801108.6
+CallerID1: 152
+CallerID2: 151
+
+Event: ParkedCall
+Privilege: call,all
+Exten: 701
+Channel: Zap/51-1
+From: Zap/52-1
+Timeout: 45
+CallerIDNum: 151
+CallerIDName: <unknown>
+
+Event: Dial
+Privilege: call,all
+SubEvent: End
+Channel: Zap/52-1
+DialStatus: ANSWER
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/52-1
+Context: extension
+Extension: h
+Priority: 1
+Application: Goto
+AppData: label1
+Uniqueid: 1178801102.5
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/52-1
+Context: extension
+Extension: h
+Priority: 4
+Application: Goto
+AppData: label2
+Uniqueid: 1178801102.5
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/52-1
+Context: extension
+Extension: h
+Priority: 2
+Application: NoOp
+AppData: In Hangup! myvar is zingo and accountcode is  billsec is 26 and duration is 40 and end is 2007-05-10 06:45:42.
+Uniqueid: 1178801102.5
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/52-1
+Context: extension
+Extension: h
+Priority: 3
+Application: Goto
+AppData: label3
+Uniqueid: 1178801102.5
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/52-1
+Context: extension
+Extension: h
+Priority: 5
+Application: NoOp
+AppData: More Hangup message after hopping around"
+Uniqueid: 1178801102.5
+
+Event: Hangup
+Privilege: call,all
+Channel: Zap/52-1
+Uniqueid: 1178801102.5
+Cause: 16
+Cause-txt: Normal Clearing
+
+Event: Newchannel
+Privilege: call,all
+Channel: Zap/50-1
+State: Rsrvd
+CallerIDNum: 150
+CallerIDName: fxs.50
+Uniqueid: 1178801162.7
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/50-1
+CallerIDNum: 150
+CallerIDName: fxs.50
+Uniqueid: 1178801162.7
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/50-1
+CallerIDNum: 150
+CallerIDName: fxs.50
+Uniqueid: 1178801162.7
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/50-1
+State: Ring
+CallerIDNum: 150
+CallerIDName: fxs.50
+Uniqueid: 1178801162.7
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: 701
+Priority: 1
+Application: ParkedCall
+AppData: 701
+Uniqueid: 1178801162.7
+
+Event: UnParkedCall
+Privilege: call,all
+Exten: 701
+Channel: Zap/51-1
+From: Zap/50-1
+CallerIDNum: 151
+CallerIDName: <unknown>
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/50-1
+State: Up
+CallerIDNum: 150
+CallerIDName: fxs.50
+Uniqueid: 1178801162.7
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Newchannel
+Privilege: call,all
+Channel: Zap/51-2
+State: Rsrvd
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801218.8
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/51-2
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801218.8
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/51-2
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801218.8
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/51-2
+State: Ring
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801218.8
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/51-2
+Context: extension
+Extension: 152
+Priority: 1
+Application: Set
+AppData: CDR(myvar)=zingo
+Uniqueid: 1178801218.8
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/51-2
+Context: extension
+Extension: 152
+Priority: 2
+Application: Dial
+AppData: Zap/52|30|TtWw
+Uniqueid: 1178801218.8
+
+Event: Newchannel
+Privilege: call,all
+Channel: Zap/52-1
+State: Rsrvd
+CallerIDNum: 152
+CallerIDName: fxs.52
+Uniqueid: 1178801223.9
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/52-1
+State: Ringing
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801223.9
+
+Event: Dial
+Privilege: call,all
+SubEvent: Begin
+Source: Zap/51-2
+Destination: Zap/52-1
+CallerIDNum: 151
+CallerIDName: fxs.51
+SrcUniqueID: 1178801218.8
+DestUniqueID: 1178801223.9
+
+Event: Newcallerid
+Privilege: call,all
+Channel: Zap/52-1
+CallerIDNum: 152
+CallerIDName: <Unknown>
+Uniqueid: 1178801223.9
+CID-CallingPres: 0 (Presentation Allowed, Not Screened)
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/51-2
+State: Ringing
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801218.8
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/52-1
+State: Up
+CallerIDNum: 152
+CallerIDName: <unknown>
+Uniqueid: 1178801223.9
+
+Event: Newstate
+Privilege: call,all
+Channel: Zap/51-2
+State: Up
+CallerIDNum: 151
+CallerIDName: fxs.51
+Uniqueid: 1178801218.8
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/51-2
+Channel2: Zap/52-1
+Uniqueid1: 1178801218.8
+Uniqueid2: 1178801223.9
+CallerID1: 151
+CallerID2: 152
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Link
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/51-1
+Uniqueid1: 1178801162.7
+Uniqueid2: 1178801108.6
+CallerID1: 150
+CallerID2: 151
+
+Event: Hangup
+Privilege: call,all
+Channel: Zap/51-1
+Uniqueid: 1178801108.6
+Cause: 16
+Cause-txt: Normal Clearing
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 1
+Application: Goto
+AppData: label1
+Uniqueid: 1178801162.7
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 4
+Application: Goto
+AppData: label2
+Uniqueid: 1178801162.7
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 2
+Application: NoOp
+AppData: In Hangup! myvar is  and accountcode is  billsec is 0 and duration is 0 and end is 2007-05-10 06:48:37.
+Uniqueid: 1178801162.7
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 3
+Application: Goto
+AppData: label3
+Uniqueid: 1178801162.7
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 5
+Application: NoOp
+AppData: More Hangup message after hopping around"
+Uniqueid: 1178801162.7
+
+Event: Masquerade
+Privilege: call,all
+Clone: Zap/50-1
+CloneState: Up
+Original: Zap/51-2
+OriginalState: Up
+
+Event: Rename
+Privilege: call,all
+Oldname: Zap/50-1
+Newname: Zap/50-1<MASQ>
+Uniqueid: 1178801162.7
+
+Event: Rename
+Privilege: call,all
+Oldname: Zap/51-2
+Newname: Zap/50-1
+Uniqueid: 1178801218.8
+
+Event: Rename
+Privilege: call,all
+Oldname: Zap/50-1<MASQ>
+Newname: Zap/51-2<ZOMBIE>
+Uniqueid: 1178801162.7
+
+Event: Hangup
+Privilege: call,all
+Channel: Zap/51-2<ZOMBIE>
+Uniqueid: 1178801162.7
+Cause: 0
+Cause-txt: Unknown
+
+Event: Unlink
+Privilege: call,all
+Channel1: Zap/50-1
+Channel2: Zap/52-1
+Uniqueid1: 1178801218.8
+Uniqueid2: 1178801223.9
+CallerID1: 150
+CallerID2: 152
+
+Event: Hangup
+Privilege: call,all
+Channel: Zap/52-1
+Uniqueid: 1178801223.9
+Cause: 16
+Cause-txt: Normal Clearing
+
+Event: Dial
+Privilege: call,all
+SubEvent: End
+Channel: Zap/50-1
+DialStatus: ANSWER
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 1
+Application: Goto
+AppData: label1
+Uniqueid: 1178801218.8
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 4
+Application: Goto
+AppData: label2
+Uniqueid: 1178801218.8
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 2
+Application: NoOp
+AppData: In Hangup! myvar is  and accountcode is  billsec is 90 and duration is 94 and end is 2007-05-10 06:48:37.
+Uniqueid: 1178801218.8
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 3
+Application: Goto
+AppData: label3
+Uniqueid: 1178801218.8
+
+Event: Newexten
+Privilege: call,all
+Channel: Zap/50-1
+Context: extension
+Extension: h
+Priority: 5
+Application: NoOp
+AppData: More Hangup message after hopping around"
+Uniqueid: 1178801218.8
+
+Event: Hangup
+Privilege: call,all
+Channel: Zap/50-1
+Uniqueid: 1178801218.8
+Cause: 16
+Cause-txt: Normal Clearing
+\end{verbatim}
+
+And, humorously enough, the above 80 manager events, or 42 CEL events, correspond to the following 
+two CDR records (at the moment!):
+
+\begin{verbatim}
+""fxs.52" <152>","152","h","extension","Zap/52-1","Zap/51-1","NoOp","More Hangup message after hopping around"","2007-05-09 17:35:56","2007-05-09 17:36:20","2007-05-09 17:36:36","40","16","ANSWERED","DOCUMENTATION","","1178753756.0",""
+""fxs.50" <150>","150","152","extension","Zap/50-1","Zap/51-1","NoOp","More Hangup message after hopping around"","2007-05-09 17:37:59","2007-05-09 17:38:06","2007-05-09 17:39:11","72","65","ANSWERED","DOCUMENTATION","","1178753871.3",""
+\end{verbatim}
+
+
+\section(CEL Events and Fields)
+
+While CDR's and the Manager are basically both event tracking mechanisms, CEL tries
+to track only those events that might pertain to billing issues.
+
+Here is a list of events tracked by CEL:
+\begin{verbatim}
+       CHAN_START   -- The time a channel was created
+       CHAN_END     -- The time a channel was terminated
+       ANSWER       -- The time a channel was answered (ie, phone taken off-hook, etc)
+       HANGUP       -- The time at which a hangup occurred.
+       CONF_ENTER   -- The time a channel was connected into a conference room
+       CONF_EXIT    -- The time a channel was removed from a conference room
+       CONF_START   -- The time the first person enters a conf
+       CONF_END     -- The time the last person left a conf (and turned out the lights?)
+       APP_START    -- The time a tracked app was started
+       APP_END      -- the time a tracked app ended.
+       PARK_START   -- The time a call was parked
+       PARK_END     -- unpark event
+       BRIDGE_START -- The time a bridge is started
+       BRIDGE_END   -- The time a bridge is ended
+       3WAY_START   -- When a 3-way conf starts (usually via attended xfer)
+       3WAY_END     -- When one or all exit a 3-way conf
+       BLINDTRANSFER -- When a blind transfer is initiated
+       ATTENDEDTRANSFER -- When an attended transfer is initiated
+       TRANSFER     -- Generic transfer initiated; not used yet...?
+       HOOKFLASH    -- So far, when a hookflash event occurs on a Zap interface
+       USER_EVENT   -- these are triggered from the dialplan, and have a name given by the user.
+\end{verbatim}
+
+Each Event record contains the following fields:
+\begin{verbatim}
+       eventtype     The name of the event; see the above list; each is prefixed with "EV_".
+       eventtime     The time the event happened
+       cidname       CID name field
+       cidnum        CID num  field
+       cidani        CID ANI  field
+       cidrdnis      CID RDNIS field
+       ciddnid       CID DNID field
+       exten         The extension in the dialplan
+       context       The context in the dialplan
+       channame      The name assigned to the channel in which the event took place
+       appname       The name of the current application 
+       appdata       The arguments that will be handed to that application
+       amaflags      The AMA flags associated with the event; user assignable.
+       accountcode   A user assigned datum (string)
+       uniqueid      Each Channel instance gets a unique ID associated with it.
+       userfield     A user assigned datum (string)
+       peer          For bridge or other 2-channel events, this would be the other channel name
+\end{verbatim}
+
+
+\section(CEL Applications, Functions)
+
+\subsection{The CEL Function}
+
+The CEL function parallels the CDR function, for fetching values from the channel or event.
+It has some notable notable differences, though! For instance, CEL data is not stored on the 
+channel. Well, not much of it, anyway! You can use the CEL function to set the amaflags, accountcode,
+and userfield, which are stored on the channel.
+
+Channel variables are not available for reading from the CEL function, nor can any variable name other
+than what's in the list, be set. CDR's have a structure attached to the channel, where the CDR function
+could access the values stored there, or set the values there. CDR's could store their own variable 
+lists, but CEL has no such storage. There is no reason to store any event information, as they are
+immediately output to the various backends at the time they are generated.
+
+See the description for the CEL function from the CLI: core show function CEL
+
+Here is a list of all the available channel field names:\n"
+\begin{verbatim}
+    cidname       userfield
+    cidnum        amaflags
+    cidani        cidrdnis
+    ciddnid       appdata
+    exten         accountcode
+    context       uniqueid
+    channame      appname
+    peer          eventtime
+    eventtype
+\end{verbatim}
+
+\subsection{The CELGenUserEvent Application}
+
+This application allows the dialplan to insert custom events into the event stream.
+
+For more information, in the CLI, type:  core show application CELGenUserEvent
+
+It's arguments take this format:
+
+\begin{verbatim}
+     CELGenUserEvent(eventname)
+\end{verbatim}
+
+Please note that there is no restrictions on the name supplied. If it happens to match 
+a standard CEL event name, it will look like that event was generated. This could be 
+a blessing or a curse!
+
+
+\section(CEL config files)
+
+\section(CEL Back Ends)
+
+Right now, the CEL package will support CSV, Customized CSV, ODBC, PGSQL, TDS, Sqlite, Sqlite3, and Radius database backends.
+See the doc/celdriver.tex file for how to use these back ends.
+
+\section(Generating Billing Information)
+
+** this is the Next Big Task ***
+

Propchange: team/murf/newcdr/doc/cel-doc.tex
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/murf/newcdr/doc/cel-doc.tex
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: team/murf/newcdr/doc/cel-doc.tex
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/murf/newcdr/funcs/func_cel.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/funcs/func_cel.c?view=diff&rev=63965&r1=63964&r2=63965
==============================================================================
--- team/murf/newcdr/funcs/func_cel.c (original)
+++ team/murf/newcdr/funcs/func_cel.c Fri May 11 14:32:44 2007
@@ -132,18 +132,18 @@
 "   use of the various CEL backends. These are not readable, or modifiable except by\n"
 "     eventtime = epoch value (raw) of the time the event occurred.\n"
 "     eventtype = an ascii string representing the type of event\n"
-"     usereventname = if eventtype = USER_EVENT, then this field\n"
-"                     contains the designated name of the event\n"
 "  Here is a list of all the available channel field names:\n"
-"    cidname       appdata\n"
+"    cidname       userfield\n"
 "    cidnum        amaflags\n"
 "    cidani        cidrdnis\n"
 "    ciddnid       appdata\n"
 "    exten         accountcode\n"
 "    context       uniqueid\n"
 "    channame      appname\n"
+"    peer          eventtime\n"
+"    eventtype              \n"
 "  All of the above variables are read-only, except for accountcode,\n"
-"  and amaflags. \n"
+"  userfield, and amaflags. \n"
 "    raw values for amaflags:\n"
 "       1 = OMIT\n"
 "       2 = BILLING\n"



More information about the asterisk-commits mailing list