aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-26 15:28:53 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-26 15:28:53 +0000
commitac3b35dcc792329046ec2532ff204962c895ee98 (patch)
treea28e9113cf1daf97e45a8fc6d41a52c76ac69836 /doc
parentd13a40e1cfe5f54bfb4d1aacd2c63e7859e010bc (diff)
Merge the new Channel Event Logging (CEL) subsystem.
CEL is the new system for logging channel events. This was inspired after facing many problems trying to represent what is possible to happen to a call in Asterisk using CDR records. For more information on CEL, see the built in HTML or PDF documentation generated from the files in doc/tex/. Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard work developing this code. Also, thanks to Matt Nicholson (mnicholson) and Sean Bright (seanbright) for their assistance in the final push to get this code ready for Asterisk trunk. Review: https://reviewboard.asterisk.org/r/239/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@203638 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'doc')
-rw-r--r--doc/tex/asterisk.tex4
-rw-r--r--doc/tex/cel-doc.tex958
-rw-r--r--doc/tex/celdriver.tex447
3 files changed, 1409 insertions, 0 deletions
diff --git a/doc/tex/asterisk.tex b/doc/tex/asterisk.tex
index f3a77a52b..e9c9b3275 100644
--- a/doc/tex/asterisk.tex
+++ b/doc/tex/asterisk.tex
@@ -117,6 +117,10 @@ reference purposes.
\input{billing.tex}
\input{cdrdriver.tex}
+\chapter{CEL: Channel Event Logging}
+\input{cel-doc.tex}
+\input{celdriver.tex}
+
\chapter{Voicemail}
\section{ODBC Storage}
\label{odbcstorage}
diff --git a/doc/tex/cel-doc.tex b/doc/tex/cel-doc.tex
new file mode 100644
index 000000000..fdda68c37
--- /dev/null
+++ b/doc/tex/cel-doc.tex
@@ -0,0 +1,958 @@
+
+\section{Design Goals}
+
+CEL, or Channel Event Logging, has been 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.
+
+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:
+
+{\it Note that the actual CEL events below are in CSV format and do not include
+ the ;;; and text after that which gives a description of what the event
+ represents.}
+
+\begin{astlisting}
+"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
+
+{\it (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
+
+{\it (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
+
+{\it (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
+
+{\it (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
+
+{\it (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.
+
+{\it (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
+
+{\it (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
+
+{\it (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)
+
+{\it (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{astlisting}
+
+In terms of Manager events, the above Events correspond to the following 80
+Manager events:
+
+\begin{astlisting}
+\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}
+\end{astlisting}
+
+And, humorously enough, the above 80 manager events, or 42 CEL events,
+correspond to the following two CDR records (at the moment!):
+
+\begin{astlisting}
+""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{astlisting}
+
+
+\section{Events \& Fields}
+
+While CDRs and the Manager are basically both event tracking mechanisms, CEL
+tries to track only those events that might pertain to billing issues.
+
+See table~\ref{event_table} for a list of events raised by CEL and
+table~\ref{field_table} for the list of fields passed for each CEL event.
+
+\begin{table}[h]
+ \begin{tabular}{ | l | p{10cm} | }
+ \hline
+ Event & Description \\ \hline \hline
+ CHAN\_START & The time a channel was created \\ \hline
+ CHAN\_END & The time a channel was terminated \\ \hline
+ ANSWER & The time a channel was answered (ie, phone taken off-hook, etc) \\ \hline
+ HANGUP & The time at which a hangup occurred. \\ \hline
+ CONF\_ENTER & The time a channel was connected into a conference room \\ \hline
+ CONF\_EXIT & The time a channel was removed from a conference room \\ \hline
+ CONF\_START & The time the first person enters a conference \\ \hline
+ CONF\_END & The time the last person left a conf (and turned out the lights?) \\ \hline
+ APP\_START & The time a tracked application was started \\ \hline
+ APP\_END & the time a tracked application ended \\ \hline
+ PARK\_START & The time a call was parked \\ \hline
+ PARK\_END & unpark event \\ \hline
+ BRIDGE\_START & The time a bridge is started \\ \hline
+ BRIDGE\_END & The time a bridge is ended \\ \hline
+ 3WAY\_START & When a 3-way conf starts (usually via attended xfer) \\ \hline
+ 3WAY\_END & When one or all exit a 3-way conf \\ \hline
+ BLINDTRANSFER & When a blind transfer is initiated \\ \hline
+ ATTENDEDTRANSFER & When an attended transfer is initiated \\ \hline
+ TRANSFER & Generic transfer initiated; not used yet...? \\ \hline
+ HOOKFLASH & So far, when a hookflash event occurs on a Zap interface \\ \hline
+ USER\_EVENT & these are triggered from the dialplan, and have a name given by the user. \\
+ \hline
+ \end{tabular}
+ \caption{List of CEL Events}
+ \label{event_table}
+\end{table}
+
+\begin{table}[h]
+ \begin{tabular}{ | l | p{10cm} | }
+ \hline
+ Field & Description \\ \hline \hline
+ eventtype & The name of the event; see the above list; each is prefixed with "EV\_". \\ \hline
+ eventtime & The time the event happened \\ \hline
+ cidname & CID name field \\ \hline
+ cidnum & CID number field \\ \hline
+ cidani & CID ANI field \\ \hline
+ cidrdnis & CID RDNIS field \\ \hline
+ ciddnid & CID DNID field \\ \hline
+ exten & The extension in the dialplan \\ \hline
+ context & The context in the dialplan \\ \hline
+ channame & The name assigned to the channel in which the event took place \\ \hline
+ appname & The name of the current application \\ \hline
+ appdata & The arguments that will be handed to that application \\ \hline
+ amaflags & The AMA flags associated with the event; user assignable. \\ \hline
+ accountcode & A user assigned datum (string) \\ \hline
+ uniqueid & Each Channel instance gets a unique ID associated with it. \\ \hline
+ userfield & A user assigned datum (string) \\ \hline
+ linkedid & the per-call id, spans several events, possibly. \\ \hline
+ peer & For bridge or other 2-channel events, this would be the other channel name \\
+ \hline
+ \end{tabular}
+ \caption{List of CEL Event Fields}
+ \label{field_table}
+\end{table}
+
+\section{Applications \& Functions}
+
+\subsection{CEL Function}
+
+**** THIS IS NO LONGER TRUE. REWRITE. ****
+
+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. CDRs have a structure
+attached to the channel, where the CDR function could access the values stored
+there, or set the values there. CDRs 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:
+\begin{verbatim}
+ cidname userfield
+ cidnum amaflags
+ cidani cidrdnis
+ ciddnid appdata
+ exten accountcode
+ context uniqueid
+ channame appname
+ peer eventtime
+ eventtype
+\end{verbatim}
+
+\subsection{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
+
+Its 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{Configuration Files}
+
+\begin{itemize}
+\item cel.conf
+\end{itemize}
+
+\section{Generating Billing Information}
+
+*** This is the Next Big Task ***
+
+
diff --git a/doc/tex/celdriver.tex b/doc/tex/celdriver.tex
new file mode 100644
index 000000000..19224d674
--- /dev/null
+++ b/doc/tex/celdriver.tex
@@ -0,0 +1,447 @@
+\section{Storage Backends}
+
+Right now, the CEL package will support CSV, Customized CSV, ODBC, PGSQL, TDS,
+Sqlite3, and Radius back ends. See the doc/celdriver.tex file
+for how to use these back ends.
+
+\subsection{Microsoft SQL Server}
+
+ Asterisk can currently store Channel Events into an MSSQL database in
+ two different ways: cel\_odbc or cel\_tds
+
+ Channel Event Records can be stored using unixODBC (which requires
+ the FreeTDS package) [cel\_odbc] or directly by using just the
+ FreeTDS package [cel\_tds] The following provide some
+ examples known to get asterisk working with mssql.
+
+ NOTE: Only choose one db connector.
+
+\subsubsection{ODBC using cel\_odbc}
+ Compile, configure, and install the latest unixODBC package:
+\begin{verbatim}
+ tar -zxvf unixODBC-2.2.9.tar.gz &&
+ cd unixODBC-2.2.9 &&
+ ./configure --sysconfdir=/etc --prefix=/usr --disable-gui &&
+ make &&
+ make install
+\end{verbatim}
+
+ Compile, configure, and install the latest FreeTDS package:
+\begin{verbatim}
+ tar -zxvf freetds-0.62.4.tar.gz &&
+ cd freetds-0.62.4 &&
+ ./configure --prefix=/usr --with-tdsver=7.0 \
+ --with-unixodbc=/usr/lib &&
+ make && make install
+\end{verbatim}
+
+ Compile, or recompile, asterisk so that it will now add support
+ for cel\_odbc.
+\begin{verbatim}
+ make clean && ./configure --with-odbc &&
+ make update &&
+ make &&
+ make install
+\end{verbatim}
+
+ Setup odbc configuration files. These are working examples
+ from my system. You will need to modify for your setup.
+ You are not required to store usernames or passwords here.
+
+\begin{verbatim}
+ /etc/odbcinst.ini
+ [FreeTDS]
+ Description = FreeTDS ODBC driver for MSSQL
+ Driver = /usr/lib/libtdsodbc.so
+ Setup = /usr/lib/libtdsS.so
+ FileUsage = 1
+
+ /etc/odbc.ini
+ [MSSQL-asterisk]
+ description = Asterisk ODBC for MSSQL
+ driver = FreeTDS
+ server = 192.168.1.25
+ port = 1433
+ database = voipdb
+ tds_version = 7.0
+ language = us_english
+\end{verbatim}
+
+ Only install one database connector. Do not confuse asterisk
+ by using both ODBC (cel\_odbc) and FreeTDS (cel\_tds).
+ This command will erase the contents of cel\_tds.conf
+\begin{verbatim}
+ [ -f /etc/asterisk/cel_tds.conf ] > /etc/asterisk/cel_tds.conf
+\end{verbatim}
+ NOTE: unixODBC requires the freeTDS package, but asterisk does
+ not call freeTDS directly.
+
+ Now set up cel\_odbc configuration files. These are working samples
+ from my system. You will need to modify for your setup. Define
+ your usernames and passwords here, secure file as well.
+\begin{verbatim}
+ /etc/asterisk/cel_odbc.conf
+ [global]
+ dsn=MSSQL-asterisk
+ username=voipdbuser
+ password=voipdbpass
+ loguniqueid=yes
+\end{verbatim}
+ And finally, create the 'cel' table in your mssql database.
+\begin{verbatim}
+ CREATE TABLE cel (
+ [eventtype] [varchar] (30) NOT NULL ,
+ [eventtime] [datetime] NOT NULL ,
+ [cidname] [varchar] (80) NOT NULL ,
+ [cidnum] [varchar] (80) NOT NULL ,
+ [cidani] [varchar] (80) NOT NULL ,
+ [cidrdnis] [varchar] (80) NOT NULL ,
+ [ciddnid] [varchar] (80) NOT NULL ,
+ [exten] [varchar] (80) NOT NULL ,
+ [context] [varchar] (80) NOT NULL ,
+ [channame] [varchar] (80) NOT NULL ,
+ [appname] [varchar] (80) NOT NULL ,
+ [appdata] [varchar] (80) NOT NULL ,
+ [amaflags] [int] NOT NULL ,
+ [accountcode] [varchar] (20) NOT NULL ,
+ [uniqueid] [varchar] (32) NOT NULL ,
+ [peer] [varchar] (80) NOT NULL ,
+ [userfield] [varchar] (255) NOT NULL
+ )
+\end{verbatim}
+ Start asterisk in verbose mode, you should see that asterisk
+ logs a connection to the database and will now record every
+ desired channel event at the moment it occurs.
+
+\subsubsection{FreeTDS, using cel\_tds}
+ Compile, configure, and install the latest FreeTDS package:
+\begin{verbatim}
+ tar -zxvf freetds-0.62.4.tar.gz &&
+ cd freetds-0.62.4 &&
+ ./configure --prefix=/usr --with-tdsver=7.0
+ make &&
+ make install
+\end{verbatim}
+ Compile, or recompile, asterisk so that it will now add support
+ for cel\_tds.
+\begin{verbatim}
+ make clean && ./configure --with-tds &&
+ make update &&
+ make &&
+ make install
+\end{verbatim}
+ Only install one database connector. Do not confuse asterisk
+ by using both ODBC (cel\_odbc) and FreeTDS (cel\_tds).
+ This command will erase the contents of cel\_odbc.conf
+\begin{verbatim}
+ [ -f /etc/asterisk/cel_odbc.conf ] > /etc/asterisk/cel_odbc.conf
+\end{verbatim}
+ Setup cel\_tds configuration files. These are working samples
+ from my system. You will need to modify for your setup. Define
+ your usernames and passwords here, secure file as well.
+\begin{verbatim}
+ /etc/asterisk/cel_tds.conf
+ [global]
+ hostname=192.168.1.25
+ port=1433
+ dbname=voipdb
+ user=voipdbuser
+ password=voipdpass
+ charset=BIG5
+\end{verbatim}
+ And finally, create the 'cel' table in your mssql database.
+\begin{verbatim}
+ CREATE TABLE cel (
+ [eventtype] [varchar] (30) NULL ,
+ [eventtime] [datetime] NULL ,
+ [cidname] [varchar] (80) NULL ,
+ [cidnum] [varchar] (80) NULL ,
+ [cidani] [varchar] (80) NULL ,
+ [cidrdnis] [varchar] (80) NULL ,
+ [ciddnid] [varchar] (80) NULL ,
+ [exten] [varchar] (80) NULL ,
+ [context] [varchar] (80) NULL ,
+ [channame] [varchar] (80) NULL ,
+ [appname] [varchar] (80) NULL ,
+ [appdata] [varchar] (80) NULL ,
+ [amaflags] [varchar] (16) NULL ,
+ [accountcode] [varchar] (20) NULL ,
+ [uniqueid] [varchar] (32) NULL ,
+ [userfield] [varchar] (255) NULL ,
+ [peer] [varchar] (80) NULL
+ )
+\end{verbatim}
+ Start asterisk in verbose mode, you should see that asterisk
+ logs a connection to the database and will now record every
+ call to the database when it's complete.
+
+
+\subsection{MySQL}
+
+Using MySQL for Channel Event records is supported by using ODBC and the cel\_odbc module.
+
+\subsection{PostreSQL}
+ If you want to go directly to postgresql database, and have the cel\_pgsql.so
+ compiled you can use the following sample setup.
+ On Debian, before compiling asterisk, just install libpqxx-dev.
+ Other distros will likely have a similiar package.
+
+ Once you have the compile done,
+ copy the sample cel\_pgsql.conf file or create your own.
+
+ Here is a sample:
+\begin{verbatim}
+ /etc/asterisk/cel_pgsql.conf
+ ; Sample Asterisk config file for CEL logging to PostgresSQL
+ [global]
+ hostname=localhost
+ port=5432
+ dbname=asterisk
+ password=password
+ user=postgres
+ table=cel
+\end{verbatim}
+ Now create a table in postgresql for your cels
+
+\begin{verbatim}
+ CREATE TABLE cel (
+ eventtype varchar (30) NOT NULL ,
+ eventtime time NOT NULL ,
+ cidname varchar (80) NOT NULL ,
+ cidnum varchar (80) NOT NULL ,
+ cidani varchar (80) NOT NULL ,
+ cidrdnis varchar (80) NOT NULL ,
+ ciddnis varchar (80) NOT NULL ,
+ exten varchar (80) NOT NULL ,
+ context varchar (80) NOT NULL ,
+ channame varchar (80) NOT NULL ,
+ appname varchar (80) NOT NULL ,
+ appdata varchar (80) NOT NULL ,
+ amaflags int NOT NULL ,
+ accountcode varchar (20) NOT NULL ,
+ uniqueid varchar (32) NOT NULL ,
+ userfield varchar (255) NOT NULL ,
+ peer varchar (80) NOT NULL
+ );
+\end{verbatim}
+
+\subsection{SQLite 3}
+
+SQLite version 3 is supported in cel\_sqlite3\_custom.
+
+\subsection{RADIUS}
+
+\subsubsection{What is needed}
+
+\begin{itemize}
+ \item FreeRADIUS server
+ \item Radiusclient-ng library
+ \item Asterisk PBX
+\end{itemize}
+
+\begin{figure}[h]
+\begin{center}
+\setlength{\unitlength}{4cm}
+\begin{picture}(3,.75)
+\put(0,0){\line(0,1){.75}}
+\put(0,.75){\line(1,0){1.5}}
+\put(1.5,0){\line(0,1){.75}}
+\put(0,0){\line(1,0){1.5}}
+\put(.1,.4){\makebox(1.3,.3){Asterisk PBX}}
+\put(.1,.4){\line(1,0){1.3}}
+\put(.1,.1){\line(1,0){1.3}}
+\put(.1,.1){\line(0,1){.3}}
+\put(1.4,.1){\line(0,1){.3}}
+\put(.1,.1){\makebox(1.3,.3){RADIUS Client}}
+\put(1.8,0){\line(0,1){.5}}
+\put(1.8,.5){\line(1,0){1.1}}
+\put(1.8,0){\line(1,0){1.1}}
+\put(2.9,0){\line(0,1){.5}}
+\put(1.8,.275){\makebox(1.1,.1){RADIUS Server}}
+\put(1.8,.125){\makebox(1.1,.1){$(FreeRADIUS)$}}
+\thicklines
+\put(1.4,.3){\vector(1,0){.4}}
+\put(1.8,.2){\vector(-1,0){.4}}
+\thinlines
+\end{picture}
+\end{center}
+\caption{Asterisk/RADIUS Integration}
+\end{figure}
+
+\subsubsection{Installation of the Radiusclient library}
+ Installation:
+\begin{verbatim}
+ Download the sources from:
+
+ http://developer.berlios.de/projects/radiusclient-ng/
+
+ Untar the source tarball.
+ root@localhost:/usr/local/src# tar xvfz radiusclient-ng-0.5.5.1.tar.gz
+
+ Compile and install the library.
+ root@localhost:/usr/local/src# cd radiusclient-ng-0.5.5.1
+ root@localhost:/usr/local/src/radiusclient-ng-0.5.5.1# ./configure
+ root@localhost:/usr/local/src/radiusclient-ng-0.5.5.1# make
+ root@localhost:/usr/local/src/radiusclient-ng-0.5.5.1# make install
+\end{verbatim}
+
+\subsubsection{Configuration of the Radiusclient library}
+
+ By default all the configuration files of the radiusclient library will
+ be in /usr/local/etc/radiusclient-ng directory.
+
+ File "radiusclient.conf"
+ Open the file and find lines containing the following:
+
+ authserver localhost
+
+ This is the hostname or IP address of the RADIUS server used for
+ authentication. You will have to change this unless the server is
+ running on the same host as your Asterisk PBX.
+
+ acctserver localhost
+ This is the hostname or IP address of the RADIUS server used for
+ accounting. You will have to change this unless the server is running
+ on the same host as your Asterisk PBX.
+
+ File "servers"
+
+ RADIUS protocol uses simple access control mechanism based on shared
+ secrets that allows RADIUS servers to limit access from RADIUS clients.
+
+ A RADIUS server is configured with a secret string and only RADIUS
+ clients that have the same secret will be accepted.
+
+ You need to configure a shared secret for each server you have
+ configured in radiusclient.conf file in the previous step. The shared
+ secrets are stored in /usr/local/etc/radiusclient-ng/servers file.
+
+ Each line contains hostname of a RADIUS server and shared secret
+ used in communication with that server. The two values are separated
+ by white spaces. Configure shared secrets for every RADIUS server you
+ are going to use.
+
+ File "dictionary"
+
+ Asterisk uses some attributes that are not included in the
+ dictionary of radiusclient library, therefore it is necessary to add
+ them. A file called dictionary.digium (kept in the contrib dir)
+ was created to list all new attributes used by Asterisk.
+ Add to the end of the main dictionary file
+ /usr/local/etc/radiusclient-ng/dictionary
+ the line:
+\begin{verbatim}
+ \$INCLUDE /path/to/dictionary.digium
+\end{verbatim}
+
+\subsubsection{Install FreeRADIUS Server (Version 1.1.1)}
+
+ Download sources tarball from:
+
+ http://freeradius.org/
+
+ Untar, configure, build, and install the server:
+
+\begin{verbatim}
+ root@localhost:/usr/local/src# tar xvfz freeradius-1.1.1.tar.gz
+ root@localhost:/usr/local/src# cd freeradius-1.1.1
+ root@localhost"/usr/local/src/freeradius-1.1.1# ./configure
+ root@localhost"/usr/local/src/freeradius-1.1.1# make
+ root@localhost"/usr/local/src/freeradius-1.1.1# make install
+\end{verbatim}
+
+ All the configuration files of FreeRADIUS server will be in
+ /usr/local/etc/raddb directory.
+
+
+\subsubsection{Configuration of the FreeRADIUS Server}
+
+ There are several files that have to be modified to configure the
+ RADIUS server. These are presented next.
+
+ File "clients.conf"
+
+ File /usr/local/etc/raddb/clients.conf contains description of
+ RADIUS clients that are allowed to use the server. For each of the
+ clients you need to specify its hostname or IP address and also a
+ shared secret. The shared secret must be the same string you configured
+ in radiusclient library.
+
+ Example:
+\begin{verbatim}
+ client myhost {
+ secret = mysecret
+ shortname = foo
+ }
+\end{verbatim}
+
+ This fragment allows access from RADIUS clients on "myhost" if they use
+ "mysecret" as the shared secret.
+ The file already contains an entry for localhost (127.0.0.1), so if you
+ are running the RADIUS server on the same host as your Asterisk server,
+ then modify the existing entry instead, replacing the default password.
+
+ File "dictionary"
+
+ Note : as of version 1.1.2, the dictionary.digium file ships with FreeRADIUS.
+ The following procedure brings the dictionary.digium file to previous versions
+ of FreeRADIUS.
+
+ File /usr/local/etc/raddb/dictionary contains the dictionary of
+ FreeRADIUS server. You have to add the same dictionary file
+ (dictionary.digium), which you added to the dictionary of radiusclient-ng
+ library. You can include it into the main file, adding the following line at the
+ end of file '/usr/local/etc/raddb/dictionary':
+
+ \$INCLUDE /path/to/dictionary.digium
+
+ That will include the same new attribute definitions that are used
+ in radiusclient-ng library so the client and server will understand each
+ other.
+
+
+\subsubsection{Asterisk Accounting Configuration}
+
+ Compilation and installation:
+
+ The module will be compiled as long as the radiusclient-ng
+ library has been detected on your system.
+
+ By default FreeRADIUS server will log all accounting requests into
+ /usr/local/var/log/radius/radacct directory in form of plain text files.
+ The server will create one file for each hostname in the directory. The
+ following example shows how the log files look like.
+
+ Asterisk now generates Call Detail Records. See /include/asterisk/cel.h
+ for all the fields which are recorded. By default, records in comma
+ separated values will be created in /var/log/asterisk/cel-csv.
+
+ The configuration file for cel\_radius.so module is :
+
+ /etc/asterisk/cel.conf
+ This is where you can set CEL related parameters as well as the path to
+ the radiusclient-ng library configuration file.
+
+
+\subsubsection{Logged Values}
+\begin{verbatim}
+ "Asterisk-Acc-Code", The account name of detail records
+ "Asterisk-CidName",
+ "Asterisk-CidNum",
+ "Asterisk-Cidani",
+ "Asterisk-Cidrdnis",
+ "Asterisk-Ciddnid",
+ "Asterisk-Exten",
+ "Asterisk-Context", The destination context
+ "Asterisk-Channame", The channel name
+ "Asterisk-Appname", Last application run on the channel
+ "Asterisk-App-Data", Argument to the last channel
+ "Asterisk-Event-Time",
+ "Asterisk-Event-Type",
+ "Asterisk-AMA-Flags", DOCUMENTATION, BILL, IGNORE etc, specified on
+ a per channel basis like accountcode.
+ "Asterisk-Unique-ID", Unique call identifier
+ "Asterisk-User-Field" User field set via SetCELUserField
+ "Asterisk-Peer" Name of the Peer for 2-channel events (like bridge)
+
+\end{verbatim}