[asterisk-commits] russell: branch group/security_events r203670 - in /team/group/security_event...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 26 13:49:28 CDT 2009


Author: russell
Date: Fri Jun 26 13:49:22 2009
New Revision: 203670

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203670
Log:
resolve, reset

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

Propchange: team/group/security_events/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/security_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jun 26 13:49:22 2009
@@ -1,1 +1,1 @@
-/trunk:1-203618
+/trunk:1-203669

Modified: team/group/security_events/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/CHANGES?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/CHANGES (original)
+++ team/group/security_events/CHANGES Fri Jun 26 13:49:22 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: team/group/security_events/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/Makefile?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/Makefile (original)
+++ team/group/security_events/Makefile Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_chanisavail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_chanisavail.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_chanisavail.c (original)
+++ team/group/security_events/apps/app_chanisavail.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_confbridge.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_confbridge.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_confbridge.c (original)
+++ team/group/security_events/apps/app_confbridge.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_dial.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_dial.c (original)
+++ team/group/security_events/apps/app_dial.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_directed_pickup.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_directed_pickup.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_directed_pickup.c (original)
+++ team/group/security_events/apps/app_directed_pickup.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_followme.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_followme.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_followme.c (original)
+++ team/group/security_events/apps/app_followme.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_meetme.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_meetme.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_meetme.c (original)
+++ team/group/security_events/apps/app_meetme.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_minivm.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_minivm.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_minivm.c (original)
+++ team/group/security_events/apps/app_minivm.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_parkandannounce.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_parkandannounce.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_parkandannounce.c (original)
+++ team/group/security_events/apps/app_parkandannounce.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_queue.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_queue.c (original)
+++ team/group/security_events/apps/app_queue.c Fri Jun 26 13:49:22 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: team/group/security_events/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_voicemail.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/apps/app_voicemail.c (original)
+++ team/group/security_events/apps/app_voicemail.c Fri Jun 26 13:49:22 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: team/group/security_events/bridges/bridge_builtin_features.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/bridges/bridge_builtin_features.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/bridges/bridge_builtin_features.c (original)
+++ team/group/security_events/bridges/bridge_builtin_features.c Fri Jun 26 13:49:22 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: team/group/security_events/cdr/cdr_custom.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/cdr/cdr_custom.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/cdr/cdr_custom.c (original)
+++ team/group/security_events/cdr/cdr_custom.c Fri Jun 26 13:49:22 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: team/group/security_events/cdr/cdr_manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/cdr/cdr_manager.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/cdr/cdr_manager.c (original)
+++ team/group/security_events/cdr/cdr_manager.c Fri Jun 26 13:49:22 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: team/group/security_events/cdr/cdr_sqlite.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/cdr/cdr_sqlite.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/cdr/cdr_sqlite.c (original)
+++ team/group/security_events/cdr/cdr_sqlite.c Fri Jun 26 13:49:22 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: team/group/security_events/cdr/cdr_sqlite3_custom.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/cdr/cdr_sqlite3_custom.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/cdr/cdr_sqlite3_custom.c (original)
+++ team/group/security_events/cdr/cdr_sqlite3_custom.c Fri Jun 26 13:49:22 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: team/group/security_events/cel/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jun 26 13:49:22 2009
@@ -1,0 +1,10 @@
+*.a
+*.d
+*.eo
+*.eoo
+*.i
+*.makeopts
+*.moduleinfo
+*.s
+*.so
+modules.link

Modified: team/group/security_events/channels/chan_agent.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/channels/chan_agent.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/channels/chan_agent.c (original)
+++ team/group/security_events/channels/chan_agent.c Fri Jun 26 13:49:22 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: team/group/security_events/channels/chan_alsa.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/channels/chan_alsa.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/channels/chan_alsa.c (original)
+++ team/group/security_events/channels/chan_alsa.c Fri Jun 26 13:49:22 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: team/group/security_events/channels/chan_bridge.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/channels/chan_bridge.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/channels/chan_bridge.c (original)
+++ team/group/security_events/channels/chan_bridge.c Fri Jun 26 13:49:22 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: team/group/security_events/channels/chan_console.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/channels/chan_console.c?view=diff&rev=203670&r1=203669&r2=203670
==============================================================================
--- team/group/security_events/channels/chan_console.c (original)
+++ team/group/security_events/channels/chan_console.c Fri Jun 26 13:49:22 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: team/group/security_events/channels/chan_dahdi.c

[... 4104 lines stripped ...]



More information about the asterisk-commits mailing list