[asterisk-commits] irroot: trunk r337432 - in /trunk: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 22 01:39:07 CDT 2011


Author: irroot
Date: Thu Sep 22 01:39:01 2011
New Revision: 337432

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=337432
Log:
Merged revisions 337431 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r337431 | irroot | 2011-09-22 08:29:09 +0200 (Thu, 22 Sep 2011) | 25 lines
  
  Merged revisions 337430 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r337430 | irroot | 2011-09-22 08:18:33 +0200 (Thu, 22 Sep 2011) | 19 lines
    
    Its possible to loose audio on ast_write when the channel is not transcoded correctly.
    in the case of DAHDI the channel is hungup.
    
    This patch tries to "fix" the problem and make the channel compatiable and warn the user of
    this problem.
    
    Please note there is a underlying problem with codec negotion this does not fix the problem
    it does try to rectify it and prevent loss of service.
    
    Review: https://reviewboard.asterisk.org/r/1442/
    
    (closes issue ASTERISK-17541)
    (closes issue ASTERISK-18063)
    (issue ASTERISK-14384)
    (issue ASTERISK-17502)
    (issue ASTERISK-18325)
    (issue ASTERISK-18422)
  ........
................

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=337432&r1=337431&r2=337432
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu Sep 22 01:39:01 2011
@@ -4969,10 +4969,26 @@
 		}
 
 		/* If the frame is in the raw write format, then it's easy... just use the frame - otherwise we will have to translate */
-		if (ast_format_cmp(&fr->subclass.format, &chan->rawwriteformat) != AST_FORMAT_CMP_NOT_EQUAL)
+		if (ast_format_cmp(&fr->subclass.format, &chan->rawwriteformat) != AST_FORMAT_CMP_NOT_EQUAL) {
 			f = fr;
-		else
+		} else {
+			/* XXX Something is not right we are not compatible with this frame bad things can happen
+			 * problems range from no/one-way audio to unexplained line hangups as a last resort try adjust the format
+			 * ideally we do not want to do this and this indicates a deeper problem for now we log these events to
+			 * eliminate user impact and help identify the problem areas
+			 * JIRA issues related to this :-
+			 * ASTERISK-14384, ASTERISK-17502, ASTERISK-17541, ASTERISK-18063, ASTERISK-18325, ASTERISK-18422*/
+			if ((!ast_format_cap_iscompatible(chan->nativeformats, &fr->subclass.format)) &&
+			    (ast_format_cmp(&chan->writeformat, &fr->subclass.format) != AST_FORMAT_CMP_EQUAL)) {
+				char nf[512];
+				ast_log(LOG_WARNING, "Codec mismatch on channel %s setting write format to %s from %s native formats %s\n",
+					chan->name, ast_getformatname(&fr->subclass.format), ast_getformatname(&chan->writeformat),
+					ast_getformatname_multiple(nf, sizeof(nf), chan->nativeformats));
+				ast_set_write_format_by_id(chan, fr->subclass.format.id);
+			}
+
 			f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr;
+		}
 
 		if (!f) {
 			res = 0;




More information about the asterisk-commits mailing list