mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk. The code present in this patch is everything required to complete phase1 of my Media Architecture proposal. For more information about this project visit the link below. https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal The primary function of this patch is to convert all the usages of format bitfields in Asterisk to use the new format and format_cap APIs. Functionally no change in behavior should be present in this patch. Thanks to twilson and russell for all the time they spent reviewing these changes. Review: https://reviewboard.asterisk.org/r/1083/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -148,7 +148,8 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) | ||||
| 	int res = 0; | ||||
| 	struct ast_frame *f = NULL; | ||||
| 	struct ast_dsp *silenceDetector = NULL; | ||||
| 	int dspsilence = 0, readFormat, framelength = 0; | ||||
| 	int dspsilence = 0, framelength = 0; | ||||
| 	struct ast_format readFormat; | ||||
| 	int inInitialSilence = 1; | ||||
| 	int inGreeting = 0; | ||||
| 	int voiceDuration = 0; | ||||
| @@ -188,10 +189,11 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) | ||||
| 		AST_APP_ARG(argMaximumWordLength); | ||||
| 	); | ||||
|  | ||||
| 	ast_format_clear(&readFormat); | ||||
| 	ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name, | ||||
| 		S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, "(N/A)"), | ||||
| 		S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "(N/A)"), | ||||
| 		ast_getformatname(chan->readformat)); | ||||
| 		ast_getformatname(&chan->readformat)); | ||||
|  | ||||
| 	/* Lets parse the arguments. */ | ||||
| 	if (!ast_strlen_zero(parse)) { | ||||
| @@ -240,8 +242,8 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) | ||||
| 				minimumWordLength, betweenWordsSilence, maximumNumberOfWords, silenceThreshold, maximumWordLength); | ||||
|  | ||||
| 	/* Set read format to signed linear so we get signed linear frames in */ | ||||
| 	readFormat = chan->readformat; | ||||
| 	if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0 ) { | ||||
| 	ast_format_copy(&readFormat, &chan->readformat); | ||||
| 	if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0 ) { | ||||
| 		ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to set to linear mode, giving up\n", chan->name ); | ||||
| 		pbx_builtin_setvar_helper(chan , "AMDSTATUS", ""); | ||||
| 		pbx_builtin_setvar_helper(chan , "AMDCAUSE", ""); | ||||
| @@ -399,7 +401,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) | ||||
| 	pbx_builtin_setvar_helper(chan , "AMDCAUSE" , amdCause); | ||||
|  | ||||
| 	/* Restore channel read format */ | ||||
| 	if (readFormat && ast_set_read_format(chan, readFormat)) | ||||
| 	if (readFormat.id && ast_set_read_format(chan, &readFormat)) | ||||
| 		ast_log(LOG_WARNING, "AMD: Unable to restore read format on '%s'\n", chan->name); | ||||
|  | ||||
| 	/* Free the DSP used to detect silence */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user