[asterisk-commits] branch oej/codecnegotiation r27303 - in /team/oej/codecnegotiation: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 16 04:31:14 MST 2006


Author: oej
Date: Tue May 16 06:31:14 2006
New Revision: 27303

URL: http://svn.digium.com/view/asterisk?rev=27303&view=rev
Log:
Update from Denis

Modified:
    team/oej/codecnegotiation/README.codecnegotiation-branch
    team/oej/codecnegotiation/app.c
    team/oej/codecnegotiation/apps/app_dial.c
    team/oej/codecnegotiation/apps/app_directory.c
    team/oej/codecnegotiation/apps/app_dumpchan.c
    team/oej/codecnegotiation/channel.c
    team/oej/codecnegotiation/channels/chan_agent.c
    team/oej/codecnegotiation/channels/chan_alsa.c
    team/oej/codecnegotiation/channels/chan_features.c
    team/oej/codecnegotiation/channels/chan_mgcp.c
    team/oej/codecnegotiation/channels/chan_misdn.c
    team/oej/codecnegotiation/channels/chan_sip.c
    team/oej/codecnegotiation/channels/chan_skinny.c
    team/oej/codecnegotiation/channels/chan_zap.c
    team/oej/codecnegotiation/cli.c
    team/oej/codecnegotiation/file.c
    team/oej/codecnegotiation/funcs/func_odbc.c
    team/oej/codecnegotiation/include/asterisk/channel.h
    team/oej/codecnegotiation/pbx.c
    team/oej/codecnegotiation/res/res_features.c
    team/oej/codecnegotiation/res/res_musiconhold.c

Modified: team/oej/codecnegotiation/README.codecnegotiation-branch
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/README.codecnegotiation-branch?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/README.codecnegotiation-branch (original)
+++ team/oej/codecnegotiation/README.codecnegotiation-branch Tue May 16 06:31:14 2006
@@ -39,6 +39,9 @@
     - copy type from parent channel, if type not set;
     - copy formats from parent channel;
  - ast_chan_getformatname  = ast_getformatname(chan->nativeformats)
+ - ast_channel_format_reset =
+ 	ast_set_read_format(chan->readformat);
+	ast_set_write_format(chan->writeformat);
 
 Related changes:
  - most places, where can be used new functions changed to use it

Modified: team/oej/codecnegotiation/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/app.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/app.c (original)
+++ team/oej/codecnegotiation/app.c Tue May 16 06:31:14 2006
@@ -144,89 +144,6 @@
 	return res;
 }
 
-<<<<<<< .working
-int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prompt, int silence, int maxsec)
-{
-	int res;
-	struct ast_filestream *writer;
-	int rfmt;
-	int totalms=0, total;
-	
-	struct ast_frame *f;
-	struct ast_dsp *sildet;
-	/* Play prompt if requested */
-	if (prompt) {
-		res = ast_stream_and_wait(c, prompt, c->language, "");
-		if (res < 0)
-			return res;
-	}
-	rfmt = ast_get_read_format(c);
-	res = ast_set_read_format(c, AST_FORMAT_SLINEAR);
-	if (res < 0) {
-		ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
-		return -1;
-	}
-	sildet = ast_dsp_new();
-	if (!sildet) {
-		ast_log(LOG_WARNING, "Unable to create silence detector :(\n");
-		return -1;
-	}
-	writer = ast_writefile(dest, dstfmt, "Voice file", 0, 0, 0666);
-	if (!writer) {
-		ast_log(LOG_WARNING, "Unable to open file '%s' in format '%s' for writing\n", dest, dstfmt);
-		ast_dsp_free(sildet);
-		return -1;
-	}
-	for(;;) {
-		if ((res = ast_waitfor(c, 2000)) < 0) {
-			ast_log(LOG_NOTICE, "Waitfor failed while recording file '%s' format '%s'\n", dest, dstfmt);
-			break;
-		}
-		if (res) {
-			f = ast_read(c);
-			if (!f) {
-				ast_log(LOG_NOTICE, "Hungup while recording file '%s' format '%s'\n", dest, dstfmt);
-				break;
-			}
-			if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
-				/* Ended happily with DTMF */
-				ast_frfree(f);
-				break;
-			} else if (f->frametype == AST_FRAME_VOICE) {
-				ast_dsp_silence(sildet, f, &total); 
-				if (total > silence) {
-					/* Ended happily with silence */
-					ast_frfree(f);
-					break;
-				}
-				totalms += f->samples / 8;
-				if (totalms > maxsec * 1000) {
-					/* Ended happily with too much stuff */
-					ast_log(LOG_NOTICE, "Constraining voice on '%s' to %d seconds\n", c->name, maxsec);
-					ast_frfree(f);
-					break;
-				}
-				res = ast_writestream(writer, f);
-				if (res < 0) {
-					ast_log(LOG_WARNING, "Failed to write to stream at %s!\n", dest);
-					ast_frfree(f);
-					break;
-				}
-					
-			}
-			ast_frfree(f);
-		}
-	}
-	res = ast_set_read_format(c, rfmt);
-	if (res)
-		ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", c->name);
-	ast_dsp_free(sildet);
-	ast_closestream(writer);
-	return 0;
-}
-
-=======
->>>>>>> .merge-right.r27270
 static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;
 static int (*ast_messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs) = NULL;
 
@@ -765,136 +682,9 @@
 	}
 	*duration = end - start;
 
-<<<<<<< .working
-	for (x=0;x<fmtcnt;x++) {
-		if (!others[x])
-			break;
-		if (res > 0)
-			ast_stream_rewind(others[x], totalsilence ? totalsilence-200 : 200);
-		ast_truncstream(others[x]);
-		ast_closestream(others[x]);
-	}
-	if (rfmt && ast_set_read_format(chan, rfmt)) {
-		ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
-	}
-	if (outmsg > 1) {
-		/* Let them know recording is stopped */
-		ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
-	}
-	if (sildet)
-		ast_dsp_free(sildet);
-	return res;
-}
-
-int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence)
-{
-	int d = 0;
-	char *fmts;
-	char comment[256];
-	int x, fmtcnt=1, res=-1,outmsg=0;
-	struct ast_frame *f;
-	struct ast_filestream *others[MAX_OTHER_FORMATS];
-	struct ast_filestream *realfiles[MAX_OTHER_FORMATS];
-	char *sfmt[MAX_OTHER_FORMATS];
-	char *stringp=NULL;
-	time_t start, end;
-	struct ast_dsp *sildet;   	/* silence detector dsp */
-	int totalsilence = 0;
-	int dspsilence = 0;
-	int rfmt=0;	
-	char prependfile[80];
-	
-	if (silencethreshold < 0)
-		silencethreshold = global_silence_threshold;
-
-	if (maxsilence < 0)
-		maxsilence = global_maxsilence;
-
-	/* barf if no pointer passed to store duration in */
-	if (duration == NULL) {
-		ast_log(LOG_WARNING, "Error play_and_prepend called without duration pointer\n");
-		return -1;
-	}
-
-	ast_log(LOG_DEBUG,"play_and_prepend: %s, %s, '%s'\n", playfile ? playfile : "<None>", recordfile, fmt);
-	snprintf(comment,sizeof(comment),"Playing %s, Recording to: %s on %s\n", playfile ? playfile : "<None>", recordfile, chan->name);
-
-	if (playfile || beep) {	
-		if (!beep)
-			d = ast_play_and_wait(chan, playfile);
-		if (d > -1)
-			d = ast_stream_and_wait(chan, "beep",chan->language, "");
-		if (d < 0)
-			return -1;
-	}
-	ast_copy_string(prependfile, recordfile, sizeof(prependfile));	
-	strncat(prependfile, "-prepend", sizeof(prependfile) - strlen(prependfile) - 1);
-			
-	fmts = ast_strdupa(fmt);
-	
-	stringp=fmts;
-	strsep(&stringp, "|");
-	ast_log(LOG_DEBUG,"Recording Formats: sfmts=%s\n", fmts);	
-	sfmt[0] = ast_strdupa(fmts);
-	
-	while((fmt = strsep(&stringp, "|"))) {
-		if (fmtcnt > MAX_OTHER_FORMATS - 1) {
-			ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
-			break;
-		}
-		sfmt[fmtcnt++] = ast_strdupa(fmt);
-	}
-
-	time(&start);
-	end=start;  /* pre-initialize end to be same as start in case we never get into loop */
-	for (x=0;x<fmtcnt;x++) {
-		others[x] = ast_writefile(prependfile, sfmt[x], comment, O_TRUNC, 0, 0700);
-		ast_verbose( VERBOSE_PREFIX_3 "x=%d, open writing:  %s format: %s, %p\n", x, prependfile, sfmt[x], others[x]);
-		if (!others[x]) {
-			break;
-		}
-	}
-	
-	sildet = ast_dsp_new(); /* Create the silence detector */
-	if (!sildet) {
-		ast_log(LOG_WARNING, "Unable to create silence detector :(\n");
-		return -1;
-	}
-	ast_dsp_set_threshold(sildet, silencethreshold);
-
-	if (maxsilence > 0) {
-		rfmt = ast_get_read_format(chan);
-		res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
-		if (res < 0) {
-			ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
-			ast_dsp_free(sildet);
-			return -1;
-		}
-	}
-						
-	if (x == fmtcnt) {
-	/* Loop forever, writing the packets we read to the writer(s), until
-	   we read a # or get a hangup */
-		f = NULL;
-		for(;;) {
-		 	res = ast_waitfor(chan, 2000);
-			if (!res) {
-				ast_log(LOG_DEBUG, "One waitfor failed, trying another\n");
-				/* Try one more time in case of masq */
-			 	res = ast_waitfor(chan, 2000);
-				if (!res) {
-					ast_log(LOG_WARNING, "No audio available on %s??\n", chan->name);
-					res = -1;
-				}
-			}
-			
-			if (res < 0) {
-				f = NULL;
-=======
 	if (!prepend) {
 		for (x = 0; x < fmtcnt; x++) {
 			if (!others[x])
->>>>>>> .merge-right.r25411
 				break;
 			if (res > 0)
 				ast_stream_rewind(others[x], totalsilence ? totalsilence-200 : 200);
@@ -930,18 +720,11 @@
 	if (rfmt && ast_set_read_format(chan, rfmt)) {
 		ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
 	}
-<<<<<<< .working
-	if (outmsg > 1) {
-		/* Let them know it worked */
-		ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
-	}	
-=======
 	if (outmsg == 2) {
 		ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
 	}
 	if (sildet)
 		ast_dsp_free(sildet);
->>>>>>> .merge-right.r25411
 	return res;
 }
 

Modified: team/oej/codecnegotiation/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_dial.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_dial.c (original)
+++ team/oej/codecnegotiation/apps/app_dial.c Tue May 16 06:31:14 2006
@@ -453,7 +453,6 @@
 				char *tech;
 				int cause;
 
-<<<<<<< .working
 				ast_copy_string(tmpchan, c->call_forward, sizeof(tmpchan));
 				if ((stuff = strchr(tmpchan, '/'))) {
 					*stuff++ = '\0';
@@ -470,49 +469,7 @@
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
 					/* Setup parameters */
-					c = o->chan = ast_request_inherit(in, tech, stuff, &cause);
-					if (!c)
-						ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
-				} else {
-					if (option_verbose > 2)
-						ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", c->name);
-					cause = AST_CAUSE_CONGESTION;
-					c = o->chan = NULL;
-				}
-				if (!c) {
-					ast_clear_flag(o, DIAL_STILLGOING);	
-					HANDLE_CAUSE(cause, in);
-				} else {
-					ast_rtp_make_compatible(c, in);
-					if (c->cid.cid_num)
-						free(c->cid.cid_num);
-					c->cid.cid_num = NULL;
-					if (c->cid.cid_name)
-						free(c->cid.cid_name);
-					c->cid.cid_name = NULL;
-
-					if (ast_test_flag(o, OPT_FORCECLID)) {
-						c->cid.cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
-						ast_string_field_set(c, accountcode, winner->accountcode);
-						c->cdrflags = winner->cdrflags;
-=======
-				ast_copy_string(tmpchan, c->call_forward, sizeof(tmpchan));
-				if ((stuff = strchr(tmpchan, '/'))) {
-					*stuff++ = '\0';
-					tech = tmpchan;
-				} else {
-					const char *forward_context = pbx_builtin_getvar_helper(c, "FORWARD_CONTEXT");
-					snprintf(tmpchan, sizeof(tmpchan), "%s@%s", c->call_forward, forward_context ? forward_context : c->context);
-					stuff = tmpchan;
-					tech = "Local";
-				}
-				/* Before processing channel, go ahead and check for forwarding */
-				o->forwards++;
-				if (o->forwards < AST_MAX_FORWARDS) {
-					if (option_verbose > 2)
-						ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
-					/* Setup parameters */
-					c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
+					c = o->chan = ast_request_inherit(in tech, stuff, &cause);
 					if (!c)
 						ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
 				} else {
@@ -537,7 +494,6 @@
 						c->cid.cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
 						ast_string_field_set(c, accountcode, winner->accountcode);
 						c->cdrflags = winner->cdrflags;
->>>>>>> .merge-right.r25411
 					} else {
 						c->cid.cid_num = ast_strdup(in->cid.cid_num);
 						c->cid.cid_name = ast_strdup(in->cid.cid_name);

Modified: team/oej/codecnegotiation/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_directory.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_directory.c (original)
+++ team/oej/codecnegotiation/apps/app_directory.c Tue May 16 06:31:14 2006
@@ -178,17 +178,6 @@
 			ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
 			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
 		}
-<<<<<<< .working
-	} else if (ast_fileexists(fn2, NULL, chan->language) > 0) {
-		res = ast_stream_and_wait(chan, fn2, chan->language, AST_DIGIT_ANY);
-		ast_stopstream(chan);
-		/* If Option 'e' was specified, also read the extension number with the name */
-		if (readext) {
-			ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
-			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
-		}
-=======
->>>>>>> .merge-right.r25411
 	} else {
 		res = ast_say_character_str(chan, S_OR(name, ext), AST_DIGIT_ANY, chan->language);
 		if (!ast_strlen_zero(name) && readext) {

Modified: team/oej/codecnegotiation/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_dumpchan.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_dumpchan.c (original)
+++ team/oej/codecnegotiation/apps/app_dumpchan.c Tue May 16 06:31:14 2006
@@ -112,16 +112,10 @@
 			 c->_state,
 			 c->rings,
 			 c->nativeformats,
-			 c->writeformat,
-<<<<<<< .working
+			 ast_get_write_format(c),
 			 ast_get_read_format(c),
 			 c->fds[0], c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
 			 c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup,
-=======
-			 c->readformat,
-			 c->fds[0], c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
-			 c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup,
->>>>>>> .merge-right.r25411
 			 hour,
 			 min,
 			 sec,

Modified: team/oej/codecnegotiation/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channel.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channel.c (original)
+++ team/oej/codecnegotiation/channel.c Tue May 16 06:31:14 2006
@@ -2790,27 +2790,7 @@
 	if (ast_channel_make_compatible_helper(peer, chan) < 0) {
 	    rc = -1;
 	}
-<<<<<<< .working
 	return rc;
-=======
-
-	/* if the best path is not 'pass through', then
-	   transcoding is needed; if desired, force transcode path
-	   to use SLINEAR between channels, but only if there is
-	   no direct conversion available */
-	if ((src != dst) && ast_opt_transcode_via_slin &&
-	    (ast_translate_path_steps(dst, src) != 1))
-		dst = AST_FORMAT_SLINEAR;
-	if (ast_set_read_format(peer, dst) < 0) {
-		ast_log(LOG_WARNING, "Unable to set read format on channel %s to %d\n", peer->name, dst);
-		return -1;
-	}
-	if (ast_set_write_format(chan, dst) < 0) {
-		ast_log(LOG_WARNING, "Unable to set write format on channel %s to %d\n", chan->name, dst);
-		return -1;
-	}
-	return 0;
->>>>>>> .merge-right.r25411
 }
 
 int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)

Modified: team/oej/codecnegotiation/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_agent.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_agent.c (original)
+++ team/oej/codecnegotiation/channels/chan_agent.c Tue May 16 06:31:14 2006
@@ -902,8 +902,8 @@
 		tmp->tech = &agent_tech;
 		if (p->chan) {
 			tmp->nativeformats = p->chan->nativeformats;
-			tmp->writeformat = p->chan->writeformat;
-			tmp->rawwriteformat = p->chan->writeformat;
+			tmp->writeformat = ast_get_write_format(p->chan);
+			tmp->rawwriteformat = ast_get_write_format(p->chan);
 			tmp->readformat = ast_get_read_format(p->chan);
 			tmp->rawreadformat = ast_get_read_format(p->chan);
 			ast_string_field_set(tmp, language, p->chan->language);

Modified: team/oej/codecnegotiation/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_alsa.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_alsa.c (original)
+++ team/oej/codecnegotiation/channels/chan_alsa.c Tue May 16 06:31:14 2006
@@ -1045,11 +1045,7 @@
 	{ { "autoanswer", NULL }, console_autoanswer, "Sets/displays autoanswer", autoanswer_usage, autoanswer_complete }
 };
 
-<<<<<<< .working
-int load_module(void)
-=======
 static int load_module(void *mod)
->>>>>>> .merge-right.r25411
 {
 	int res;
 	int x;
@@ -1108,13 +1104,7 @@
 	return 0;
 }
 
-<<<<<<< .working
-
-
-int unload_module(void)
-=======
 static int unload_module(void *mod)
->>>>>>> .merge-right.r25411
 {
 	int x;
 	
@@ -1136,29 +1126,13 @@
 	return 0;
 }
 
-<<<<<<< .working
-const char *description(void)
-=======
 static const char *description(void)
->>>>>>> .merge-right.r25411
 {
 	return (char *) desc;
 }
 
-<<<<<<< .working
-int usecount(void)
-=======
 static const char *key(void)
->>>>>>> .merge-right.r25411
-{
-<<<<<<< .working
-	return usecnt;
-}
-
-const char *key(void)
-{
-=======
->>>>>>> .merge-right.r25411
+{
 	return ASTERISK_GPL_KEY;
 }
 

Modified: team/oej/codecnegotiation/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_features.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_features.c (original)
+++ team/oej/codecnegotiation/channels/chan_features.c Tue May 16 06:31:14 2006
@@ -190,10 +190,7 @@
 			p->subs[index].owner->alertpipe[1] = p->subchan->alertpipe[1];
 			if (p->subs[index].owner->nativeformats != ast_get_read_format(p->subchan)) {
 				p->subs[index].owner->nativeformats = ast_get_read_format(p->subchan);
-				if (ast_get_write_format(p->subs[index].owner))
-					ast_set_read_format(p->subs[index].owner, ast_get_read_format(p->subs[index].owner));
-				if (ast_get_write_format(p->subs[index].owner))
-					ast_set_write_format(p->subs[index].owner, ast_get_write_formats(p->subs[index].owner));
+				ast_channel_formats_reset(p->subs[index].owner);
 			}
 		} else{
 			restore_channel(p, index);

Modified: team/oej/codecnegotiation/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_mgcp.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_mgcp.c (original)
+++ team/oej/codecnegotiation/channels/chan_mgcp.c Tue May 16 06:31:14 2006
@@ -1225,8 +1225,7 @@
 			if (f->subclass != sub->owner->nativeformats) {
 				ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass);
 				sub->owner->nativeformats = f->subclass;
-				ast_set_read_format(sub->owner, ast_get_read_format(sub->owner));
-				ast_set_write_format(sub->owner, ast_get_write_format(sub->owner));
+				ast_channel_formats_reset(sub->owner);
 			}
 			/* Courtesy fearnor aka alex at pilosoft.com */
 			if ((sub->parent->dtmfmode & MGCP_DTMF_INBAND) && (sub->parent->dsp)) {

Modified: team/oej/codecnegotiation/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_misdn.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_misdn.c (original)
+++ team/oej/codecnegotiation/channels/chan_misdn.c Tue May 16 06:31:14 2006
@@ -3871,8 +3871,7 @@
 
 static int g_config_initialized=0;
 
-<<<<<<< .working
-int unload_module(void)
+static int unload_module(void *mod)
 {
 	/* First, take us out of the channel loop */
 	ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n");
@@ -3917,54 +3916,6 @@
 	return 0;
 }
 
-int load_module(void)
-=======
-static int unload_module(void *mod)
->>>>>>> .merge-right.r25411
-{
-	/* First, take us out of the channel loop */
-	ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n");
-	
-	if (!g_config_initialized) return 0;
-	
-	ast_cli_unregister(&cli_send_display);
-	
-	ast_cli_unregister(&cli_send_cd);
-	
-	ast_cli_unregister(&cli_send_digit);
-	ast_cli_unregister(&cli_toggle_echocancel);
-	ast_cli_unregister(&cli_set_tics);
-  
-	ast_cli_unregister(&cli_show_cls);
-	ast_cli_unregister(&cli_show_cl);
-	ast_cli_unregister(&cli_show_config);
-	ast_cli_unregister(&cli_show_port);
-	ast_cli_unregister(&cli_show_stacks);
-	ast_cli_unregister(&cli_restart_port);
-	ast_cli_unregister(&cli_port_up);
-	ast_cli_unregister(&cli_port_down);
-	ast_cli_unregister(&cli_set_debug);
-	ast_cli_unregister(&cli_set_crypt_debug);
-	ast_cli_unregister(&cli_reload);
-	/* ast_unregister_application("misdn_crypt"); */
-	ast_unregister_application("misdn_set_opt");
-	ast_unregister_application("misdn_facility");
-  
-	ast_channel_unregister(&misdn_tech);
-
-
-	free_robin_list();
-	misdn_cfg_destroy();
-	misdn_lib_destroy();
-  
-	if (misdn_debug)
-		free(misdn_debug);
-	if (misdn_debug_only)
-		free(misdn_debug_only);
-	
-	return 0;
-}
-
 static int load_module(void *mod)
 {
 	int i;
@@ -4072,13 +4023,8 @@
 
 
 
-<<<<<<< .working
-int reload(void)
-{
-=======
 static int reload(void *mod)
 {
->>>>>>> .merge-right.r25411
 	reload_config();
 
 	return 0;

Modified: team/oej/codecnegotiation/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_sip.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_sip.c (original)
+++ team/oej/codecnegotiation/channels/chan_sip.c Tue May 16 06:31:14 2006
@@ -5915,16 +5915,10 @@
 }
 
 /*! \brief Allocate SIP refer structure */
-<<<<<<< .working
-int sip_refer_allocate(struct sip_pvt *p) {
+static int sip_refer_allocate(struct sip_pvt *p)
+{
 	p->refer = ast_calloc(1, sizeof(struct sip_refer)); 
 	return p->refer ? 1 : 0;
-=======
-static int sip_refer_allocate(struct sip_pvt *p)
-{
-	p->refer = ast_calloc(1, sizeof(struct sip_refer)); 
-	return p->refer ? 1 : 0;
->>>>>>> .merge-right.r25411
 }
 
 /*! \brief Transmit SIP REFER message */
@@ -10726,17 +10720,10 @@
 	ast_string_field_build(transferee, name,  "Parking/%s", chan1->name);
 
 	/* Make formats okay */
-<<<<<<< .working
 	transferee->readformat = ast_get_read_format(chan1);
-	transferee->writeformat = chan1->writeformat;
+	transferee->writeformat = ast_get_write_format(chan1);
 	ast_channel_masquerade(transferee, chan1);
 
-=======
-	transferee->readformat = chan1->readformat;
-	transferee->writeformat = chan1->writeformat;
-	ast_channel_masquerade(transferee, chan1);
-
->>>>>>> .merge-right.r25411
 	/* Setup the extensions and such */
 	ast_copy_string(transferee->context, chan1->context, sizeof(transferee->context));
 	ast_copy_string(transferee->exten, chan1->exten, sizeof(transferee->exten));
@@ -10747,17 +10734,10 @@
 	ast_string_field_build(transferer, name, "SIPPeer/%s", chan2->name);
 
 	/* Make formats okay */
-<<<<<<< .working
 	transferer->readformat = ast_get_read_format(chan2);
-	transferer->writeformat = chan2->writeformat;
+	transferer->writeformat = ast_get_write_format(chan2);
 	ast_channel_masquerade(transferer, chan2);
 
-=======
-	transferer->readformat = chan2->readformat;
-	transferer->writeformat = chan2->writeformat;
-	ast_channel_masquerade(transferer, chan2);
-
->>>>>>> .merge-right.r25411
 	/* Setup the extensions and such */
 	ast_copy_string(transferer->context, chan2->context, sizeof(transferer->context));
 	ast_copy_string(transferer->exten, chan2->exten, sizeof(transferer->exten));
@@ -10890,11 +10870,7 @@
 			*sep = '\0';
 		return tagbuf;
 	}
-<<<<<<< .working
-	return tagbuf;
-=======
 	return NULL;
->>>>>>> .merge-right.r25411
 }
 
 /*! \brief Handle incoming notifications */
@@ -11977,16 +11953,10 @@
 }
 
 /*! \brief Read data from SIP socket
-<<<<<<< .working
-\return 1 on error, 0 on success
-\note Successful messages is connected to SIP call and forwarded to handle_request() 
-*/
-=======
 \note sipsock_read locks the owner channel while we are processing the SIP message
 \return 1 on error, 0 on success
 \note Successful messages is connected to SIP call and forwarded to handle_request() 
 */
->>>>>>> .merge-right.r25411
 static int sipsock_read(int *id, int fd, short events, void *ignore)
 {
 	struct sip_request req;

Modified: team/oej/codecnegotiation/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_skinny.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_skinny.c (original)
+++ team/oej/codecnegotiation/channels/chan_skinny.c Tue May 16 06:31:14 2006
@@ -2056,8 +2056,7 @@
 			if (f->subclass != sub->owner->nativeformats) {
 				ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass);
 				sub->owner->nativeformats = f->subclass;
-				ast_set_read_format(sub->owner, ast_get_read_format(sub->owner));
-				ast_set_write_format(sub->owner, ast_get_write_format(sub->owner));
+				ast_channel_formats_reset(sub->owner);
 			}
 		}
 	}

Modified: team/oej/codecnegotiation/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_zap.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_zap.c (original)
+++ team/oej/codecnegotiation/channels/chan_zap.c Tue May 16 06:31:14 2006
@@ -7367,20 +7367,7 @@
 				return 1;
 		}
 #endif
-<<<<<<< .working
-#ifdef ZAPATA_R2
-		/* Trust R2 as well */
-		if (p->r2) {
-			if (p->hasr2call || p->r2blocked)
-				return 0;
-			else
-				return 1;
-		}
-#endif
 		if (!(p->radio || (p->oprmode < 0)))
-=======
-		if (!(p->radio || (p->oprmode < 0)))
->>>>>>> .merge-right.r25411
 		{
 			if (!p->sig || (p->sig == SIG_FXSLS))
 				return 1;

Modified: team/oej/codecnegotiation/cli.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/cli.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/cli.c (original)
+++ team/oej/codecnegotiation/cli.c Tue May 16 06:31:14 2006
@@ -736,21 +736,12 @@
 		S_OR(c->cid.cid_name, "(N/A)"),
 		S_OR(c->cid.cid_dnid, "(N/A)"), ast_state2str(c->_state), c->_state, c->rings, 
 		ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats), 
-<<<<<<< .working
 		ast_getformatname_multiple(wf, sizeof(wf), ast_get_write_format(c)), 
 		ast_getformatname_multiple(rf, sizeof(rf), ast_get_read_format(c)),
 		c->fds[0],
 		c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
 		c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
 		(long)c->whentohangup,
-=======
-		ast_getformatname_multiple(wf, sizeof(wf), c->writeformat), 
-		ast_getformatname_multiple(rf, sizeof(rf), c->readformat),
-		c->fds[0],
-		c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
-		c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
-		(long)c->whentohangup,
->>>>>>> .merge-right.r25411
 		cdrtime, c->_bridge ? c->_bridge->name : "<none>", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
 		c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
 		( c-> data ? S_OR(c->data, "(Empty)") : "(None)"),

Modified: team/oej/codecnegotiation/file.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/file.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/file.c (original)
+++ team/oej/codecnegotiation/file.c Tue May 16 06:31:14 2006
@@ -391,7 +391,7 @@
 				FILE *bfile;
 				struct ast_filestream *s;
 
-				if ( !(chan->writeformat & f->format) &&
+				if ( !(ast_get_write_format(chan) & f->format) &&
 				     !(f->format >= AST_FORMAT_MAX_AUDIO && fmt)) {
 					free(fn);
 					continue;	/* not a supported format */
@@ -807,7 +807,7 @@
 #endif
 		return 0;
 	}
-	ast_log(LOG_WARNING, "Unable to open %s (format %s): %s\n", filename, ast_getformatname_multiple(fmt, sizeof(fmt), chan->nativeformats), strerror(errno));
+	ast_log(LOG_WARNING, "Unable to open %s (format %s): %s\n", filename, ast_chan_getformatname_multiple(fmt, sizeof(fmt), chan), strerror(errno));
 	return -1;
 }
 

Modified: team/oej/codecnegotiation/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/funcs/func_odbc.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/funcs/func_odbc.c (original)
+++ team/oej/codecnegotiation/funcs/func_odbc.c Tue May 16 06:31:14 2006
@@ -109,13 +109,8 @@
 	obj = odbc_request_obj(query->dsn, 0);
 
 	if (!obj) {
-<<<<<<< .working
-		ast_log(LOG_ERROR, "No such DSN registered (or out of connections): %s (check res_odbc.conf)\n", query->dsn);
-		ast_mutex_unlock(&query_lock);
-=======
 		ast_log(LOG_ERROR, "No such DSN registered (or out of connections): %s (check res_odbc.conf)\n", query->dsn);
 		AST_LIST_UNLOCK(&queries);
->>>>>>> .merge-right.r25411
 		return -1;
 	}
 
@@ -270,13 +265,8 @@
 	obj = odbc_request_obj(query->dsn, 0);
 
 	if (!obj) {
-<<<<<<< .working
-		ast_log(LOG_ERROR, "No such DSN registered (or out of connections): %s (check res_odbc.conf)\n", query->dsn);
-		ast_mutex_unlock(&query_lock);
-=======
 		ast_log(LOG_ERROR, "No such DSN registered (or out of connections): %s (check res_odbc.conf)\n", query->dsn);
 		AST_LIST_UNLOCK(&queries);
->>>>>>> .merge-right.r25411
 		return -1;
 	}
 
@@ -343,13 +333,8 @@
 		goto acf_out;
 	}
 
-<<<<<<< .working
-	for (x = 0; x < colcount; x++) {
-		int buflen, coldatalen;
-=======
 	for (x = 0; x < colcount; x++) {
 		int i;
->>>>>>> .merge-right.r25411
 		char coldata[256];
 
 		buflen = strlen(buf);

Modified: team/oej/codecnegotiation/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/include/asterisk/channel.h?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/include/asterisk/channel.h (original)
+++ team/oej/codecnegotiation/include/asterisk/channel.h Tue May 16 06:31:14 2006
@@ -325,7 +325,8 @@
 	time_t	whentohangup;
 	/*! If anyone is blocking, this is them */
 	pthread_t blocker;			
-	/*! Lock, can be used to lock a channel for some operations */
+	/*! Lock, can be used to lock a channel for some operations... Do not
+	    use this directly, use ast_channel_lock/ast_channel_unlock */
 	ast_mutex_t lock;			
 	/*! Procedure causing blocking */
 	const char *blockproc;			
@@ -1088,22 +1089,46 @@
  */
 static inline int ast_channel_best_codec(struct ast_channel *channel)
 {
+#ifndef BUG_4825 
 	return ast_best_codec(channel->nativeformats);
+#else	
+	return ast_best_codec(channel->nativeformats.audio_bits);
+#endif	
 }
+/*! \brief Get the names of a set of formats
+ * \param buf a buffer for the output string
+ * \param size size of buf (bytes)
+ * \param channel the channel
+ * Prints a list of readable codec names corresponding to "format".
+ * ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602 (GSM|SPEEX|ILBC)"
+ * \return The return value is buf.
+ */
+inline static char * ast_chan_getformatname_multiple(char *buf, size_t size, struct ast_channel *chan)
+{
+	return ast_getformatname_multiple(buf, size, chan->nativeformats);
+}
+
 
 static inline char * ast_chan_getformatname(struct ast_channel *chan)
 {
+#ifndef BUG_4825 
 	return ast_getformatname(chan? chan->nativeformats: 0);
+#else	
+	return ast_getformatname(chan? chan->nativeformats.audio_bits: 0);
+#endif	
 }
 
 static inline void ast_channel_formats_reset(struct ast_channel *channel)
 {
 	int r, w;
+	ast_log(LOG_DEBUG, "Resetting read to %d and write to %d on channel %s\n", r, w, channel->name);
 	r = ast_get_read_format(channel);
+	if( r )
+		ast_set_read_format(channel, r);
+
 	w = ast_get_read_format(channel);
-	ast_log(LOG_DEBUG, "Resetting read to %d and write to %d on channel %s\n", r, w, channel->name);
-	ast_set_read_format(channel, r);
-	ast_set_write_format(channel, w);
+	if( w )
+		ast_set_write_format(channel, w);
 }
 
 /*!
@@ -1387,3 +1412,4 @@
 #endif
 
 #endif /* _ASTERISK_CHANNEL_H */
+

Modified: team/oej/codecnegotiation/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/pbx.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/pbx.c (original)
+++ team/oej/codecnegotiation/pbx.c Tue May 16 06:31:14 2006
@@ -5476,17 +5476,10 @@
 {
 	if (ast_strlen_zero(condition))	/* NULL or empty strings are false */
 		return 0;
-<<<<<<< .working
-	else if (*condition >= '0' && *condition <= '9')	/* Numbers are evaluated for truth */
-		return atoi(condition);
-	else	/* Strings are true -- XXX maybe use ast_true() ? */
-		return 1;
-=======
 	else if (*condition >= '0' && *condition <= '9')	/* Numbers are evaluated for truth */
 		return atoi(condition);
 	else	/* Strings are true */
 		return 1;
->>>>>>> .merge-right.r25411
 }
 
 static int pbx_builtin_gotoif(struct ast_channel *chan, void *data)

Modified: team/oej/codecnegotiation/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/res/res_features.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/res/res_features.c (original)
+++ team/oej/codecnegotiation/res/res_features.c Tue May 16 06:31:14 2006
@@ -174,28 +174,6 @@
 	char *x, *goto_on_transfer;
 	struct ast_frame *f;
 
-<<<<<<< .working
-	if (!ast_strlen_zero(val) && (goto_on_transfer = ast_strdupa(val)) && (xferchan = ast_channel_alloc(0))) {
-		for (x = goto_on_transfer; x && *x; x++)
-			if (*x == '^')
-				*x = '|';
-		ast_string_field_set(xferchan, name, chan->name);
-		/* Make formats okay */
-		xferchan->readformat = ast_get_read_format(chan);
-		xferchan->writeformat = ast_get_write_format(chan);
-		ast_channel_masquerade(xferchan, chan);
-		ast_parseable_goto(xferchan, goto_on_transfer);
-		xferchan->_state = AST_STATE_UP;
-		ast_clear_flag(xferchan, AST_FLAGS_ALL);	
-		xferchan->_softhangup = 0;
-		if ((f = ast_read(xferchan))) {
-			ast_frfree(f);
-			f = NULL;
-			ast_pbx_start(xferchan);
-		} else {
-			ast_hangup(xferchan);
-		}
-=======
 	if (ast_strlen_zero(val))
 		return;
 
@@ -207,7 +185,6 @@
 	for (x = goto_on_transfer; x && *x; x++) {
 		if (*x == '^')
 			*x = '|';
->>>>>>> .merge-right.r27270
 	}
 	ast_string_field_set(xferchan, name, chan->name);
 	/* Make formats okay */
@@ -711,7 +688,6 @@
 		return FEATURE_RETURN_SUCCESS;
 	}
 
-<<<<<<< .working
 	l = strlen(xferto);
 	snprintf(xferto + l, sizeof(xferto) - l, "@%s/n", transferer_real_context);	/* append context */
 	newchan = ast_feature_request_and_dial(transferer, "Local", ast_channel_best_codec(transferer),
@@ -725,21 +701,6 @@
 			return -1;
 		return FEATURE_RETURN_SUCCESS;
 	}
-=======
-	l = strlen(xferto);
-	snprintf(xferto + l, sizeof(xferto) - l, "@%s/n", transferer_real_context);	/* append context */
-	newchan = ast_feature_request_and_dial(transferer, "Local", ast_best_codec(transferer->nativeformats),
-		xferto, 15000, &outstate, transferer->cid.cid_num, transferer->cid.cid_name);
-	ast_indicate(transferer, -1);
-	if (!newchan) {
-		finishup(transferee);
-		/* any reason besides user requested cancel and busy triggers the failed sound */
-		if (outstate != AST_CONTROL_UNHOLD && outstate != AST_CONTROL_BUSY &&
-				ast_stream_and_wait(transferer, xferfailsound, transferer->language, ""))
-			return -1;
-		return FEATURE_RETURN_SUCCESS;
-	}
->>>>>>> .merge-right.r25411
 
 	if (check_compat(transferer, newchan))
 		return -1;

Modified: team/oej/codecnegotiation/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/res/res_musiconhold.c?rev=27303&r1=27302&r2=27303&view=diff
==============================================================================
--- team/oej/codecnegotiation/res/res_musiconhold.c (original)
+++ team/oej/codecnegotiation/res/res_musiconhold.c Tue May 16 06:31:14 2006
@@ -174,14 +174,7 @@
 		pthread_cancel((*class)->thread);
 		(*class)->thread = 0;
 	}
-<<<<<<< .working
-	if ((*class)->thread) {
-		pthread_cancel((*class)->thread);
-		(*class)->thread = 0;
-	}
-=======
-
->>>>>>> .merge-right.r25411
+
 	free(*class);
 	*class = NULL;
 }
@@ -546,16 +539,9 @@
 				ast_log(LOG_DEBUG, "Read %d bytes of audio while expecting %d\n", res2, len);
 			continue;
 		}
-<<<<<<< .working
-		pthread_testcancel();
-		ast_mutex_lock(&moh_lock);
-		moh = class->members;
-		while (moh) {
-=======
 		pthread_testcancel();
 		AST_LIST_LOCK(&mohclasses);
 		AST_LIST_TRAVERSE(&class->members, moh, list) {
->>>>>>> .merge-right.r25411
 			/* Write data */
 			if ((res = write(moh->pipe[1], sbuf, res2)) != res2) {
 				if (option_debug)



More information about the asterisk-commits mailing list