[svn-commits] bmd: branch group/newcdr r117902 - in /team/group/newcdr: apps/ cel/ channels...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 22 13:57:59 CDT 2008


Author: bmd
Date: Thu May 22 13:57:59 2008
New Revision: 117902

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117902
Log:
This commit adds an api change to the call stack of
ast_request/tech->requester/ast_channel_alloc in order to pass down
the linkedid from the requesting channel to the newly allocated
channel.  This ensures that EV_CHAN_START and every following event
will have the correct linkedid from inception.  Before this change,
the created channel would have the wrong linkedid until the bridge was
established.


Modified:
    team/group/newcdr/apps/app_chanisavail.c
    team/group/newcdr/apps/app_dial.c
    team/group/newcdr/apps/app_followme.c
    team/group/newcdr/apps/app_meetme.c
    team/group/newcdr/apps/app_minivm.c
    team/group/newcdr/apps/app_parkandannounce.c
    team/group/newcdr/apps/app_queue.c
    team/group/newcdr/apps/app_voicemail.c
    team/group/newcdr/cel/cel_custom.c
    team/group/newcdr/cel/cel_sqlite3_custom.c
    team/group/newcdr/channels/chan_iax2.c
    team/group/newcdr/channels/chan_jingle.c
    team/group/newcdr/channels/chan_local.c
    team/group/newcdr/channels/chan_sip.c
    team/group/newcdr/channels/chan_unistim.c
    team/group/newcdr/channels/chan_zap.c
    team/group/newcdr/include/asterisk/cel.h
    team/group/newcdr/include/asterisk/channel.h
    team/group/newcdr/main/cel.c
    team/group/newcdr/main/channel.c
    team/group/newcdr/main/dial.c
    team/group/newcdr/main/features.c
    team/group/newcdr/main/logger.c
    team/group/newcdr/main/pbx.c

Modified: team/group/newcdr/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_chanisavail.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_chanisavail.c (original)
+++ team/group/newcdr/apps/app_chanisavail.c Thu May 22 13:57:59 2008
@@ -118,7 +118,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))) {
 					pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
 					/* Store the originally used channel too */
 					snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);

Modified: team/group/newcdr/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_dial.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_dial.c (original)
+++ team/group/newcdr/apps/app_dial.c Thu May 22 13:57:59 2008
@@ -499,7 +499,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);
@@ -1452,7 +1452,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",

Modified: team/group/newcdr/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_followme.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_followme.c (original)
+++ team/group/newcdr/apps/app_followme.c Thu May 22 13:57:59 2008
@@ -793,7 +793,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/newcdr/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_meetme.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_meetme.c (original)
+++ team/group/newcdr/apps/app_meetme.c Thu May 22 13:57:59 2008
@@ -843,7 +843,7 @@
 	cnf->zapconf = ztc.confno;
 
 	/* Setup a new channel for playback of audio files */
-	cnf->chan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL);
+	cnf->chan = ast_request("zap", 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);
@@ -1645,7 +1645,7 @@
 	}
 
 	ast_mutex_lock(&conf->recordthreadlock);
-	if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
+	if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, chan, "pseudo", NULL)))) {
 		ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
 		ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
 		ztc.chan = 0;

Modified: team/group/newcdr/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_minivm.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_minivm.c (original)
+++ team/group/newcdr/apps/app_minivm.c Thu May 22 13:57:59 2008
@@ -960,8 +960,7 @@
 		return -1;
 	}
 	/* Allocate channel used for chanvar substitution */
-	ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0);
-
+	ast = ast_dummy_channel_alloc();
 
 	snprintf(dur, sizeof(dur), "%d:%02d", duration / 60, duration % 60);
 
@@ -987,7 +986,6 @@
 
 	/* Set date format for voicemail mail */
 	ast_strftime(date, sizeof(date), template->dateformat, &tm);
-
 
 	/* Populate channel with channel variables for substitution */
 	prep_email_sub_vars(ast, vmu, cidnum, cidname, dur, date, counter);
@@ -1109,7 +1107,7 @@
 	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)
-		ast_channel_free(ast);
+		ast_dummy_channel_free(ast);
 	return 0;
 }
 

Modified: team/group/newcdr/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_parkandannounce.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_parkandannounce.c (original)
+++ team/group/newcdr/apps/app_parkandannounce.c Thu May 22 13:57:59 2008
@@ -122,7 +122,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/newcdr/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_queue.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_queue.c (original)
+++ team/group/newcdr/apps/app_queue.c Thu May 22 13:57:59 2008
@@ -2160,7 +2160,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);
@@ -2562,7 +2562,7 @@
 					/* 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, o->chan->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;

Modified: team/group/newcdr/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_voicemail.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/apps/app_voicemail.c (original)
+++ team/group/newcdr/apps/app_voicemail.c Thu May 22 13:57:59 2008
@@ -2431,7 +2431,7 @@
 
 	if (!ast_strlen_zero(fromstring)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *passdata;
 			int vmlen = strlen(fromstring)*3 + 200;
 			passdata = alloca(vmlen);
@@ -2441,7 +2441,7 @@
 			len_passdata = strlen(passdata) * 2 + 3;
 			passdata2 = alloca(len_passdata);
 			fprintf(p, "From: %s <%s>" ENDL, quote(passdata, passdata2, len_passdata), who);
-			ast_channel_free(ast);
+			ast_dummy_channel_free(ast);
 		} else
 			ast_log(AST_LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
 	} else
@@ -2451,7 +2451,7 @@
 	fprintf(p, "To: %s <%s>" ENDL, quote(vmu->fullname, passdata2, len_passdata), vmu->email);
 	if (!ast_strlen_zero(emailsubject)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *passdata;
 			int vmlen = strlen(emailsubject) * 3 + 200;
 			passdata = alloca(vmlen);
@@ -2459,7 +2459,7 @@
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category, flag);
 			pbx_substitute_variables_helper(ast, emailsubject, passdata, vmlen);
 			fprintf(p, "Subject: %s" ENDL, passdata);
-			ast_channel_free(ast);
+			ast_dummy_channel_free(ast);
 		} else
 			ast_log(AST_LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
 	} else if (ast_test_flag((&globalflags), VM_PBXSKIP)) {
@@ -2513,7 +2513,7 @@
 	fprintf(p, "Content-Type: text/plain; charset=%s" ENDL "Content-Transfer-Encoding: 8bit" ENDL ENDL, charset);
 	if (emailbody) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *passdata;
 			int vmlen = strlen(emailbody)*3 + 200;
 			passdata = alloca(vmlen);
@@ -2521,7 +2521,7 @@
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category, flag);
 			pbx_substitute_variables_helper(ast, emailbody, passdata, vmlen);
 			fprintf(p, "%s" ENDL, passdata);
-			ast_channel_free(ast);
+			ast_dummy_channel_free(ast);
 		} else
 			ast_log(AST_LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
 	} else if (msgnum > -1){
@@ -2651,7 +2651,7 @@
 
 	if (*pagerfromstring) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *passdata;
 			int vmlen = strlen(fromstring)*3 + 200;
 			passdata = alloca(vmlen);
@@ -2659,7 +2659,7 @@
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category, flag);
 			pbx_substitute_variables_helper(ast, pagerfromstring, passdata, vmlen);
 			fprintf(p, "From: %s <%s>\n", passdata, who);
-			ast_channel_free(ast);
+			ast_dummy_channel_free(ast);
 		} else 
 			ast_log(AST_LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
 	} else
@@ -2667,7 +2667,7 @@
 	fprintf(p, "To: %s\n", pager);
 	if (pagersubject) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *passdata;
 			int vmlen = strlen(pagersubject) * 3 + 200;
 			passdata = alloca(vmlen);
@@ -2675,7 +2675,7 @@
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category, flag);
 			pbx_substitute_variables_helper(ast, pagersubject, passdata, vmlen);
 			fprintf(p, "Subject: %s\n\n", passdata);
-			ast_channel_free(ast);
+			ast_dummy_channel_free(ast);
 		} else
 			ast_log(AST_LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
 	} else {
@@ -2689,7 +2689,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, 0))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *passdata;
 			int vmlen = strlen(pagerbody) * 3 + 200;
 			passdata = alloca(vmlen);
@@ -2697,7 +2697,7 @@
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category, flag);
 			pbx_substitute_variables_helper(ast, pagerbody, passdata, vmlen);
 			fprintf(p, "%s\n", passdata);
-			ast_channel_free(ast);
+			ast_dummy_channel_free(ast);
 		} else
 			ast_log(AST_LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
 	} else {

Modified: team/group/newcdr/cel/cel_custom.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/cel/cel_custom.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/cel/cel_custom.c (original)
+++ team/group/newcdr/cel/cel_custom.c Thu May 22 13:57:59 2008
@@ -126,7 +126,7 @@
 	memset(buf, 0 , sizeof(buf));
 	pbx_substitute_variables_helper(tchan, format, buf, sizeof(buf) - 1);
 
-	ast_cel_free_fabricated_channel(tchan);
+	ast_dummy_channel_free(tchan);
 
 	/* because of the absolutely unconditional need for the
 	   highest reliability possible in writing billing records,

Modified: team/group/newcdr/cel/cel_sqlite3_custom.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/cel/cel_sqlite3_custom.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/cel/cel_sqlite3_custom.c (original)
+++ team/group/newcdr/cel/cel_sqlite3_custom.c Thu May 22 13:57:59 2008
@@ -178,7 +178,7 @@
 		do_escape(sql_cmd, sql_insert_cmd);
 	}
 
-	ast_cel_free_fabricated_channel(tchan);
+	ast_dummy_channel_free(tchan);
 	
 	ast_mutex_lock(&lock);
 

Modified: team/group/newcdr/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_iax2.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/channels/chan_iax2.c (original)
+++ team/group/newcdr/channels/chan_iax2.c Thu May 22 13:57:59 2008
@@ -916,7 +916,7 @@
 static int send_command_locked(unsigned short callno, char, int, unsigned int, const unsigned char *, int, int);
 static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
 static int send_command_media(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
-static struct ast_channel *iax2_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *iax2_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static struct ast_frame *iax2_read(struct ast_channel *c);
 static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
 static struct iax2_user *build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
@@ -4041,7 +4041,7 @@
 }
 
 /*! \brief  Create new call, interface with the PBX core */
-static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
+static struct ast_channel *ast_iax2_new(int callno, int state, int capability, const char *linkedid)
 {
 	struct ast_channel *tmp;
 	struct chan_iax2_pvt *i;
@@ -4054,7 +4054,7 @@
 
 	/* Don't hold call lock */
 	ast_mutex_unlock(&iaxsl[callno]);
-	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "IAX2/%s-%d", i->host, i->callno);
+	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, linkedid, i->amaflags, "IAX2/%s-%d", i->host, i->callno);
 	ast_mutex_lock(&iaxsl[callno]);
 	if (!iaxs[callno]) {
 		if (tmp) {
@@ -7409,8 +7409,8 @@
 	struct iax_dual *d;
 	struct ast_channel *chan1m, *chan2m;
 	pthread_t th;
-	chan1m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan1->exten, chan1->context, chan1->amaflags, "Parking/%s", chan1->name);
-	chan2m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->amaflags, "IAXPeer/%s",chan2->name);
+	chan1m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan1->exten, chan1->context, chan1->linkedid, chan1->amaflags, "Parking/%s", chan1->name);
+	chan2m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->linkedid, chan2->amaflags, "IAXPeer/%s", chan2->name);
 	if (chan2m && chan1m) {
 		/* Make formats okay */
 		chan1m->readformat = chan1->readformat;
@@ -8237,7 +8237,7 @@
 		    (f.frametype == AST_FRAME_IAX)) {
 			if (ast_test_flag(iaxs[fr->callno], IAX_DELAYPBXSTART)) {
 				ast_clear_flag(iaxs[fr->callno], IAX_DELAYPBXSTART);
-				if (!ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->chosenformat)) {
+				if (!ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->chosenformat, NULL)) {
 					ast_mutex_unlock(&iaxsl[fr->callno]);
 					return 1;
 				} else if (ies.vars) {
@@ -9019,7 +9019,7 @@
 											using_prefs);
 
 							ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
-							if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format)))
+							if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format, NULL)))
 								iax2_destroy(fr->callno);
 							else if (ies.vars) {
 								struct ast_datastore *variablestore;
@@ -9083,7 +9083,7 @@
 						ast_verb(3, "Accepting DIAL from %s, formats = 0x%x\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat);
 						ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
 						send_command(iaxs[fr->callno], AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, 0, NULL, 0, -1);
-						if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat)))
+						if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat, NULL)))
 							iax2_destroy(fr->callno);
 						else if (ies.vars) {
 							struct ast_datastore *variablestore;
@@ -9924,7 +9924,7 @@
 	}
 }
 
-static struct ast_channel *iax2_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *iax2_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	int callno;
 	int res;
@@ -9976,7 +9976,7 @@
 	if (cai.found)
 		ast_string_field_set(iaxs[callno], host, pds.peer);
 
-	c = ast_iax2_new(callno, AST_STATE_DOWN, cai.capability);
+	c = ast_iax2_new(callno, AST_STATE_DOWN, cai.capability, requestor ? requestor->linkedid : NULL);
 
 	ast_mutex_unlock(&iaxsl[callno]);
 

Modified: team/group/newcdr/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_jingle.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/channels/chan_jingle.c (original)
+++ team/group/newcdr/channels/chan_jingle.c Thu May 22 13:57:59 2008
@@ -166,7 +166,7 @@
 AST_MUTEX_DEFINE_STATIC(jinglelock); /*!< Protect the interface list (of jingle_pvt's) */
 
 /* Forward declarations */
-static struct ast_channel *jingle_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *jingle_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int jingle_digit_begin(struct ast_channel *ast, char digit);
 static int jingle_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static int jingle_call(struct ast_channel *ast, char *dest, int timeout);
@@ -797,7 +797,7 @@
 }
 
 /*! \brief Start new jingle channel */
-static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *i, int state, const char *title)
+static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *i, int state, const char *title, const char *linkedid)
 {
 	struct ast_channel *tmp;
 	int fmt;
@@ -808,7 +808,7 @@
 		str = title;
 	else
 		str = i->them;
-	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", "", "", 0, "Jingle/%s-%04lx", str, ast_random() & 0xffff);
+	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", "", "", linkedid, 0, "Jingle/%s-%04lx", str, ast_random() & 0xffff);
 	if (!tmp) {
 		ast_log(LOG_WARNING, "Unable to allocate Jingle channel structure!\n");
 		return NULL;
@@ -973,7 +973,7 @@
 		ast_log(LOG_WARNING, "Unable to allocate jingle structure!\n");
 		return -1;
 	}
-	chan = jingle_new(client, p, AST_STATE_DOWN, pak->from->user);
+	chan = jingle_new(client, p, AST_STATE_DOWN, pak->from->user, NULL);
 	if (chan) {
 		ast_mutex_lock(&p->lock);
 		ast_copy_string(p->them, pak->from->full, sizeof(p->them));
@@ -1418,7 +1418,7 @@
 }
 
 /*! \brief Part of PBX interface */
-static struct ast_channel *jingle_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *jingle_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct jingle_pvt *p = NULL;
 	struct jingle *client = NULL;
@@ -1445,7 +1445,7 @@
 	ASTOBJ_WRLOCK(client);
 	p = jingle_alloc(client, to, NULL);
 	if (p)
-		chan = jingle_new(client, p, AST_STATE_DOWN, to);
+		chan = jingle_new(client, p, AST_STATE_DOWN, to, requestor ? requestor->linkedid : NULL);
 	ASTOBJ_UNLOCK(client);
 
 	return chan;

Modified: team/group/newcdr/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_local.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/channels/chan_local.c (original)
+++ team/group/newcdr/channels/chan_local.c Thu May 22 13:57:59 2008
@@ -61,7 +61,7 @@
 	.impl = "",
 };
 
-static struct ast_channel *local_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *local_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int local_digit_begin(struct ast_channel *ast, char digit);
 static int local_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static int local_call(struct ast_channel *ast, char *dest, int timeout);
@@ -666,7 +666,7 @@
 }
 
 /*! \brief Start new local channel */
-static struct ast_channel *local_new(struct local_pvt *p, int state)
+static struct ast_channel *local_new(struct local_pvt *p, int state, const char *linkedid)
 {
 	struct ast_channel *tmp = NULL, *tmp2 = NULL;
 	int randnum = ast_random() & 0xffff, fmt = 0;
@@ -684,8 +684,8 @@
 		ama = p->owner->amaflags;
 	else
 		ama = 0;
-	if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, ama, "Local/%s@%s-%04x;1", p->exten, p->context, randnum)) 
-			|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, ama, "Local/%s@%s-%04x;2", p->exten, p->context, randnum))) {
+	if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, linkedid, ama, "Local/%s@%s-%04x;1", p->exten, p->context, randnum)) 
+		|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, linkedid, ama, "Local/%s@%s-%04x;2", p->exten, p->context, randnum))) {
 		if (tmp)
 			ast_channel_free(tmp);
 		if (tmp2)
@@ -730,14 +730,14 @@
 }
 
 /*! \brief Part of PBX interface */
-static struct ast_channel *local_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *local_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct local_pvt *p = NULL;
 	struct ast_channel *chan = NULL;
 
 	/* Allocate a new private structure and then Asterisk channel */
 	if ((p = local_alloc(data, format))) {
-		if (!(chan = local_new(p, AST_STATE_DOWN))) {
+		if (!(chan = local_new(p, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL))) {
 			AST_LIST_LOCK(&locals);
 			AST_LIST_REMOVE(&locals, p, list);
 			AST_LIST_UNLOCK(&locals);

Modified: team/group/newcdr/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_sip.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/channels/chan_sip.c (original)
+++ team/group/newcdr/channels/chan_sip.c Thu May 22 13:57:59 2008
@@ -1814,7 +1814,7 @@
 	in coming releases. */
 
 /*--- PBX interface functions */
-static struct ast_channel *sip_request_call(const char *type, int format, void *data, int *cause);
+static struct ast_channel *sip_request_call(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int sip_devicestate(void *data);
 static int sip_sendtext(struct ast_channel *ast, const char *text);
 static int sip_call(struct ast_channel *ast, char *dest, int timeout);
@@ -5487,7 +5487,7 @@
 	and from handle_request_invite for inbound channels
 	
 */
-static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *title)
+static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *title, const char *linkedid)
 {
 	struct ast_channel *tmp;
 	struct ast_variable *v = NULL;
@@ -5512,7 +5512,7 @@
 
 		sip_pvt_unlock(i);
 		/* Don't hold a sip pvt lock while we allocate a channel */
-		tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "SIP/%s-%08x", my_name, (int)(long) i);
+		tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, linkedid, i->amaflags, "SIP/%s-%08x", my_name, (int)(long) i);
 
 	}
 	if (!tmp) {
@@ -16692,8 +16692,8 @@
 		/* Chan2m: The transferer, chan1m: The transferee */
 	pthread_t th;
 
-	transferee = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan1->accountcode, chan1->exten, chan1->context, chan1->amaflags, "Parking/%s", chan1->name);
-	transferer = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->amaflags, "SIPPeer/%s", chan2->name);
+	transferee = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan1->accountcode, chan1->exten, chan1->context, chan1->linkedid, chan1->amaflags, "Parking/%s", chan1->name);
+	transferer = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->linkedid, chan2->amaflags, "SIPPeer/%s", chan2->name);
 	if ((!transferer) || (!transferee)) {
 		if (transferee) {
 			transferee->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
@@ -17538,7 +17538,7 @@
 
 			make_our_tag(p->tag, sizeof(p->tag));
 			/* First invitation - create the channel */
-			c = sip_new(p, AST_STATE_DOWN, S_OR(p->username, NULL));
+			c = sip_new(p, AST_STATE_DOWN, S_OR(p->username, NULL), NULL);
 			*recount = 1;
 
 			/* Save Record-Route for any later requests we make on this dialogue */
@@ -20183,7 +20183,7 @@
  *	or	SIP/host!dnid
  * \endverbatim
 */
-static struct ast_channel *sip_request_call(const char *type, int format, void *data, int *cause)
+static struct ast_channel *sip_request_call(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct sip_pvt *p;
 	struct ast_channel *tmpc = NULL;
@@ -20307,7 +20307,7 @@
 	p->prefcodec = oldformat;				/* Format for this call */
 	p->jointcapability = oldformat;
 	sip_pvt_lock(p);
-	tmpc = sip_new(p, AST_STATE_DOWN, host);	/* Place the call */
+	tmpc = sip_new(p, AST_STATE_DOWN, host, requestor ? requestor->linkedid : NULL);	/* Place the call */
 	if (global_callevents)
 		manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
 			"Channel: %s\r\nChanneltype: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n",

Modified: team/group/newcdr/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_unistim.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/channels/chan_unistim.c (original)
+++ team/group/newcdr/channels/chan_unistim.c Thu May 22 13:57:59 2008
@@ -666,13 +666,13 @@
 const static char type[] = "USTM";
 
 /*! Protos */
-static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state);
+static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state, const char *linkedid);
 static int load_module(void);
 static int reload(void);
 static int unload_module(void);
 static int reload_config(void);
 static void show_main_page(struct unistimsession *pte);
-static struct ast_channel *unistim_request(const char *type, int format, 
+static struct ast_channel *unistim_request(const char *type, int format, const struct ast_channel *requestor, 
 	void *data, int *cause);
 static int unistim_call(struct ast_channel *ast, char *dest, int timeout);
 static int unistim_hangup(struct ast_channel *ast);
@@ -2355,7 +2355,7 @@
 		return;
 	}
 	if (!sub->owner) {		      /* A call is already in progress ? */
-		c = unistim_new(sub, AST_STATE_DOWN);   /* No, starting a new one */
+		c = unistim_new(sub, AST_STATE_DOWN, NULL);   /* No, starting a new one */
 		if (c) {
 			/* Need to start RTP before calling ast_pbx_run */
 			if (!sub->rtp)
@@ -2403,7 +2403,7 @@
 			}
 			send_tone(s, 0, 0);
 			/* Make new channel */
-			c = unistim_new(p->subs[SUB_THREEWAY], AST_STATE_DOWN);
+			c = unistim_new(p->subs[SUB_THREEWAY], AST_STATE_DOWN, NULL);
 			if (!c) {
 				ast_log(LOG_WARNING, "Cannot allocate new structure on channel %p\n", p);
 				return;
@@ -4415,7 +4415,7 @@
 
 /*--- unistim_new: Initiate a call in the UNISTIM channel */
 /*      called from unistim_request (calls from the pbx ) */
-static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state)
+static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state, const char *linkedid)
 {
 	struct ast_channel *tmp;
 	struct unistim_line *l;
@@ -4431,7 +4431,7 @@
 	}
 	l = sub->parent;
 	tmp = ast_channel_alloc(1, state, l->cid_num, NULL, l->accountcode, l->exten, 
-		l->context, l->amaflags, "%s-%08x", l->fullname, (int) (long) sub);
+		l->context, linkedid, l->amaflags, "%s-%08x", l->fullname, (int) (long) sub);
 	if (unistimdebug)
 		ast_verb(0, "unistim_new sub=%d (%p) chan=%p\n", sub->subtype, sub, tmp);
 	if (!tmp) {
@@ -4612,7 +4612,7 @@
 
 /*--- unistim_request: PBX interface function ---*/
 /* UNISTIM calls initiated by the PBX arrive here */
-static struct ast_channel *unistim_request(const char *type, int format, void *data,
+static struct ast_channel *unistim_request(const char *type, int format, const struct ast_channel *requestor, void *data,
 										   int *cause)
 {
 	int oldformat;
@@ -4655,7 +4655,7 @@
 		return NULL;
 	}
 	sub->parent->capability = format;
-	tmpc = unistim_new(sub, AST_STATE_DOWN);
+	tmpc = unistim_new(sub, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
 	if (!tmpc)
 		ast_log(LOG_WARNING, "Unable to make channel for '%s'\n", tmp);
 	if (unistimdebug)

Modified: team/group/newcdr/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_zap.c?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/channels/chan_zap.c (original)
+++ team/group/newcdr/channels/chan_zap.c Thu May 22 13:57:59 2008
@@ -831,7 +831,7 @@
 }
 
 
-static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause);
+static struct ast_channel *zt_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int zt_digit_begin(struct ast_channel *ast, char digit);
 static int zt_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static int zt_sendtext(struct ast_channel *c, const char *text);
@@ -4103,7 +4103,7 @@
 
 static void *ss_thread(void *data);
 
-static struct ast_channel *zt_new(struct zt_pvt *, int, int, int, int, int);
+static struct ast_channel *zt_new(struct zt_pvt *, int, int, int, int, int, const char *);
 
 static int attempt_transfer(struct zt_pvt *p)
 {
@@ -4871,7 +4871,7 @@
 							goto winkflashdone;
 						}
 						/* Make new channel */
-						chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0);
+						chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0, ast->linkedid);
 						if (p->zaptrcallerid) {
 							if (!p->origcid_num)
 								p->origcid_num = ast_strdup(p->cid_num);
@@ -5877,7 +5877,7 @@
 	return res;
 }
 
-static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int index, int law, int transfercapability)
+static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int index, int law, int transfercapability, const char* linkedid)
 {
 	struct ast_channel *tmp;
 	int deflaw;
@@ -5909,7 +5909,7 @@
 		}
 		y++;
 	} while (x < 3);
-	tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "Zap/%s", chan_name->str);
+	tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, linkedid, i->amaflags, "Zap/%s", chan_name->str);
 	if (!tmp)
 		return NULL;
 	tmp->tech = &zap_tech;
@@ -7399,7 +7399,7 @@
 				restore_gains(mtd->pvt);
 				mtd->pvt->ringt = mtd->pvt->ringt_base;
 
-				if ((chan = zt_new(mtd->pvt, AST_STATE_RING, 0, SUB_REAL, 0, 0))) {
+				if ((chan = zt_new(mtd->pvt, AST_STATE_RING, 0, SUB_REAL, 0, 0, NULL))) {
 					pthread_attr_init(&attr);
 					pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
@@ -7523,7 +7523,7 @@
 				zt_enable_ec(i);
 				/* The channel is immediately up.  Start right away */
 				res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
-				chan = zt_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0);
+				chan = zt_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0, NULL);
 				if (!chan) {
 					ast_log(LOG_WARNING, "Unable to start PBX on channel %d\n", i->channel);
 					res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
@@ -7532,7 +7532,7 @@
 				}
 			} else {
 				/* Check for callerid, digits, etc */
-				chan = zt_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0);
+				chan = zt_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0, NULL);
 				if (chan) {
 					if (has_voicemail(i))
 						res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_STUTTER);
@@ -7573,9 +7573,9 @@
 		case SIG_SF:
 				/* Check for callerid, digits, etc */
 				if (i->cid_start == CID_START_POLARITY_IN) {
-					chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
+					chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0, NULL);
 				} else {
-					chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
+					chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0, NULL);
 				}
 				if (chan && ast_pthread_create_detached(&threadid, NULL, ss_thread, chan)) {
 					ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
@@ -7680,7 +7680,7 @@
 				ast_verb(2, "Starting post polarity "
 					    "CID detection on channel %d\n",
 					    i->channel);
-				chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
+				chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0, NULL);
 				if (chan && ast_pthread_create_detached(&threadid, NULL, ss_thread, chan)) {
 					ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
 				}
@@ -8848,7 +8848,7 @@
 }
 #endif
 
-static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *zt_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	ast_group_t groupmatch = 0;
 	int channelmatch = -1;
@@ -9007,7 +9007,7 @@
 				}
 			}
 			p->outgoing = 1;
-			tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
+			tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0, requestor ? requestor->linkedid : NULL);
 #ifdef HAVE_PRI
 			if (p->bearer) {
 				/* Log owner to bearer channel, too */
@@ -9212,7 +9212,7 @@
 	isup_acm(ss7, p->ss7call);
 
 	ast_mutex_unlock(&linkset->lock);
-	c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0);
+	c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0, NULL);
 
 	if (!c) {
 		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
@@ -10309,7 +10309,7 @@
 				if (ast_tvdiff_ms(ast_tvnow(), lastidle) > 1000) {
 					/* Don't create a new idle call more than once per second */
 					snprintf(idlen, sizeof(idlen), "%d/%s", pri->pvts[nextidle]->channel, pri->idledial);
-					idle = zt_request("Zap", AST_FORMAT_ULAW, idlen, &cause);
+					idle = zt_request("Zap", AST_FORMAT_ULAW, NULL, idlen, &cause);
 					if (idle) {
 						pri->pvts[nextidle]->isidlecall = 1;
 						if (ast_pthread_create_background(&p, NULL, do_idle_thread, idle)) {
@@ -10729,11 +10729,11 @@
 							if (crv) {
 								/* Set bearer and such */
 								pri_assign_bearer(crv, pri, pri->pvts[chanpos]);
-								c = zt_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
+								c = zt_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype, NULL);
 								pri->pvts[chanpos]->owner = &inuse;
 								ast_debug(1, "Started up crv %d:%d on bearer channel %d\n", pri->trunkgroup, crv->channel, crv->bearer->channel);
 							} else {
-								c = zt_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
+								c = zt_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype, NULL);
 							}
 
 							ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -10777,7 +10777,7 @@
 						} else  {
 							ast_mutex_unlock(&pri->lock);
 							/* Release PRI lock while we create the channel */
-							c = zt_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype);
+							c = zt_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype, NULL);
 							if (c) {
 								char calledtonstr[10];
 

Modified: team/group/newcdr/include/asterisk/cel.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/cel.h?view=diff&rev=117902&r1=117901&r2=117902
==============================================================================
--- team/group/newcdr/include/asterisk/cel.h (original)
+++ team/group/newcdr/include/asterisk/cel.h Thu May 22 13:57:59 2008
@@ -118,9 +118,9 @@
 */
 int ast_cel_setvar(struct ast_channel *chan, const char *name, const char *value);
 
-/*! Create a fake channel containing the serialized channel date in the given cel event */
+/*! Create a fake channel containing the serialized channel date in

[... 468 lines stripped ...]



More information about the svn-commits mailing list