[asterisk-commits] jpeeler: branch 1.6.1 r189996 - in /branches/1.6.1: ./ channels/ channels/h323/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 22 14:41:16 CDT 2009


Author: jpeeler
Date: Wed Apr 22 14:41:10 2009
New Revision: 189996

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=189996
Log:
Merged revisions 189993 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r189993 | jpeeler | 2009-04-22 14:23:49 -0500 (Wed, 22 Apr 2009) | 18 lines
  
  Make chan_h323 respect packetization settings
  
  Previously, packetization settings were ignored and now they are not. A new
  config option 'autoframing' has been added to mirror the way chan_sip handles
  it. Turning on the autoframing option (available both as a global option or per
  peer) overrides the local settings with the remote packetization settings.
  Testing was performed with varying packetization levels with the following
  codecs: ulaw, alaw, gsm, and g729.
  
  (closes issue #12415)
  Reported by: pj
  Patches:
        2009012200_h323packetization.diff.txt uploaded by mvanbaak (license 7), 
        modified by me
........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/channels/chan_h323.c
    branches/1.6.1/channels/h323/ast_h323.cxx
    branches/1.6.1/channels/h323/chan_h323.h

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/channels/chan_h323.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/channels/chan_h323.c?view=diff&rev=189996&r1=189995&r2=189996
==============================================================================
--- branches/1.6.1/channels/chan_h323.c (original)
+++ branches/1.6.1/channels/chan_h323.c Wed Apr 22 14:41:10 2009
@@ -1251,6 +1251,8 @@
 
 	if (!strcasecmp(v->name, "allow")) {
 		ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 1);
+	} else if (!strcasecmp(v->name, "autoframing")) {
+		options->autoframing = ast_true(v->value);
 	} else if (!strcasecmp(v->name, "disallow")) {
 		ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 0);
 	} else if (!strcasecmp(v->name, "dtmfmode")) {
@@ -2460,8 +2462,15 @@
 				ast_debug(1, "prefs[%d]=%s:%d\n", i, (prefs->order[i] ? ast_getformatname(1 << (prefs->order[i]-1)) : "<none>"), prefs->framing[i]);
 			}
 		}
-		if (pvt->rtp)
-			ast_rtp_codec_setpref(pvt->rtp, &pvt->peer_prefs);
+		if (pvt->rtp) {
+			if (pvt->options.autoframing) {
+				ast_debug(2, "Autoframing option set, using peer's packetization settings\n");
+				ast_rtp_codec_setpref(pvt->rtp, &pvt->peer_prefs);
+			} else {
+				ast_debug(2, "Autoframing option not set, ignoring peer's packetization settings\n");
+				ast_rtp_codec_setpref(pvt->rtp, &pvt->options.prefs);
+			}
+		}
 	}
 	ast_mutex_unlock(&pvt->lock);
 }
@@ -2485,8 +2494,15 @@
 	ast_mutex_unlock(&pvt->lock);
 	h323_set_capabilities(token, capability, dtmfmode, &prefs, pref_codec);
 
-	if (h323debug)
+	if (h323debug) {
+		int i;
+		for (i = 0; i < 32; i++) {
+			if (!prefs.order[i])
+				break;
+			ast_debug(1, "local prefs[%d]=%s:%d\n", i, (prefs.order[i] ? ast_getformatname(1 << (prefs.order[i]-1)) : "<none>"), prefs.framing[i]);
+		}
 		ast_debug(1, "Capabilities for connection %s is set\n", token);
+	}
 }
 
 static void remote_hold(unsigned call_reference, const char *token, int is_hold)
@@ -2870,6 +2886,7 @@
 	global_options.holdHandling = 0;
 	global_options.capability = GLOBAL_CAPABILITY;
 	global_options.bridge = 1;		/* Do native bridging by default */
+	global_options.autoframing = 0;
 	strcpy(default_context, "default");
 	h323_signalling_port = 1720;
 	gatekeeper_disable = 1;

Modified: branches/1.6.1/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/channels/h323/ast_h323.cxx?view=diff&rev=189996&r1=189995&r2=189996
==============================================================================
--- branches/1.6.1/channels/h323/ast_h323.cxx (original)
+++ branches/1.6.1/channels/h323/ast_h323.cxx Wed Apr 22 14:41:10 2009
@@ -1772,8 +1772,6 @@
 						format = ast_codec_pref_getsize(&prefs, ast_codec);
 						if ((ast_codec == AST_FORMAT_ALAW) || (ast_codec == AST_FORMAT_ULAW)) {
 							ms = remoteCapabilities[i].GetTxFramesInPacket();
-							if (ms > 60)
-								ms = format.cur_ms;
 						} else
 							ms = remoteCapabilities[i].GetTxFramesInPacket() * format.inc_ms;
 						ast_codec_pref_setsize(&prefs, ast_codec, ms);
@@ -1899,7 +1897,6 @@
 	struct ast_codec_pref *prefs = (struct ast_codec_pref *)_prefs;
 	struct ast_format_list format;
 	int frames_per_packet;
-	int max_frames_per_packet;
 	H323Capability *cap;
 
 	localCapabilities.RemoveAll();
@@ -1924,9 +1921,9 @@
 		if (!(caps & codec) || (alreadysent & codec) || !(codec & AST_FORMAT_AUDIO_MASK))
 			continue;
 		alreadysent |= codec;
+		/* format.cur_ms will be set to default if packetization is not explicitly set */
 		format = ast_codec_pref_getsize(prefs, codec);
 		frames_per_packet = (format.inc_ms ? format.cur_ms / format.inc_ms : format.cur_ms);
-		max_frames_per_packet = (format.inc_ms ? format.max_ms / format.inc_ms : 0);
 		switch(codec) {
 #if 0
 		case AST_FORMAT_SPEEX:
@@ -1946,43 +1943,35 @@
 			AST_G729Capability *g729Cap;
 			lastcap = localCapabilities.SetCapability(0, 0, g729aCap = new AST_G729ACapability(frames_per_packet));
 			lastcap = localCapabilities.SetCapability(0, 0, g729Cap = new AST_G729Capability(frames_per_packet));
-			if (max_frames_per_packet) {
-				g729aCap->SetTxFramesInPacket(max_frames_per_packet);
-				g729Cap->SetTxFramesInPacket(max_frames_per_packet);
-			}
+			g729aCap->SetTxFramesInPacket(format.cur_ms);
+			g729Cap->SetTxFramesInPacket(format.cur_ms);
 			break;
 		case AST_FORMAT_G723_1:
 			AST_G7231Capability *g7231Cap;
 			lastcap = localCapabilities.SetCapability(0, 0, g7231Cap = new AST_G7231Capability(frames_per_packet, TRUE));
-			if (max_frames_per_packet)
-				g7231Cap->SetTxFramesInPacket(max_frames_per_packet);
+			g7231Cap->SetTxFramesInPacket(format.cur_ms);
 			lastcap = localCapabilities.SetCapability(0, 0, g7231Cap = new AST_G7231Capability(frames_per_packet, FALSE));
-			if (max_frames_per_packet)
-				g7231Cap->SetTxFramesInPacket(max_frames_per_packet);
+			g7231Cap->SetTxFramesInPacket(format.cur_ms);
 			break;
 		case AST_FORMAT_GSM:
 			AST_GSM0610Capability *gsmCap;
 			lastcap = localCapabilities.SetCapability(0, 0, gsmCap = new AST_GSM0610Capability(frames_per_packet));
-			if (max_frames_per_packet)
-				gsmCap->SetTxFramesInPacket(max_frames_per_packet);
+			gsmCap->SetTxFramesInPacket(format.cur_ms);
 			break;
 		case AST_FORMAT_ULAW:
 			AST_G711Capability *g711uCap;
 			lastcap = localCapabilities.SetCapability(0, 0, g711uCap = new AST_G711Capability(format.cur_ms, H323_G711Capability::muLaw));
-			if (format.max_ms)
-				g711uCap->SetTxFramesInPacket(format.max_ms);
+			g711uCap->SetTxFramesInPacket(format.cur_ms);
 			break;
 		case AST_FORMAT_ALAW:
 			AST_G711Capability *g711aCap;
 			lastcap = localCapabilities.SetCapability(0, 0, g711aCap = new AST_G711Capability(format.cur_ms, H323_G711Capability::ALaw));
-			if (format.max_ms)
-				g711aCap->SetTxFramesInPacket(format.max_ms);
+			g711aCap->SetTxFramesInPacket(format.cur_ms);
 			break;
 		case AST_FORMAT_G726_AAL2:
 			AST_CiscoG726Capability *g726Cap;
 			lastcap = localCapabilities.SetCapability(0, 0, g726Cap = new AST_CiscoG726Capability(frames_per_packet));
-			if (max_frames_per_packet)
-				g726Cap->SetTxFramesInPacket(max_frames_per_packet);
+			g726Cap->SetTxFramesInPacket(format.cur_ms);
 			break;
 		default:
 			alreadysent &= ~codec;

Modified: branches/1.6.1/channels/h323/chan_h323.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/channels/h323/chan_h323.h?view=diff&rev=189996&r1=189995&r2=189996
==============================================================================
--- branches/1.6.1/channels/h323/chan_h323.h (original)
+++ branches/1.6.1/channels/h323/chan_h323.h Wed Apr 22 14:41:10 2009
@@ -69,6 +69,7 @@
 	int				nat;
 	int				tunnelOptions;
 	int				holdHandling;
+	int				autoframing; /*!< turn on to override local settings with remote framing length */
 	struct ast_codec_pref	prefs;
 } call_options_t;
 




More information about the asterisk-commits mailing list