[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r326055 - /team/irroot/distrot...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 1 11:09:49 CDT 2011


Author: irroot
Date: Fri Jul  1 11:09:46 2011
New Revision: 326055

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=326055
Log:
Allow chan_local to change formats when the proxied channel changes

Modified:
    team/irroot/distrotech-customers-1.8/channels/chan_local.c

Modified: team/irroot/distrotech-customers-1.8/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/channels/chan_local.c?view=diff&rev=326055&r1=326054&r2=326055
==============================================================================
--- team/irroot/distrotech-customers-1.8/channels/chan_local.c (original)
+++ team/irroot/distrotech-customers-1.8/channels/chan_local.c Fri Jul  1 11:09:46 2011
@@ -584,6 +584,7 @@
 static int local_write(struct ast_channel *ast, struct ast_frame *f)
 {
 	struct local_pvt *p = ast->tech_pvt;
+	struct ast_channel *bridge;
 	int res = -1;
 	int isoutbound;
 
@@ -598,6 +599,20 @@
 
 	if (isoutbound && f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO)) {
 		check_bridge(p);
+	} else if (!isoutbound) {
+		/* fixup formats nativeformat has changed we must adjust
+		 * ast is p->owner and is locked here*/
+		bridge = ast_bridged_channel(ast);
+		if (bridge && !(bridge->nativeformats & ast->nativeformats)) {
+			ast->nativeformats = bridge->nativeformats;
+			ast_set_read_format(ast, ast->readformat);
+			ast_set_write_format(ast, ast->writeformat);
+			ast_channel_lock(p->chan);
+			p->chan->nativeformats = bridge->nativeformats;
+			ast_set_read_format(p->chan, p->chan->readformat);
+			ast_set_write_format(p->chan, p->chan->writeformat);
+			ast_channel_unlock(p->chan);
+		}
 	}
 
 	if (!ast_test_flag(p, LOCAL_ALREADY_MASQED)) {




More information about the asterisk-commits mailing list