[svn-commits] russell: trunk r203638 - in /trunk: ./ apps/ bridges/ cdr/ cel/ channels/ con...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 26 10:29:00 CDT 2009


Author: russell
Date: Fri Jun 26 10:28:53 2009
New Revision: 203638

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203638
Log:
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/

Added:
    trunk/apps/app_celgenuserevent.c
      - copied unchanged from r203637, team/group/newcdr/apps/app_celgenuserevent.c
    trunk/cel/   (props changed)
      - copied from r203637, team/group/newcdr/cel/
    trunk/cel/Makefile
      - copied unchanged from r203637, team/group/newcdr/cel/Makefile
    trunk/cel/cel_adaptive_odbc.c
      - copied unchanged from r203637, team/group/newcdr/cel/cel_adaptive_odbc.c
    trunk/cel/cel_custom.c
      - copied unchanged from r203637, team/group/newcdr/cel/cel_custom.c
    trunk/cel/cel_manager.c
      - copied unchanged from r203637, team/group/newcdr/cel/cel_manager.c
    trunk/cel/cel_pgsql.c
      - copied unchanged from r203637, team/group/newcdr/cel/cel_pgsql.c
    trunk/cel/cel_radius.c
      - copied unchanged from r203637, team/group/newcdr/cel/cel_radius.c
    trunk/cel/cel_sqlite3_custom.c
      - copied unchanged from r203637, team/group/newcdr/cel/cel_sqlite3_custom.c
    trunk/cel/cel_tds.c
      - copied unchanged from r203637, team/group/newcdr/cel/cel_tds.c
    trunk/configs/cel.conf.sample
      - copied unchanged from r203637, team/group/newcdr/configs/cel.conf.sample
    trunk/configs/cel_adaptive_odbc.conf.sample
      - copied unchanged from r203637, team/group/newcdr/configs/cel_adaptive_odbc.conf.sample
    trunk/configs/cel_custom.conf.sample
      - copied unchanged from r203637, team/group/newcdr/configs/cel_custom.conf.sample
    trunk/configs/cel_pgsql.conf.sample
      - copied unchanged from r203637, team/group/newcdr/configs/cel_pgsql.conf.sample
    trunk/configs/cel_sqlite3_custom.conf.sample
      - copied unchanged from r203637, team/group/newcdr/configs/cel_sqlite3_custom.conf.sample
    trunk/configs/cel_tds.conf.sample
      - copied unchanged from r203637, team/group/newcdr/configs/cel_tds.conf.sample
    trunk/doc/tex/cel-doc.tex
      - copied unchanged from r203637, team/group/newcdr/doc/tex/cel-doc.tex
    trunk/doc/tex/celdriver.tex
      - copied unchanged from r203637, team/group/newcdr/doc/tex/celdriver.tex
    trunk/include/asterisk/cel.h
      - copied unchanged from r203637, team/group/newcdr/include/asterisk/cel.h
    trunk/main/cel.c
      - copied unchanged from r203637, team/group/newcdr/main/cel.c
Modified:
    trunk/CHANGES
    trunk/Makefile
    trunk/apps/app_chanisavail.c
    trunk/apps/app_confbridge.c
    trunk/apps/app_dial.c
    trunk/apps/app_directed_pickup.c
    trunk/apps/app_followme.c
    trunk/apps/app_meetme.c
    trunk/apps/app_minivm.c
    trunk/apps/app_parkandannounce.c
    trunk/apps/app_queue.c
    trunk/apps/app_voicemail.c
    trunk/bridges/bridge_builtin_features.c
    trunk/cdr/cdr_custom.c
    trunk/cdr/cdr_manager.c
    trunk/cdr/cdr_sqlite.c
    trunk/cdr/cdr_sqlite3_custom.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_alsa.c
    trunk/channels/chan_bridge.c
    trunk/channels/chan_console.c
    trunk/channels/chan_dahdi.c
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_h323.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_jingle.c
    trunk/channels/chan_local.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_multicast_rtp.c
    trunk/channels/chan_nbs.c
    trunk/channels/chan_oss.c
    trunk/channels/chan_phone.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_unistim.c
    trunk/channels/chan_usbradio.c
    trunk/channels/chan_vpb.cc
    trunk/channels/sig_analog.c
    trunk/channels/sig_analog.h
    trunk/channels/sig_pri.c
    trunk/channels/sig_pri.h
    trunk/doc/tex/asterisk.tex
    trunk/funcs/func_cdr.c
    trunk/funcs/func_channel.c
    trunk/funcs/func_odbc.c
    trunk/include/asterisk/_private.h
    trunk/include/asterisk/cdr.h
    trunk/include/asterisk/channel.h
    trunk/include/asterisk/event.h   (contents, props changed)
    trunk/include/asterisk/event_defs.h   (contents, props changed)
    trunk/include/asterisk/utils.h
    trunk/main/asterisk.c
    trunk/main/cdr.c
    trunk/main/channel.c
    trunk/main/cli.c
    trunk/main/devicestate.c
    trunk/main/dial.c
    trunk/main/event.c   (contents, props changed)
    trunk/main/features.c
    trunk/main/loader.c
    trunk/main/logger.c
    trunk/main/manager.c
    trunk/main/pbx.c
    trunk/res/ais/evt.c
    trunk/res/res_agi.c
    trunk/res/res_calendar.c
    trunk/tests/test_substitution.c

Modified: trunk/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/CHANGES?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Fri Jun 26 10:28:53 2009
@@ -7,6 +7,7 @@
 === and the other UPGRADE files for older releases.
 ===
 ======================================================================
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.2 to Asterisk 1.6.3  -------------
 ------------------------------------------------------------------------------
@@ -161,8 +162,21 @@
    users of this channel in the tree have been converted to LOG_NOTICE or removed
    (in cases where the same message was already generated to another channel).
 
+Channel Event Logging
+---------------------
+ * A new interface, CEL, is introduced here. CEL logs single events, much like
+   the AMI, but it differs from the AMI in that it logs to db backends much
+   like CDR does; is based on the event subsystem introduced by Russell, and
+   can share in all its benefits; allows multiple backends to operate like CDR;
+   is specialized to event data that would be of concern to billing sytems,
+   like CDR. Backends for logging and accounting calls have been produced,
+   but a new CDR backend is still in development.
+
 CDR
 ---
+ * 'linkedid' and 'peeraccount' are new CDR fields available to CDR officianados.
+   linkedid is based on uniqueID, but spreads to other channels as transfers, dials,
+   etc are performed. Thus the peices of CDR can be grouped into multilegged sets.
  * Multiple files and formats can now be specified in cdr_custom.conf.
 
 Calendaring for Asterisk

Modified: trunk/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/Makefile?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Fri Jun 26 10:28:53 2009
@@ -293,7 +293,7 @@
 #	value directly to ASTCFLAGS
 ASTCFLAGS+=$(MALLOC_DEBUG)$(OPTIONS)
 
-MOD_SUBDIRS:=channels pbx apps codecs formats cdr bridges funcs tests main res $(LOCAL_MOD_SUBDIRS)
+MOD_SUBDIRS:=channels pbx apps codecs formats cdr cel bridges funcs tests main res $(LOCAL_MOD_SUBDIRS)
 OTHER_SUBDIRS:=utils agi
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
@@ -574,6 +574,8 @@
 	mkdir -p $(DESTDIR)$(ASTDATADIR)/documentation/thirdparty
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
+	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cel-csv
+	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cel-custom
 	mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
 	mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
 	mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax

Modified: trunk/apps/app_chanisavail.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_chanisavail.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_chanisavail.c (original)
+++ trunk/apps/app_chanisavail.c Fri Jun 26 10:28:53 2009
@@ -159,7 +159,7 @@
 				snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
 				status = inuse = ast_device_state(trychan);
 			}
-			if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, number, &status))) {
+			if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, chan, number, &status))) {
 					ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", tempchan->name);
 					
 					snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);

Modified: trunk/apps/app_confbridge.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_confbridge.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_confbridge.c (original)
+++ trunk/apps/app_confbridge.c Fri Jun 26 10:28:53 2009
@@ -559,7 +559,7 @@
 	if (!(conference_bridge->playback_chan)) {
 		int cause;
 
-		if (!(conference_bridge->playback_chan = ast_request("Bridge", AST_FORMAT_SLINEAR, "", &cause))) {
+		if (!(conference_bridge->playback_chan = ast_request("Bridge", AST_FORMAT_SLINEAR, NULL, "", &cause))) {
 			ast_mutex_unlock(&conference_bridge->playback_lock);
 			return -1;
 		}

Modified: trunk/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_dial.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Fri Jun 26 10:28:53 2009
@@ -61,6 +61,7 @@
 #include "asterisk/stringfields.h"
 #include "asterisk/global_datastores.h"
 #include "asterisk/dsp.h"
+#include "asterisk/cel.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -756,6 +757,9 @@
 		stuff = tmpchan;
 		tech = "Local";
 	}
+
+	ast_cel_report_event(in, AST_CEL_FORWARD, NULL, c->call_forward, NULL);
+
 	/* Before processing channel, go ahead and check for forwarding */
 	ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
 	/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
@@ -765,7 +769,7 @@
 		cause = AST_CAUSE_BUSY;
 	} else {
 		/* Setup parameters */
-		c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
+		c = o->chan = ast_request(tech, in->nativeformats, in, stuff, &cause);
 		if (c) {
 			if (single)
 				ast_channel_make_compatible(o->chan, in);
@@ -1872,7 +1876,7 @@
 			AST_LIST_UNLOCK(dialed_interfaces);
 		}
 
-		tc = ast_request(tech, chan->nativeformats, numsubst, &cause);
+		tc = ast_request(tech, chan->nativeformats, chan, numsubst, &cause);
 		if (!tc) {
 			/* If we can't, just go on to the next call */
 			ast_log(LOG_WARNING, "Unable to create channel of type '%s' (cause %d - %s)\n",
@@ -1921,7 +1925,9 @@
 
 		tc->cid.cid_tns = chan->cid.cid_tns;
 
-		ast_string_field_set(tc, accountcode, chan->accountcode);
+		if (!ast_strlen_zero(chan->accountcode)) {
+			ast_string_field_set(tc, peeraccount, chan->accountcode);
+		}
 		tc->cdrflags = chan->cdrflags;
 		if (ast_strlen_zero(tc->musicclass))
 			ast_string_field_set(tc, musicclass, chan->musicclass);

Modified: trunk/apps/app_directed_pickup.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_directed_pickup.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_directed_pickup.c (original)
+++ trunk/apps/app_directed_pickup.c Fri Jun 26 10:28:53 2009
@@ -41,6 +41,7 @@
 #include "asterisk/app.h"
 #include "asterisk/features.h"
 #include "asterisk/callerid.h"
+#include "asterisk/cel.h"
 
 #define PICKUPMARK "PICKUPMARK"
 
@@ -95,6 +96,7 @@
 	struct ast_party_connected_line connected_caller;
 
 	ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
+	ast_cel_report_event(target, AST_CEL_PICKUP, NULL, NULL, chan);
 
 	connected_caller = target->connected;
 	connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;

Modified: trunk/apps/app_followme.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_followme.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Fri Jun 26 10:28:53 2009
@@ -831,7 +831,7 @@
 				return;
 			}
 
-			outbound = ast_request("Local", ast_best_codec(caller->nativeformats), dialarg, &dg);
+			outbound = ast_request("Local", ast_best_codec(caller->nativeformats), caller, dialarg, &dg);
 			if (outbound) {
 				ast_set_callerid(outbound, caller->cid.cid_num, caller->cid.cid_name, caller->cid.cid_num);
 				ast_channel_inherit_variables(tpargs->chan, outbound);

Modified: trunk/apps/app_meetme.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Fri Jun 26 10:28:53 2009
@@ -1176,7 +1176,7 @@
 	cnf->dahdiconf = dahdic.confno;
 
 	/* Setup a new channel for playback of audio files */
-	cnf->chan = ast_request("DAHDI", AST_FORMAT_SLINEAR, "pseudo", NULL);
+	cnf->chan = ast_request("DAHDI", AST_FORMAT_SLINEAR, chan, "pseudo", NULL);
 	if (cnf->chan) {
 		ast_set_read_format(cnf->chan, AST_FORMAT_SLINEAR);
 		ast_set_write_format(cnf->chan, AST_FORMAT_SLINEAR);
@@ -2202,7 +2202,7 @@
 	}
 
 	ast_mutex_lock(&conf->recordthreadlock);
-	if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
+	if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", AST_FORMAT_SLINEAR, chan, "pseudo", NULL)))) {
 		ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
 		ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
 		dahdic.chan = 0;

Modified: trunk/apps/app_minivm.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Fri Jun 26 10:28:53 2009
@@ -1299,8 +1299,7 @@
 		return -1;
 	}
 	/* Allocate channel used for chanvar substitution */
-	ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "%s", "");
-
+	ast = ast_dummy_channel_alloc();
 
 	snprintf(dur, sizeof(dur), "%d:%02d", duration / 60, duration % 60);
 
@@ -1461,9 +1460,8 @@
 	ast_safe_system(tmp2);
 	ast_debug(1, "Sent message to %s with command '%s' - %s\n", vmu->email, global_mailcmd, template->attachment ? "(media attachment)" : "");
 	ast_debug(3, "Actual command used: %s\n", tmp2);
-	if (ast) {
+	if (ast)
 		ast = ast_channel_release(ast);
-	}
 	ast_free(str1);
 	ast_free(str2);
 	return 0;

Modified: trunk/apps/app_parkandannounce.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_parkandannounce.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_parkandannounce.c (original)
+++ trunk/apps/app_parkandannounce.c Fri Jun 26 10:28:53 2009
@@ -145,7 +145,7 @@
 	snprintf(buf, sizeof(buf), "%d", lot);
 	oh.parent_channel = chan;
 	oh.vars = ast_variable_new("_PARKEDAT", buf, "");
-	dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, args.dial, 30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
+	dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, chan, args.dial, 30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
 
 	if (dchan) {
 		if (dchan->_state == AST_STATE_UP) {

Modified: trunk/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_queue.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Jun 26 10:28:53 2009
@@ -95,6 +95,7 @@
 #include "asterisk/global_datastores.h"
 #include "asterisk/taskprocessor.h"
 #include "asterisk/callerid.h"
+#include "asterisk/cel.h"
 
 /*!
  * \par Please read before modifying this file.
@@ -2656,7 +2657,7 @@
 		location = "";
 
 	/* Request the peer */
-	tmp->chan = ast_request(tech, qe->chan->nativeformats, location, &status);
+	tmp->chan = ast_request(tech, qe->chan->nativeformats, qe->chan, location, &status);
 	if (!tmp->chan) {			/* If we can't, just go on to the next call */
 		if (qe->chan->cdr)
 			ast_cdr_busy(qe->chan->cdr);
@@ -3138,10 +3139,13 @@
 						stuff = tmpchan;
 						tech = "Local";
 					}
+
+					ast_cel_report_event(in, AST_CEL_FORWARD, NULL, o->chan->call_forward, NULL);
+
 					/* Before processing channel, go ahead and check for forwarding */
 					ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", inchan_name, tech, stuff, ochan_name);
 					/* Setup parameters */
-					o->chan = ast_request(tech, in->nativeformats, stuff, &status);
+					o->chan = ast_request(tech, in->nativeformats, in, stuff, &status);
 					if (!o->chan) {
 						ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s'\n", tech, stuff);
 						o->stillgoing = 0;
@@ -7483,7 +7487,8 @@
 		ast_log(LOG_WARNING, "devicestate taskprocessor reference failed - devicestate notifications will not occur\n");
 	}
 
-	if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END))) {
+	/* in the following subscribe call, do I use DEVICE_STATE, or DEVICE_STATE_CHANGE? */
+	if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, "AppQueue Device state", NULL, AST_EVENT_IE_END))) {
 		res = -1;
 	}
 

Modified: trunk/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri Jun 26 10:28:53 2009
@@ -4105,7 +4105,7 @@
 
 	if (!ast_strlen_zero(fromstring)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *ptr;
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, enc_cidnum, enc_cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, fromstring);
@@ -4151,7 +4151,7 @@
 	if (!ast_strlen_zero(emailsubject) || !ast_strlen_zero(vmu->emailsubject)) {
 		char *e_subj = !ast_strlen_zero(vmu->emailsubject) ? vmu->emailsubject : emailsubject;
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, e_subj);
 			if (check_mime(ast_str_buffer(str1))) {
@@ -4234,7 +4234,7 @@
 	if (emailbody || vmu->emailbody) {
 		char* e_body = vmu->emailbody ? vmu->emailbody : emailbody;
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, e_body);
 			fprintf(p, "%s" ENDL, ast_str_buffer(str1));
@@ -4434,7 +4434,7 @@
 
 	if (!ast_strlen_zero(pagerfromstring)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *ptr;
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, enc_cidnum, enc_cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, pagerfromstring);
@@ -4479,7 +4479,7 @@
 
 	if (!ast_strlen_zero(pagersubject)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, pagersubject);
 			if (check_mime(ast_str_buffer(str1))) {
@@ -4512,7 +4512,7 @@
 	ast_strftime(date, sizeof(date), "%A, %B %d, %Y at %r", &tm);
 	if (pagerbody) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, pagerbody);
 			fprintf(p, "%s" ENDL, ast_str_buffer(str1));
@@ -10254,11 +10254,11 @@
 
 static void start_poll_thread(void)
 {
-	mwi_sub_sub = ast_event_subscribe(AST_EVENT_SUB, mwi_sub_event_cb, NULL,
+	mwi_sub_sub = ast_event_subscribe(AST_EVENT_SUB, mwi_sub_event_cb, "Voicemail MWI subscription", NULL,
 		AST_EVENT_IE_EVENTTYPE, AST_EVENT_IE_PLTYPE_UINT, AST_EVENT_MWI,
 		AST_EVENT_IE_END);
 
-	mwi_unsub_sub = ast_event_subscribe(AST_EVENT_UNSUB, mwi_unsub_event_cb, NULL,
+	mwi_unsub_sub = ast_event_subscribe(AST_EVENT_UNSUB, mwi_unsub_event_cb, "Voicemail MWI subscription", NULL,
 		AST_EVENT_IE_EVENTTYPE, AST_EVENT_IE_PLTYPE_UINT, AST_EVENT_MWI,
 		AST_EVENT_IE_END);
 

Modified: trunk/bridges/bridge_builtin_features.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/bridges/bridge_builtin_features.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/bridges/bridge_builtin_features.c (original)
+++ trunk/bridges/bridge_builtin_features.c Fri Jun 26 10:28:53 2009
@@ -75,7 +75,7 @@
 	snprintf(destination, sizeof(destination), "%s@%s", exten, context);
 
 	/* Now we request that chan_local prepare to call the destination */
-	if (!(chan = ast_request("Local", caller->nativeformats, destination, &cause))) {
+	if (!(chan = ast_request("Local", caller->nativeformats, caller, destination, &cause))) {
 		return NULL;
 	}
 

Modified: trunk/cdr/cdr_custom.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/cdr/cdr_custom.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/cdr/cdr_custom.c (original)
+++ trunk/cdr/cdr_custom.c Fri Jun 26 10:28:53 2009
@@ -124,7 +124,7 @@
 		return -1;
 	}
 
-	dummy = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Substitution/%p", cdr);
+	dummy = ast_dummy_channel_alloc();
 
 	if (!dummy) {
 		ast_log(LOG_ERROR, "Unable to allocate channel for variable subsitution.\n");

Modified: trunk/cdr/cdr_manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/cdr/cdr_manager.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/cdr/cdr_manager.c (original)
+++ trunk/cdr/cdr_manager.c Fri Jun 26 10:28:53 2009
@@ -156,7 +156,7 @@
 	buf[0] = '\0';
 	ast_rwlock_rdlock(&customfields_lock);
 	if (customfields && ast_str_strlen(customfields)) {
-		struct ast_channel *dummy = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Substitution/%p", cdr);
+		struct ast_channel *dummy = ast_dummy_channel_alloc();
 		if (!dummy) {
 			ast_log(LOG_ERROR, "Unable to allocate channel for variable substitution.\n");
 			return 0;

Modified: trunk/cdr/cdr_sqlite.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/cdr/cdr_sqlite.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/cdr/cdr_sqlite.c (original)
+++ trunk/cdr/cdr_sqlite.c Fri Jun 26 10:28:53 2009
@@ -184,7 +184,7 @@
 	if (!db) {
 		ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr);
 		ast_free(zErr);
-		return -1;
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	/* is the table there? */
@@ -203,14 +203,14 @@
 	res = ast_cdr_register(name, ast_module_info->description, sqlite_log);
 	if (res) {
 		ast_log(LOG_ERROR, "Unable to register SQLite CDR handling\n");
-		return -1;
-	}
-	return 0;
+		return AST_MODULE_LOAD_DECLINE;
+	}
+	return AST_MODULE_LOAD_SUCCESS;
 
 err:
 	if (db)
 		sqlite_close(db);
-	return -1;
+	return AST_MODULE_LOAD_DECLINE;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "SQLite CDR Backend");

Modified: trunk/cdr/cdr_sqlite3_custom.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/cdr/cdr_sqlite3_custom.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/cdr/cdr_sqlite3_custom.c (original)
+++ trunk/cdr/cdr_sqlite3_custom.c Fri Jun 26 10:28:53 2009
@@ -241,7 +241,7 @@
 		struct ast_channel *dummy;
 		struct ast_str *value_string = ast_str_create(1024);
 
-		dummy = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Substitution/%p", cdr);
+		dummy = ast_dummy_channel_alloc();
 		if (!dummy) {
 			ast_log(LOG_ERROR, "Unable to allocate channel for variable subsitution.\n");
 			ast_free(value_string);

Propchange: trunk/cel/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jun 26 10:28:53 2009
@@ -1,0 +1,10 @@
+*.a
+*.d
+*.eo
+*.eoo
+*.i
+*.makeopts
+*.moduleinfo
+*.s
+*.so
+modules.link

Modified: trunk/channels/chan_agent.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Fri Jun 26 10:28:53 2009
@@ -310,7 +310,7 @@
 } while(0)
 
 /*--- Forward declarations */
-static struct ast_channel *agent_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *agent_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int agent_devicestate(void *data);
 static int agent_digit_begin(struct ast_channel *ast, char digit);
 static int agent_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
@@ -986,7 +986,7 @@
 }
 
 /*! \brief Create new agent channel */
-static struct ast_channel *agent_new(struct agent_pvt *p, int state)
+static struct ast_channel *agent_new(struct agent_pvt *p, int state, const char *linkedid)
 {
 	struct ast_channel *tmp;
 	int alreadylocked;
@@ -997,9 +997,9 @@
 	}
 #endif	
 	if (p->pending)
-		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/P%s-%d", p->agent, (int) ast_random() & 0xffff);
+		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", linkedid, 0, "Agent/P%s-%d", p->agent, (int) ast_random() & 0xffff);
 	else
-		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/%s", p->agent);
+		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", linkedid, 0, "Agent/%s", p->agent);
 	if (!tmp) {
 		ast_log(LOG_WARNING, "Unable to allocate agent channel structure\n");
 		return NULL;
@@ -1249,7 +1249,7 @@
 		if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
 			ast_debug(1, "Call '%s' looks like a winner for agent '%s'\n", p->owner->name, newlyavailable->agent);
 			/* We found a pending call, time to merge */
-			chan = agent_new(newlyavailable, AST_STATE_DOWN);
+			chan = agent_new(newlyavailable, AST_STATE_DOWN, p->owner ? p->owner->linkedid : NULL);
 			parent = p->owner;
 			p->abouttograb = 1;
 			ast_mutex_unlock(&p->lock);
@@ -1334,7 +1334,7 @@
 }
 
 /*! \brief Part of the Asterisk PBX interface */
-static struct ast_channel *agent_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *agent_request(const char *type, int format, const struct ast_channel* requestor, void *data, int *cause)
 {
 	struct agent_pvt *p;
 	struct ast_channel *chan = NULL;
@@ -1367,7 +1367,7 @@
 				/* Agent must be registered, but not have any active call, and not be in a waiting state */
 				if (!p->owner && p->chan) {
 					/* Fixed agent */
-					chan = agent_new(p, AST_STATE_DOWN);
+					chan = agent_new(p, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
 				}
 				if (chan) {
 					ast_mutex_unlock(&p->lock);
@@ -1390,7 +1390,7 @@
 					/* Agent must be registered, but not have any active call, and not be in a waiting state */
 					if (!p->owner && p->chan) {
 						/* Could still get a fixed agent */
-						chan = agent_new(p, AST_STATE_DOWN);
+						chan = agent_new(p, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
 					}
 					if (chan) {
 						ast_mutex_unlock(&p->lock);
@@ -1409,7 +1409,7 @@
 			ast_debug(1, "Creating place holder for '%s'\n", s);
 			p = add_agent(data, 1);
 			p->group = groupmatch;
-			chan = agent_new(p, AST_STATE_DOWN);
+			chan = agent_new(p, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
 			if (!chan) 
 				ast_log(LOG_WARNING, "Weird...  Fix this to drop the unused pending agent\n");
 		} else {

Modified: trunk/channels/chan_alsa.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_alsa.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/channels/chan_alsa.c (original)
+++ trunk/channels/chan_alsa.c Fri Jun 26 10:28:53 2009
@@ -130,7 +130,7 @@
 
 static int autoanswer = 1;
 
-static struct ast_channel *alsa_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *alsa_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int alsa_digit(struct ast_channel *c, char digit, unsigned int duration);
 static int alsa_text(struct ast_channel *c, const char *text);
 static int alsa_hangup(struct ast_channel *c);
@@ -532,11 +532,11 @@
 	return res;
 }
 
-static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
+static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state, const char *linkedid)
 {
 	struct ast_channel *tmp = NULL;
 
-	if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "ALSA/%s", indevname)))
+	if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, linkedid, 0, "ALSA/%s", indevname)))
 		return NULL;
 
 	tmp->tech = &alsa_tech;
@@ -565,7 +565,7 @@
 	return tmp;
 }
 
-static struct ast_channel *alsa_request(const char *type, int fmt, void *data, int *cause)
+static struct ast_channel *alsa_request(const char *type, int fmt, const struct ast_channel *requestor, void *data, int *cause)
 {
 	int oldformat = fmt;
 	struct ast_channel *tmp = NULL;
@@ -580,7 +580,7 @@
 	if (alsa.owner) {
 		ast_log(LOG_NOTICE, "Already have a call on the ALSA channel\n");
 		*cause = AST_CAUSE_BUSY;
-	} else if (!(tmp = alsa_new(&alsa, AST_STATE_DOWN))) {
+	} else if (!(tmp = alsa_new(&alsa, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL))) {
 		ast_log(LOG_WARNING, "Unable to create new ALSA channel\n");
 	}
 
@@ -833,7 +833,7 @@
 			ast_copy_string(alsa.exten, mye, sizeof(alsa.exten));
 			ast_copy_string(alsa.context, myc, sizeof(alsa.context));
 			hookstate = 1;
-			alsa_new(&alsa, AST_STATE_RINGING);
+			alsa_new(&alsa, AST_STATE_RINGING, NULL);
 		} else
 			ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);
 	}

Modified: trunk/channels/chan_bridge.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_bridge.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/channels/chan_bridge.c (original)
+++ trunk/channels/chan_bridge.c Fri Jun 26 10:28:53 2009
@@ -46,7 +46,7 @@
 #include "asterisk/app.h"
 #include "asterisk/bridging.h"
 
-static struct ast_channel *bridge_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *bridge_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int bridge_call(struct ast_channel *ast, char *dest, int timeout);
 static int bridge_hangup(struct ast_channel *ast);
 static struct ast_frame *bridge_read(struct ast_channel *ast);
@@ -189,7 +189,7 @@
 }
 
 /*! \brief Called when we want to place a call somewhere, but not actually call it... yet */
-static struct ast_channel *bridge_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *bridge_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct bridge_pvt *p = NULL;
 
@@ -199,11 +199,11 @@
 	}
 
 	/* Try to grab two Asterisk channels to use as input and output channels */
-	if (!(p->input = ast_channel_alloc(1, AST_STATE_UP, 0, 0, "", "", "", 0, "Bridge/%p-input", p))) {
+	if (!(p->input = ast_channel_alloc(1, AST_STATE_UP, 0, 0, "", "", "", requestor ? requestor->linkedid : NULL, 0, "Bridge/%p-input", p))) {
 		ast_free(p);
 		return NULL;
 	}
-	if (!(p->output = ast_channel_alloc(1, AST_STATE_UP, 0, 0, "", "", "", 0, "Bridge/%p-output", p))) {
+	if (!(p->output = ast_channel_alloc(1, AST_STATE_UP, 0, 0, "", "", "", requestor ? requestor->linkedid : NULL, 0, "Bridge/%p-output", p))) {
 		p->input = ast_channel_release(p->input);
 		ast_free(p);
 		return NULL;

Modified: trunk/channels/chan_console.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_console.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/channels/chan_console.c (original)
+++ trunk/channels/chan_console.c Fri Jun 26 10:28:53 2009
@@ -189,8 +189,8 @@
 static struct ast_jb_conf global_jbconf;
 
 /*! Channel Technology Callbacks @{ */
-static struct ast_channel *console_request(const char *type, int format, 
-	void *data, int *cause);
+static struct ast_channel *console_request(const char *type, int format,
+	const struct ast_channel *requestor, void *data, int *cause);
 static int console_digit_begin(struct ast_channel *c, char digit);
 static int console_digit_end(struct ast_channel *c, char digit, unsigned int duration);
 static int console_text(struct ast_channel *c, const char *text);
@@ -413,12 +413,12 @@
 /*!
  * \note Called with the pvt struct locked
  */
-static struct ast_channel *console_new(struct console_pvt *pvt, const char *ext, const char *ctx, int state)
+static struct ast_channel *console_new(struct console_pvt *pvt, const char *ext, const char *ctx, int state, const char *linkedid)
 {
 	struct ast_channel *chan;
 
 	if (!(chan = ast_channel_alloc(1, state, pvt->cid_num, pvt->cid_name, NULL, 
-		ext, ctx, 0, "Console/%s", pvt->name))) {
+		ext, ctx, linkedid, 0, "Console/%s", pvt->name))) {
 		return NULL;
 	}
 
@@ -447,7 +447,7 @@
 	return chan;
 }
 
-static struct ast_channel *console_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *console_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	int oldformat = format;
 	struct ast_channel *chan = NULL;
@@ -471,7 +471,7 @@
 	}
 
 	console_pvt_lock(pvt);
-	chan = console_new(pvt, NULL, NULL, AST_STATE_DOWN);
+	chan = console_new(pvt, NULL, NULL, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
 	console_pvt_unlock(pvt);
 
 	if (!chan)
@@ -833,7 +833,7 @@
 	if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
 		console_pvt_lock(pvt);
 		pvt->hookstate = 1;
-		console_new(pvt, mye, myc, AST_STATE_RINGING);
+		console_new(pvt, mye, myc, AST_STATE_RINGING, NULL);
 		console_pvt_unlock(pvt);
 	} else
 		ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=203638&r1=203637&r2=203638
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Fri Jun 26 10:28:53 2009
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2006, Digium, Inc.
+ * Copyright (C) 1999 - 2008, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -91,6 +91,7 @@
 #include "asterisk/adsi.h"
 #include "asterisk/cli.h"
 #include "asterisk/cdr.h"
+#include "asterisk/cel.h"
 #include "asterisk/features.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/say.h"
@@ -1388,7 +1389,7 @@
 }
 
 
-static struct ast_channel *dahdi_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *dahdi_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int dahdi_digit_begin(struct ast_channel *ast, char digit);
 static int dahdi_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static int dahdi_sendtext(struct ast_channel *c, const char *text);
@@ -1978,14 +1979,14 @@
 	return;
 }
 
-static struct ast_channel *dahdi_new(struct dahdi_pvt *, int, int, int, int, int);
-
-static struct ast_channel *my_new_analog_ast_channel(void *pvt, int state, int startpbx, enum analog_sub sub)
+static struct ast_channel *dahdi_new(struct dahdi_pvt *, int, int, int, int, int, const char *);
+
+static struct ast_channel *my_new_analog_ast_channel(void *pvt, int state, int startpbx, enum analog_sub sub, const struct ast_channel *requestor)
 {
 	struct dahdi_pvt *p = pvt;
 	int dsub = analogsub_to_dahdisub(sub);
 
-	return dahdi_new(p, state, startpbx, dsub, 0, 0);
+	return dahdi_new(p, state, startpbx, dsub, 0, 0, requestor ? requestor->linkedid : "");
 }
 
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
@@ -2000,7 +2001,7 @@
 #endif
 
 #ifdef HAVE_PRI
-static struct ast_channel *my_new_pri_ast_channel(void *pvt, int state, int startpbx, enum sig_pri_law law, int transfercapability, char *exten)
+static struct ast_channel *my_new_pri_ast_channel(void *pvt, int state, int startpbx, enum sig_pri_law law, int transfercapability, char *exten, const struct ast_channel *requestor)
 {
 	struct dahdi_pvt *p = pvt;
 	int audio;
@@ -2028,7 +2029,7 @@
 			newlaw = DAHDI_LAW_MULAW;
 			break;
 	}
-	return dahdi_new(p, state, startpbx, SUB_REAL, newlaw, transfercapability);
+	return dahdi_new(p, state, startpbx, SUB_REAL, newlaw, transfercapability, requestor ? requestor->linkedid : "");
 }
 #endif
 
@@ -2595,7 +2596,6 @@
 #endif
 }
 
-static struct ast_channel *dahdi_new(struct dahdi_pvt *, int, int, int, int, int);
 #ifdef HAVE_OPENR2
 
 static int dahdi_r2_answer(struct dahdi_pvt *p)
@@ -2764,7 +2764,7 @@
 	}
 	if (!p->mfcr2_accept_on_offer) {
 		/* The user wants us to start the PBX thread right away without accepting the call first */
-		c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, 0);
+		c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, 0, NULL);
 		if (c) {
 			dahdi_r2_update_monitor_count(p->mfcr2, 0);

[... 3800 lines stripped ...]



More information about the svn-commits mailing list