[asterisk-commits] mjordan: branch mjordan/cdrs-of-doom r388726 - in /team/mjordan/cdrs-of-doom:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 14 15:42:46 CDT 2013


Author: mjordan
Date: Tue May 14 15:42:43 2013
New Revision: 388726

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388726
Log:
Restore cdrs-of-doom from local copy

This time, hopefully, without all the shenanigans

Added:
    team/mjordan/cdrs-of-doom/   (props changed)
      - copied from r388694, team/group/bridge_construction/
Modified:
    team/mjordan/cdrs-of-doom/CHANGES
    team/mjordan/cdrs-of-doom/UPGRADE.txt
    team/mjordan/cdrs-of-doom/addons/cdr_mysql.c
    team/mjordan/cdrs-of-doom/addons/chan_ooh323.c
    team/mjordan/cdrs-of-doom/apps/app_authenticate.c
    team/mjordan/cdrs-of-doom/apps/app_cdr.c
    team/mjordan/cdrs-of-doom/apps/app_dial.c
    team/mjordan/cdrs-of-doom/apps/app_disa.c
    team/mjordan/cdrs-of-doom/apps/app_dumpchan.c
    team/mjordan/cdrs-of-doom/apps/app_followme.c
    team/mjordan/cdrs-of-doom/apps/app_forkcdr.c
    team/mjordan/cdrs-of-doom/apps/app_osplookup.c
    team/mjordan/cdrs-of-doom/apps/app_queue.c
    team/mjordan/cdrs-of-doom/bridges/bridge_softmix.c
    team/mjordan/cdrs-of-doom/cdr/cdr_adaptive_odbc.c
    team/mjordan/cdrs-of-doom/cdr/cdr_csv.c
    team/mjordan/cdrs-of-doom/cdr/cdr_custom.c
    team/mjordan/cdrs-of-doom/cdr/cdr_manager.c
    team/mjordan/cdrs-of-doom/cdr/cdr_odbc.c
    team/mjordan/cdrs-of-doom/cdr/cdr_pgsql.c
    team/mjordan/cdrs-of-doom/cdr/cdr_radius.c
    team/mjordan/cdrs-of-doom/cdr/cdr_syslog.c
    team/mjordan/cdrs-of-doom/cdr/cdr_tds.c
    team/mjordan/cdrs-of-doom/cel/cel_manager.c
    team/mjordan/cdrs-of-doom/cel/cel_radius.c
    team/mjordan/cdrs-of-doom/cel/cel_tds.c
    team/mjordan/cdrs-of-doom/channels/chan_agent.c
    team/mjordan/cdrs-of-doom/channels/chan_dahdi.c
    team/mjordan/cdrs-of-doom/channels/chan_h323.c
    team/mjordan/cdrs-of-doom/channels/chan_iax2.c
    team/mjordan/cdrs-of-doom/channels/chan_mgcp.c
    team/mjordan/cdrs-of-doom/channels/chan_sip.c
    team/mjordan/cdrs-of-doom/channels/chan_skinny.c
    team/mjordan/cdrs-of-doom/channels/chan_unistim.c
    team/mjordan/cdrs-of-doom/funcs/func_callerid.c
    team/mjordan/cdrs-of-doom/funcs/func_cdr.c
    team/mjordan/cdrs-of-doom/funcs/func_channel.c
    team/mjordan/cdrs-of-doom/include/asterisk/cdr.h
    team/mjordan/cdrs-of-doom/include/asterisk/cel.h
    team/mjordan/cdrs-of-doom/include/asterisk/channel.h
    team/mjordan/cdrs-of-doom/include/asterisk/config_options.h
    team/mjordan/cdrs-of-doom/include/asterisk/stasis_channels.h
    team/mjordan/cdrs-of-doom/include/asterisk/strings.h
    team/mjordan/cdrs-of-doom/include/asterisk/test.h
    team/mjordan/cdrs-of-doom/include/asterisk/time.h
    team/mjordan/cdrs-of-doom/main/asterisk.c
    team/mjordan/cdrs-of-doom/main/bridging.c
    team/mjordan/cdrs-of-doom/main/cdr.c
    team/mjordan/cdrs-of-doom/main/cel.c
    team/mjordan/cdrs-of-doom/main/channel.c
    team/mjordan/cdrs-of-doom/main/channel_internal_api.c
    team/mjordan/cdrs-of-doom/main/cli.c
    team/mjordan/cdrs-of-doom/main/config_options.c
    team/mjordan/cdrs-of-doom/main/features.c
    team/mjordan/cdrs-of-doom/main/manager.c
    team/mjordan/cdrs-of-doom/main/manager_channels.c
    team/mjordan/cdrs-of-doom/main/pbx.c
    team/mjordan/cdrs-of-doom/main/stasis_channels.c
    team/mjordan/cdrs-of-doom/main/test.c
    team/mjordan/cdrs-of-doom/main/utils.c
    team/mjordan/cdrs-of-doom/res/res_agi.c
    team/mjordan/cdrs-of-doom/res/res_config_sqlite.c
    team/mjordan/cdrs-of-doom/res/res_monitor.c
    team/mjordan/cdrs-of-doom/res/res_stasis.c

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
    automerge-email = rmudgett at digium.com

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
    automerge-propname = bridge_construction-integrated

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
--- branch-10-digiumphones-merged (added)
+++ branch-10-digiumphones-merged Tue May 14 15:42:43 2013
@@ -1,0 +1,1 @@
+/branches/10-digiumphones:364766,365396,368791,368963-368965,368999,369026

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
    branch-11-blocked = /branches/11:373240,375247,375702,385356

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
    bridge_construction-integrated = /trunk:1-388669

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
    certified-branch-1.8.11-merged = /certified/branches/1.8.11:364761,365395

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
--- reviewboard:url (added)
+++ reviewboard:url Tue May 14 15:42:43 2013
@@ -1,0 +1,1 @@
+https://reviewboard.asterisk.org

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
--- svn:externals (added)
+++ svn:externals Tue May 14 15:42:43 2013
@@ -1,0 +1,1 @@
+menuselect https://origsvn.digium.com/svn/menuselect/trunk

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 14 15:42:43 2013
@@ -1,0 +1,20 @@
+.applied
+.cleancount
+.depend
+.lastclean
+.tags-depend
+.tags-sources
+.version
+TAGS
+aclocal.m4
+autom4te.cache
+config.cache
+config.log
+config.status
+defaults.h
+makeopts
+makeopts.embed_rules
+menuselect-tree
+menuselect.makedeps
+menuselect.makeopts
+tags

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue May 14 15:42:43 2013
@@ -1,0 +1,1 @@
+/team/jrose/bridge_projects:380850,380966-380967,381253,381279,381343,381363,381468,381504

Modified: team/mjordan/cdrs-of-doom/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/CHANGES?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/CHANGES (original)
+++ team/mjordan/cdrs-of-doom/CHANGES Tue May 14 15:42:43 2013
@@ -11,6 +11,94 @@
 --- Functionality changes from Asterisk 11 to Asterisk 12 --------------------
 ------------------------------------------------------------------------------
 
+Applications
+------------------
+
+AgentMonitorOutgoing
+------------------
+ * The 'c' option has been removed. It is not possible to modify the name of a
+   channel involved in a CDR.
+
+ForkCDR
+------------------
+ * ForkCDR no longer automatically resets the forked CDR. See the 'r' option
+   for more information.
+
+ * Variables are no longer purged from the original CDR. See the 'v' option for
+   more information.
+
+ * The 'A' option has been removed. The Answer time on a CDR is never updated
+   once set.
+
+ * The 'd' option has been removed. The disposition on a CDR is a function of
+   the state of the channel and cannot be altered.
+
+ * The 'D' option has been removed. Who the Party B is on a CDR is a function
+   of the state of the respective channels, and cannot be altered.
+
+ * The 'r' option has been changed. Previously, ForkCDR always reset the CDR
+   such that the start time and, if applicable, the answer time was updated.
+   Now, by default, ForkCDR simply forks the CDR, maintaining any times. The
+   'r' option now triggers the Reset, setting the start time (and answer time
+   if applicable) to the current time.
+
+ * The 's' option has been removed. A variable can be set on the original CDR
+   if desired using the CDR function, and removed from a forked CDR using the
+   same function.
+
+ * The 'T' option has been removed. The concept of DONT_TOUCH and LOCKED no
+   longer applies in the CDR engine.
+
+ * The 'v' option now prevents the copy of the variables from the original CDR
+   to the forked CDR. Previously the variables were always copied but were
+   removed from the original. Removing variables from a CDR can have unintended
+   side effects - this option allows the user to prevent propagation of
+   variables from the original to the forked without modifying the original.
+
+MeetMe
+-------------------
+* Added the 'n' option to MeetMe to prevent application of the DENOISE function
+  to a channel joining a conference. Some channel drivers that vary the number
+  of audio samples in a voice frame will experience significant quality problems
+  if a denoiser is attached to the channel; this option gives them the ability
+  to remove the denoiser without having to unload func_speex.
+
+NoCDR
+------------------
+ * The NoCDR application is deprecated. Please use the CDR_PROP function to
+   disable CDRs.
+ * While the NoCDR application will prevent CDRs for a channel from being
+   propagated to registered CDR backends, it will not prevent that data from
+   being collected. Hence, a subsequent call to ResetCDR or the CDR_PROP
+   function that enables CDRs on a channel will restore those records that have
+   not yet been finalized.
+
+Queue
+-------------------
+ * Add queue available hint.  exten => 8501,hint,Queue:markq_avail
+   Note: the suffix '_avail' after the queuename.
+   Reports 'InUse' for no logged in agents or no free agents.
+   Reports 'Idle' when an agent is free.
+
+ResetCDR
+------------------
+ * The 'e' option has been deprecated. Use the CDR_PROP function to re-enable
+   CDRs when they were previously disabled on a channel.
+ * The 'w' and 'a' options have been removed. Dispatching CDRs to registered
+   backends occurs on an as-needed basis in order to preserve linkedid
+   propagation and other needed behavior.
+
+SetAMAFlags
+------------------
+ * This application is deprecated in favor of the CHANNEL function.
+
+
+Core
+------------------
+ * Redirecting reasons can now be set to arbitrary strings. This means
+   that the REDIRECTING dialplan function can be used to set the redirecting
+   reason to any string. It also allows for custom strings to be read as the
+   redirecting reason from SIP Diversion headers.
 
 AMI (Asterisk Manager Interface)
 ------------------
@@ -72,6 +160,27 @@
    event, the various ChanVariable fields will contain a suffix that specifies
    which channel they correspond to.
 
+* The NewPeerAccount AMI event is no longer raised. The NewAccountCode AMI
+  event always conveys the AMI event for a particular channel.
+
+
+CDR
+------------------
+ * Significant changes have been made to the behavior of CDRs. For a full
+   definition of CDR behavior in Asterisk 12, please read the specification
+   on the Asterisk wiki (wiki.asterisk.org).
+
+ * CDRs will now be created between all participants in a bridge. For each
+   pair of channels in a bridge, a CDR is created to represent the path of
+   communication between those two endpoints. This lets an end user choose who
+   to bill for what during multi-party bridges or bridge operations during
+   transfer scenarios.
+
+ * When a CDR is dispatched, user defined CDR variables from both parties are
+   included in the resulting CDR. If both parties have the same variable, only
+   the Party A value is provided.
+
+
 Channel Drivers
 ------------------
  * When a channel driver is configured to enable jiterbuffers, they are now
@@ -117,12 +226,6 @@
    and FEATUREMAP() functions inherited to child channels by setting
    FEATURE(inherit)=yes.
 
-Functions
-------------------
- * JITTERBUFFER now accepts an argument of 'disabled' which can be used
-   to remove jitterbuffers previously set on a channel with JITTERBUFFER.
-   The value of this setting is ignored when disabled is used for the argument.
-
 Logging
 -------------------
  * When performing queue pause/unpause on an interface without specifying an
@@ -199,6 +302,85 @@
 
  * LDAP realtime configurations for SIP Users now have the AstAccountPathSupport
    objectIdentifier. This maps to the supportpath option in sip.conf. 
+
+Sorcery
+------------------
+ * All future modules which utilize Sorcery for object persistence must have a
+   column named "id" within their schema when using the Sorcery realtime module.
+   This column must be able to contain a string of up to 128 characters in length.
+
+
+Channel Drivers
+------------------
+ * When a channel driver is configured to enable jiterbuffers, they are now
+   applied unconditionally when a channel joins a bridge. If a jitterbuffer
+   is already set for that channel when it enters, such as by the JITTERBUFFER
+   function, then the existing jitterbuffer will be used and the one set by
+   the channel driver will not be applied.
+
+chan_agent
+------------------
+ * The updatecdr option has been removed. Altering the names of channels on a
+   CDR is not supported - the name of the channel is the name of the channel,
+   and pretending otherwise helps no one.
+ * The AGENTUPDATECDR channel variable has also been removed, for the same
+   reason as the updatecdr option.
+
+chan_local
+------------------
+ * The /b option has been removed.
+
+chan_mobile
+------------------
+ * Added general support for busy detection.
+
+ * Added ECAM command support for Sony Ericsson phones.
+
+chan_sip
+------------------
+ * Added support for RFC 3327 "Path" headers. This can be enabled in sip.conf
+   using the 'supportpath' setting, either on a global basis or on a peer basis.
+   This setting enables Asterisk to route outgoing out-of-dialog requests via a
+   set of proxies by using a pre-loaded route-set defined by the Path headers in
+   the REGISTER request. See Realtime updates for more configuration information.
+
+
+Functions
+------------------
+
+JITTERBUFFER
+------------------
+ * JITTERBUFFER now accepts an argument of 'disabled' which can be used
+   to remove jitterbuffers previously set on a channel with JITTERBUFFER.
+   The value of this setting is ignored when disabled is used for the argument.
+
+CDR
+------------------
+ * The 'amaflags' and 'accountcode' attributes for the CDR function are
+   deprecated. Use the CHANNEL function instead to access these attributes.
+ * The 'l' option has been removed. When reading a CDR attribute, the most
+   recent record is always used. When writing a CDR attribute, all non-finalized
+   CDRs are updated.
+ * The 'r' option has been removed, for the same reason as the 'l' option.
+ * The 's' option has been removed, as LOCKED semantics no longer exist in the
+   CDR engine.
+
+CDR_PROP
+------------------
+ * A new function CDR_PROP has been added. This function lets you set properties
+   on a channel's active CDRs. This function is write-only. Properties accept
+   boolean values to set/clear them on the channel's CDRs. Valid properties
+   include:
+   * 'party_a' - make this channel the preferred Party A in any CDR between two
+     channels. If two channels have this property set, the creation time of the
+     channel is used to determine who is Party A. Note that dialed channels are
+     never Party A in a CDR.
+   * 'disable' - disable CDRs on this channel. This is analogous to the NoCDR
+     application when set to True, and analogous to the 'e' option in ResetCDR
+     when set to False.
+
+Resources
+------------------
 
 RTP
 ------------------

Modified: team/mjordan/cdrs-of-doom/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/UPGRADE.txt?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/UPGRADE.txt (original)
+++ team/mjordan/cdrs-of-doom/UPGRADE.txt Tue May 14 15:42:43 2013
@@ -21,6 +21,48 @@
 ===
 ===========================================================
 
+AgentMonitorOutgoing
+ - The 'c' option has been removed. It is not possible to modify the name of a
+   channel involved in a CDR.
+
+NoCDR:
+ - This application is deprecated. Please use the CDR_PROP function instead.
+
+ResetCDR:
+ - The 'w' and 'a' options have been removed. Dispatching CDRs to registered
+   backends occurs on an as-needed basis in order to preserve linkedid
+   propagation and other needed behavior.
+ - The 'e' option is deprecated. Please use the CDR_PROP function to enable
+   CDRs on a channel that they were previously disabled on.
+ - The ResetCDR application is no longer a part of core Asterisk, and instead
+   is now delivered as part of app_cdr.
+
+ForkCDR:
+ - ForkCDR no longer automatically resets the forked CDR. See the 'r' option
+   for more information.
+ - Variables are no longer purged from the original CDR. See the 'v' option for
+   more information.
+ - The 'A' option has been removed. The Answer time on a CDR is never updated
+   once set.
+ - The 'd' option has been removed. The disposition on a CDR is a function of
+   the state of the channel and cannot be altered.
+ - The 'D' option has been removed. Who the Party B is on a CDR is a function
+   of the state of the respective channels, and cannot be altered.
+ - The 'r' option has been changed. Previously, ForkCDR always reset the CDR
+   such that the start time and, if applicable, the answer time was updated.
+   Now, by default, ForkCDR simply forks the CDR, maintaining any times. The
+   'r' option now triggers the Reset, setting the start time (and answer time
+   if applicable) to the current time.
+ - The 's' option has been removed. A variable can be set on the original CDR
+   if desired using the CDR function, and removed from a forked CDR using the
+   same function.
+ - The 'T' option has been removed. The concept of DONT_TOUCH and LOCKED no
+   longer applies in the CDR engine.
+ - The 'v' option now prevents the copy of the variables from the original CDR
+   to the forked CDR. Previously the variables were always copied but were
+   removed from the original. Removing variables from a CDR can have unintended
+   side effects - this option allows the user to prevent propagation of
+   variables from the original to the forked without modifying the original.
 
 AMI:
  - The SIP SIPqualifypeer action now sends a response indicating it will qualify
@@ -63,6 +105,16 @@
  - Now recognizes 'W' to pause sending DTMF for one second in addition to
    the previously existing 'w' that paused sending DTMF for half a second.
 
+SetAMAFlags
+ - This application is deprecated in favor of the CHANNEL function.
+
+chan_agent:
+ - The updatecdr option has been removed. Altering the names of channels on a
+   CDR is not supported - the name of the channel is the name of the channel,
+   and pretending otherwise helps no one.
+ - The AGENTUPDATECDR channel variable has also been removed, for the same
+   reason as the updatecdr option.
+
 chan_dahdi:
  - Analog port dialing and deferred DTMF dialing for PRI now distinguishes
    between 'w' and 'W'.  The 'w' pauses dialing for half a second.  The 'W'
@@ -70,7 +122,7 @@
  - The default for inband_on_proceeding has changed to no.
 
 chan_local:
- - The /b option is removed.
+ - The /b option has been removed.
 
 Dialplan:
  - All channel and global variable names are evaluated in a case-sensitive manner.

Modified: team/mjordan/cdrs-of-doom/addons/cdr_mysql.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/addons/cdr_mysql.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/addons/cdr_mysql.c (original)
+++ team/mjordan/cdrs-of-doom/addons/cdr_mysql.c Tue May 14 15:42:43 2013
@@ -251,7 +251,7 @@
 					char timestr[128];
 					ast_localtime(&tv, &tm, ast_str_strlen(cdrzone) ? ast_str_buffer(cdrzone) : NULL);
 					ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %T", &tm);
-					ast_cdr_setvar(cdr, "calldate", timestr, 0);
+					ast_cdr_setvar(cdr, "calldate", timestr);
 					cdrname = "calldate";
 				} else {
 					cdrname = "start";
@@ -277,9 +277,9 @@
 				 strstr(entry->type, "real") ||
 				 strstr(entry->type, "numeric") ||
 				 strstr(entry->type, "fixed"))) {
-				ast_cdr_getvar(cdr, cdrname, &value, workspace, sizeof(workspace), 0, 1);
+				ast_cdr_format_var(cdr, cdrname, &value, workspace, sizeof(workspace), 1);
 			} else {
-				ast_cdr_getvar(cdr, cdrname, &value, workspace, sizeof(workspace), 0, 0);
+				ast_cdr_format_var(cdr, cdrname, &value, workspace, sizeof(workspace), 0);
 			}
 
 			if (value) {

Modified: team/mjordan/cdrs-of-doom/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/addons/chan_ooh323.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/addons/chan_ooh323.c (original)
+++ team/mjordan/cdrs-of-doom/addons/chan_ooh323.c Tue May 14 15:42:43 2013
@@ -2371,7 +2371,7 @@
 				ast_parse_allow_disallow(&user->prefs,
 					 user->cap,  tcodecs, 1);
 			} else if (!strcasecmp(v->name, "amaflags")) {
-				user->amaflags = ast_cdr_amaflags2int(v->value);
+				user->amaflags = ast_channel_string2amaflag(v->value);
          		} else if (!strcasecmp(v->name, "ip") || !strcasecmp(v->name, "host")) {
 				struct ast_sockaddr p;
 				if (!ast_parse_arg(v->value, PARSE_ADDR, &p)) {
@@ -2555,7 +2555,7 @@
 				ast_parse_allow_disallow(&peer->prefs, peer->cap, 
 												 tcodecs, 1);				 
 			} else if (!strcasecmp(v->name,  "amaflags")) {
-				peer->amaflags = ast_cdr_amaflags2int(v->value);
+				peer->amaflags = ast_channel_string2amaflag(v->value);
 			} else if (!strcasecmp(v->name, "roundtrip")) {
 				sscanf(v->value, "%d,%d", &peer->rtdrcount, &peer->rtdrinterval);
 			} else if (!strcasecmp(v->name, "dtmfmode")) {
@@ -2914,7 +2914,7 @@
 											"'lowdelay', 'throughput', 'reliability', "
 											"'mincost', or 'none'\n", v->lineno);
 		} else if (!strcasecmp(v->name, "amaflags")) {
-			gAMAFLAGS = ast_cdr_amaflags2int(v->value);
+			gAMAFLAGS = ast_channel_string2amaflag(v->value);
 		} else if (!strcasecmp(v->name, "accountcode")) {
          ast_copy_string(gAccountcode, v->value, sizeof(gAccountcode));
 		} else if (!strcasecmp(v->name, "disallow")) {
@@ -3114,7 +3114,7 @@
 		}
 
 		ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", peer->accountcode);
-		ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ", ast_cdr_flags2str(peer->amaflags));
+		ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ", ast_channel_amaflags2string(peer->amaflags));
 		ast_cli(a->fd, "%-15.15s%s\n", "IP:Port: ", ip_port);
 		ast_cli(a->fd, "%-15.15s%d\n", "OutgoingLimit: ", peer->outgoinglimit);
 		ast_cli(a->fd, "%-15.15s%d\n", "rtptimeout: ", peer->rtptimeout);
@@ -3273,7 +3273,7 @@
 		}
 
 		ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", user->accountcode);
-		ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ", ast_cdr_flags2str(user->amaflags));
+		ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ", ast_channel_amaflags2string(user->amaflags));
 		ast_cli(a->fd, "%-15.15s%s\n", "Context: ", user->context);
 		ast_cli(a->fd, "%-15.15s%d\n", "IncomingLimit: ", user->incominglimit);
 		ast_cli(a->fd, "%-15.15s%d\n", "InUse: ", user->inUse);
@@ -3522,7 +3522,7 @@
 
 	ast_cli(a->fd, "%-20s%ld\n", "Call counter: ", callnumber);
 	ast_cli(a->fd, "%-20s%s\n", "AccountCode: ", gAccountcode);
-	ast_cli(a->fd, "%-20s%s\n", "AMA flags: ", ast_cdr_flags2str(gAMAFLAGS));
+	ast_cli(a->fd, "%-20s%s\n", "AMA flags: ", ast_channel_amaflags2string(gAMAFLAGS));
 
 	pAlias = gAliasList;
 	if(pAlias) {

Modified: team/mjordan/cdrs-of-doom/apps/app_authenticate.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_authenticate.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_authenticate.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_authenticate.c Tue May 14 15:42:43 2013
@@ -213,9 +213,9 @@
 						continue;
 					ast_md5_hash(md5passwd, passwd);
 					if (!strcmp(md5passwd, md5secret)) {
-						if (ast_test_flag(&flags,OPT_ACCOUNT)) {
+						if (ast_test_flag(&flags, OPT_ACCOUNT)) {
 							ast_channel_lock(chan);
-							ast_cdr_setaccount(chan, buf);
+							ast_channel_accountcode_set(chan, buf);
 							ast_channel_unlock(chan);
 						}
 						break;
@@ -224,7 +224,7 @@
 					if (!strcmp(passwd, buf)) {
 						if (ast_test_flag(&flags, OPT_ACCOUNT)) {
 							ast_channel_lock(chan);
-							ast_cdr_setaccount(chan, buf);
+							ast_channel_accountcode_set(chan, buf);
 							ast_channel_unlock(chan);
 						}
 						break;
@@ -250,7 +250,7 @@
 	if ((retries < 3) && !res) {
 		if (ast_test_flag(&flags,OPT_ACCOUNT) && !ast_test_flag(&flags,OPT_MULTIPLE)) {
 			ast_channel_lock(chan);
-			ast_cdr_setaccount(chan, passwd);
+			ast_channel_accountcode_set(chan, passwd);
 			ast_channel_unlock(chan);
 		}
 		if (!(res = ast_streamfile(chan, "auth-thankyou", ast_channel_language(chan))))

Modified: team/mjordan/cdrs-of-doom/apps/app_cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_cdr.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_cdr.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_cdr.c Tue May 14 15:42:43 2013
@@ -35,25 +35,114 @@
 
 #include "asterisk/channel.h"
 #include "asterisk/module.h"
+#include "asterisk/app.h"
 
 /*** DOCUMENTATION
 	<application name="NoCDR" language="en_US">
 		<synopsis>
-			Tell Asterisk to not maintain a CDR for the current call
+			Tell Asterisk to not maintain a CDR for this channel.
 		</synopsis>
 		<syntax />
 		<description>
-			<para>This application will tell Asterisk not to maintain a CDR for the current call.</para>
+			<para>This application will tell Asterisk not to maintain a CDR for
+			the current channel. This does <emphasis>NOT</emphasis> mean that
+			information is not tracked; rather, if the channel is hung up no
+			CDRs will be created for that channel.</para>
+			<para>If a subsequent call to ResetCDR occurs, all non-finalized
+			CDRs created for the channel will be enabled.</para>
+			<note><para>This application is deprecated. Please use the CDR_PROP
+			function to disable CDRs on a channel.</para></note>
 		</description>
+		<see-also>
+			<ref type="application">ResetCDR</ref>
+			<ref type="function">CDR_PROP</ref>
+		</see-also>
+	</application>
+	<application name="ResetCDR" language="en_US">
+		<synopsis>
+			Resets the Call Data Record.
+		</synopsis>
+		<syntax>
+			<parameter name="options">
+				<optionlist>
+					<option name="v">
+						<para>Save the CDR variables during the reset.</para>
+					</option>
+					<option name="e">
+						<para>Enable the CDRs for this channel only (negate
+						effects of NoCDR).</para>
+					</option>
+				</optionlist>
+			</parameter>
+		</syntax>
+		<description>
+			<para>This application causes the Call Data Record to be reset.
+			Depending on the flags passed in, this can have several effects.
+			With no options, a reset does the following:</para>
+			<para>1. The <literal>start</literal> time is set to the current time.</para>
+			<para>2. If the channel is answered, the <literal>answer</literal> time is set to the
+			current time.</para>
+			<para>3. All variables are wiped from the CDR. Note that this step
+			can be prevented with the <literal>v</literal> option.</para>
+			<para>On the other hand, if the <literal>e</literal> option is
+			specified, the effects of the NoCDR application will be lifted. CDRs
+			will be re-enabled for this channel.</para>
+			<note><para>The <literal>e</literal> option is deprecated. Please
+			use the CDR_PROP function instead.</para></note>
+		</description>
+		<see-also>
+			<ref type="application">ForkCDR</ref>
+			<ref type="application">NoCDR</ref>
+			<ref type="function">CDR_PROP</ref>
+		</see-also>
 	</application>
  ***/
 
 static const char nocdr_app[] = "NoCDR";
+static const char resetcdr_app[] = "ResetCDR";
+
+enum reset_cdr_options {
+	OPT_DISABLE_DISPATCH = (1 << 0),
+	OPT_KEEP_VARS = (1 << 1),
+	OPT_ENABLE = (1 << 2),
+};
+
+AST_APP_OPTIONS(resetcdr_opts, {
+	AST_APP_OPTION('v', AST_CDR_FLAG_KEEP_VARS),
+	AST_APP_OPTION('e', AST_CDR_FLAG_DISABLE_ALL),
+});
+
+static int resetcdr_exec(struct ast_channel *chan, const char *data)
+{
+	char *args;
+	struct ast_flags flags = { 0 };
+	int res = 0;
+
+	if (!ast_strlen_zero(data)) {
+		args = ast_strdupa(data);
+		ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
+	}
+
+	if (ast_test_flag(&flags, AST_CDR_FLAG_DISABLE_ALL)) {
+		if (ast_cdr_clear_property(ast_channel_name(chan), AST_CDR_FLAG_DISABLE_ALL)) {
+			res = 1;
+		}
+	}
+	if (ast_cdr_reset(ast_channel_name(chan), &flags)) {
+		res = 1;
+	}
+
+	if (res) {
+		ast_log(AST_LOG_WARNING, "Failed to reset CDR for channel %s\n", ast_channel_name(chan));
+	}
+	return res;
+}
 
 static int nocdr_exec(struct ast_channel *chan, const char *data)
 {
-	if (ast_channel_cdr(chan))
-		ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_POST_DISABLED);
+	if (ast_cdr_set_property(ast_channel_name(chan), AST_CDR_FLAG_DISABLE_ALL)) {
+		ast_log(AST_LOG_WARNING, "Failed to disable CDR for channel %s\n", ast_channel_name(chan));
+	}
 
 	return 0;
 }
@@ -65,8 +154,14 @@
 
 static int load_module(void)
 {
-	if (ast_register_application_xml(nocdr_app, nocdr_exec))
+	int res = 0;
+
+	res |= ast_register_application_xml(nocdr_app, nocdr_exec);
+	res |= ast_register_application_xml(resetcdr_app, resetcdr_exec);
+
+	if (res) {
 		return AST_MODULE_LOAD_FAILURE;
+	}
 	return AST_MODULE_LOAD_SUCCESS;
 }
 

Modified: team/mjordan/cdrs-of-doom/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_dial.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_dial.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_dial.c Tue May 14 15:42:43 2013
@@ -55,7 +55,6 @@
 #include "asterisk/app.h"
 #include "asterisk/causes.h"
 #include "asterisk/rtp_engine.h"
-#include "asterisk/cdr.h"
 #include "asterisk/manager.h"
 #include "asterisk/privacy.h"
 #include "asterisk/stringfields.h"
@@ -751,36 +750,20 @@
 
 static void handle_cause(int cause, struct cause_args *num)
 {
-	struct ast_cdr *cdr = ast_channel_cdr(num->chan);
-
 	switch(cause) {
 	case AST_CAUSE_BUSY:
-		if (cdr)
-			ast_cdr_busy(cdr);
 		num->busy++;
 		break;
-
 	case AST_CAUSE_CONGESTION:
-		if (cdr)
-			ast_cdr_failed(cdr);
 		num->congestion++;
 		break;
-
 	case AST_CAUSE_NO_ROUTE_DESTINATION:
 	case AST_CAUSE_UNREGISTERED:
-		if (cdr)
-			ast_cdr_failed(cdr);
 		num->nochan++;
 		break;
-
 	case AST_CAUSE_NO_ANSWER:
-		if (cdr) {
-			ast_cdr_noanswer(cdr);
-		}
-		break;
 	case AST_CAUSE_NORMAL_CLEARING:
 		break;
-
 	default:
 		num->nochan++;
 		break;
@@ -1103,7 +1086,6 @@
 				 */
 				*to = -1;
 				strcpy(pa->status, "CONGESTION");
-				ast_cdr_failed(ast_channel_cdr(in));
 				ast_channel_publish_dial(in, outgoing->chan, NULL, pa->status);
 				return NULL;
 			}
@@ -1308,10 +1290,6 @@
 						peer = c;
 						ast_channel_publish_dial(in, peer, NULL, "ANSWER");
 						publish_dial_end_event(in, out_chans, peer, "CANCEL");
-						if (ast_channel_cdr(peer)) {
-							ast_channel_cdr(peer)->answer = ast_tvnow();
-							ast_channel_cdr(peer)->disposition = AST_CDR_ANSWERED;
-						}
 						ast_copy_flags64(peerflags, o,
 							OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
 							OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
@@ -1549,7 +1527,6 @@
 				/* Got hung up */
 				*to = -1;
 				strcpy(pa->status, "CANCEL");
-				ast_cdr_noanswer(ast_channel_cdr(in));
 				publish_dial_end_event(in, out_chans, NULL, pa->status);
 				if (f) {
 					if (f->data.uint32) {
@@ -1572,7 +1549,6 @@
 					if (onedigit_goto(in, context, (char) f->subclass.integer, 1)) {
 						ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
 						*to = 0;
-						ast_cdr_noanswer(ast_channel_cdr(in));
 						*result = f->subclass.integer;
 						strcpy(pa->status, "CANCEL");
 						publish_dial_end_event(in, out_chans, NULL, pa->status);
@@ -1591,7 +1567,6 @@
 					ast_verb(3, "User requested call disconnect.\n");
 					*to = 0;
 					strcpy(pa->status, "CANCEL");
-					ast_cdr_noanswer(ast_channel_cdr(in));
 					publish_dial_end_event(in, out_chans, NULL, pa->status);
 					ast_frfree(f);
 					if (is_cc_recall) {
@@ -1686,12 +1661,9 @@
 		}
 	}
 
-	if (!*to) {
+	if (!*to || ast_check_hangup(in)) {
 		ast_verb(3, "Nobody picked up in %d ms\n", orig);
 		publish_dial_end_event(in, out_chans, NULL, "NOANSWER");
-	}
-	if (!*to || ast_check_hangup(in)) {
-		ast_cdr_noanswer(ast_channel_cdr(in));
 	}
 
 #ifdef HAVE_EPOLL
@@ -1983,22 +1955,13 @@
 	time_t end;
 	struct ast_channel *chan = data;
 
-	if (!ast_channel_cdr(chan)) {
-		return;
-	}
-
 	time(&end);
 
 	ast_channel_lock(chan);
-	if (ast_channel_cdr(chan)->answer.tv_sec) {
-		snprintf(buf, sizeof(buf), "%ld", (long) end - ast_channel_cdr(chan)->answer.tv_sec);
-		pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
-	}
-
-	if (ast_channel_cdr(chan)->start.tv_sec) {
-		snprintf(buf, sizeof(buf), "%ld", (long) end - ast_channel_cdr(chan)->start.tv_sec);
-		pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
-	}
+	snprintf(buf, sizeof(buf), "%d", ast_channel_get_up_time(chan));
+	pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
+	snprintf(buf, sizeof(buf), "%d", ast_channel_get_duration(chan));
+	pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
 	ast_channel_unlock(chan);
 }
 
@@ -2292,8 +2255,9 @@
 		ast_channel_unlock(chan);
 	}
 
-	if (ast_test_flag64(&opts, OPT_RESETCDR) && ast_channel_cdr(chan))
-		ast_cdr_reset(ast_channel_cdr(chan), NULL);
+	if (ast_test_flag64(&opts, OPT_RESETCDR)) {
+		ast_cdr_reset(ast_channel_name(chan), 0);
+	}
 	if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
 		opt_args[OPT_ARG_PRIVACY] = ast_strdupa(ast_channel_exten(chan));
 
@@ -2616,10 +2580,6 @@
 		res = ast_call(tmp->chan, tmp->number, 0); /* Place the call, but don't wait on the answer */
 		ast_channel_lock(chan);
 
-		/* Save the info in cdr's that we called them */
-		if (ast_channel_cdr(chan))
-			ast_cdr_setdestchan(ast_channel_cdr(chan), ast_channel_name(tmp->chan));
-
 		/* check the results of ast_call */
 		if (res) {
 			/* Again, keep going even if there's an error */
@@ -2734,10 +2694,6 @@
 		   conversation.  */
 		hanguptree(&out_chans, peer, 1);
 		/* If appropriate, log that we have a destination channel and set the answer time */
-		if (ast_channel_cdr(chan)) {
-			ast_cdr_setdestchan(ast_channel_cdr(chan), ast_channel_name(peer));
-			ast_cdr_setanswer(ast_channel_cdr(chan), ast_channel_cdr(peer)->answer);
-		}
 		if (ast_channel_name(peer))
 			pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", ast_channel_name(peer));
 		
@@ -2834,8 +2790,8 @@
 		if (chan && peer && ast_test_flag64(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
 			/* chan and peer are going into the PBX, they both
 			 * should probably get CDR records. */
-			ast_clear_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED);
-			ast_clear_flag(ast_channel_cdr(peer), AST_CDR_FLAG_DIALED);
+			ast_clear_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
+			ast_clear_flag(ast_channel_flags(peer), AST_FLAG_OUTGOING);
 
 			ast_replace_subargument_delimiter(opt_args[OPT_ARG_GOTO]);
 			ast_parseable_goto(chan, opt_args[OPT_ARG_GOTO]);

Modified: team/mjordan/cdrs-of-doom/apps/app_disa.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_disa.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_disa.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_disa.c Tue May 14 15:42:43 2013
@@ -362,7 +362,7 @@
 
 	if (k == 3) {
 		int recheck = 0;
-		struct ast_flags cdr_flags = { AST_CDR_FLAG_POSTED };
+		struct ast_flags cdr_flags = { AST_CDR_FLAG_DISABLE, };
 
 		if (!ast_exists_extension(chan, args.context, exten, 1,
 			S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
@@ -384,8 +384,10 @@
 			if (!ast_strlen_zero(acctcode))
 				ast_channel_accountcode_set(chan, acctcode);
 
-			if (special_noanswer) cdr_flags.flags = 0;
-			ast_cdr_reset(ast_channel_cdr(chan), &cdr_flags);
+			if (special_noanswer) {
+				ast_clear_flag(&cdr_flags, AST_CDR_FLAG_DISABLE);
+			}
+			ast_cdr_reset(ast_channel_name(chan), &cdr_flags);
 			ast_explicit_goto(chan, args.context, exten, 1);
 			return 0;
 		}

Modified: team/mjordan/cdrs-of-doom/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_dumpchan.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_dumpchan.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_dumpchan.c Tue May 14 15:42:43 2013
@@ -69,7 +69,6 @@
 
 static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
 {
-	struct timeval now;
 	long elapsed_seconds = 0;
 	int hour = 0, min = 0, sec = 0;
 	char nf[256];
@@ -78,17 +77,15 @@
 	struct ast_str *write_transpath = ast_str_alloca(256);
 	struct ast_str *read_transpath = ast_str_alloca(256);
 
-	now = ast_tvnow();
 	memset(buf, 0, size);
 	if (!c)
 		return 0;
 
-	if (ast_channel_cdr(c)) {
-		elapsed_seconds = now.tv_sec - ast_channel_cdr(c)->start.tv_sec;
-		hour = elapsed_seconds / 3600;
-		min = (elapsed_seconds % 3600) / 60;
-		sec = elapsed_seconds % 60;
-	}
+	elapsed_seconds = ast_channel_get_duration(c);
+	hour = elapsed_seconds / 3600;
+	min = (elapsed_seconds % 3600) / 60;
+	sec = elapsed_seconds % 60;
+
 
 	snprintf(buf,size,
 		"Name=               %s\n"

Modified: team/mjordan/cdrs-of-doom/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_followme.c?view=diff&rev=388726&r1=388694&r2=388726
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_followme.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_followme.c Tue May 14 15:42:43 2013
@@ -566,29 +566,6 @@
 	}
 
 	outbound = tmpuser->ochan;
-	ast_channel_lock(outbound);
-	if (!ast_channel_cdr(outbound)) {
-		ast_channel_cdr_set(outbound, ast_cdr_alloc());
-		if (ast_channel_cdr(outbound)) {
-			ast_cdr_init(ast_channel_cdr(outbound), outbound);
-		}
-	}
-	if (ast_channel_cdr(outbound)) {
-		char tmp[256];
-
-		snprintf(tmp, sizeof(tmp), "Local/%s", tmpuser->dialarg);
-		ast_cdr_setapp(ast_channel_cdr(outbound), "FollowMe", tmp);
-		ast_cdr_update(outbound);
-		ast_cdr_start(ast_channel_cdr(outbound));
-		ast_cdr_end(ast_channel_cdr(outbound));
-		/* If the cause wasn't handled properly */
-		if (ast_cdr_disposition(ast_channel_cdr(outbound), ast_channel_hangupcause(outbound))) {
-			ast_cdr_failed(ast_channel_cdr(outbound));
-		}
-	} else {
-		ast_log(LOG_WARNING, "Unable to create Call Detail Record\n");
-	}
-	ast_channel_unlock(outbound);
 	ast_hangup(outbound);
 	tmpuser->ochan = NULL;
 }
@@ -1109,11 +1086,6 @@
 				 * Destoy all new outgoing calls.
 				 */
 				while ((tmpuser = AST_LIST_REMOVE_HEAD(&new_user_list, entry))) {
-					ast_channel_lock(tmpuser->ochan);
-					if (ast_channel_cdr(tmpuser->ochan)) {
-						ast_cdr_init(ast_channel_cdr(tmpuser->ochan), tmpuser->ochan);
-					}

[... 9242 lines stripped ...]



More information about the asterisk-commits mailing list