Index: channels/chan_h323.c
===================================================================
--- channels/chan_h323.c	(revision 31249)
+++ channels/chan_h323.c	(working copy)
@@ -105,6 +105,16 @@
 /* global debug flag */
 int h323debug;
 
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
+
 /** Variables required by Asterisk */
 static const char desc[] = "The NuFone Network's Open H.323 Channel Driver";
 static const char tdesc[] = "The NuFone Network's Open H.323 Channel Driver";
@@ -155,6 +165,7 @@
 	int hangupcause;					/* Hangup cause from OpenH323 layer */
 	int newstate;						/* Pending state change */
 	int newcontrol;						/* Pending control to send */
+	struct ast_jb_conf jbconf;
 	struct oh323_pvt *next;				/* Next channel in list */
 } *iflist = NULL;
 
@@ -788,6 +799,10 @@
 				ch = NULL;
 			}
 		}
+
+		/* Configure the new channel jb */
+		if (ch && pvt && pvt->rtp)
+			ast_jb_configure(ch, &pvt->jbconf);
 	} else  {
 		ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
 	}
@@ -830,6 +845,10 @@
 	}
 	strncpy(pvt->context, default_context, sizeof(pvt->context) - 1);
 	pvt->newstate = pvt->newcontrol = -1;
+
+	/* Assign default jb conf to the new oh323_pvt */
+	memcpy(&pvt->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
+
 	/* Add to interface list */
 	ast_mutex_lock(&iflock);
 	pvt->next = iflist;
@@ -2020,8 +2039,18 @@
 	global_options.dtmfmode = H323_DTMF_RFC2833;
 	global_options.capability = GLOBAL_CAPABILITY;
 	global_options.bridge = 1;		/* Do native bridging by default */
+
+	/* Copy the default jb config over global_jbconf */
+	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
 	v = ast_variable_browse(cfg, "general");
 	while(v) {
+		/* handle jb conf */
+                if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
+			v = v->next;
+                        continue;
+		}
+
 		/* Create the interface list */
 		if (!strcasecmp(v->name, "port")) {
 			h323_signalling_port = (int)strtol(v->value, NULL, 10);
Index: channels/chan_mgcp.c
===================================================================
--- channels/chan_mgcp.c	(revision 31249)
+++ channels/chan_mgcp.c	(working copy)
@@ -117,6 +117,7 @@
 #include "asterisk/dsp.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
 
 #ifndef IPTOS_MINCOST
 #define IPTOS_MINCOST 0x02
@@ -137,6 +138,16 @@
 #define INADDR_NONE (in_addr_t)(-1)
 #endif
 
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
+
 static const char tdesc[] = "Media Gateway Control Protocol (MGCP)";
 static const char config[] = "mgcp.conf";
 
@@ -364,6 +375,8 @@
 	int iseq; /* Not used? RTP? */
 	int outgoing;
 	int alreadygone;
+	struct ast_jb_conf jbconf;
+
 /* SC: obsolete
 	int messagepending;
 	struct mgcp_message *msgs;
@@ -1499,6 +1512,10 @@
 			ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_new(%s) created in state: %s\n",
 				tmp->name, ast_state2str(state));
 		}
+
+		/* Configure the new channel jb */
+		if (tmp && sub && sub->rtp)
+			ast_jb_configure(tmp, &sub->jbconf);
 	} else {
 		ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
 	}
@@ -3815,6 +3832,10 @@
 								/*stnrcpy(sub->txident, txident, sizeof(sub->txident) - 1);*/
 								sub->cxmode = MGCP_CX_INACTIVE;
 								sub->nat = nat;
+
+								/* Assign default jb conf to the new mgcp_subchannel */
+								memcpy(&sub->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
+
 								sub->next = e->sub;
 								e->sub = sub;
 							} else {
@@ -4165,8 +4186,18 @@
 	}
 	memset(&bindaddr, 0, sizeof(bindaddr));
 	dtmfmode = 0;
+
+	/* Copy the default jb config over global_jbconf */
+	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
 	v = ast_variable_browse(cfg, "general");
 	while(v) {
+		/* handle jb conf */
+		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
+			v = v->next;
+			continue;
+		}
+
 		/* Create the interface list */
 		if (!strcasecmp(v->name, "bindaddr")) {
 			if (!(hp = ast_gethostbyname(v->value, &ahp))) {
Index: channels/chan_jingle.c
===================================================================
--- channels/chan_jingle.c	(revision 31249)
+++ channels/chan_jingle.c	(working copy)
@@ -69,11 +69,22 @@
 #include "asterisk/utils.h"
 #include "asterisk/causes.h"
 #include "asterisk/astobj.h"
+#include "asterisk/abstract_jb.h"
 #include "asterisk/jabber.h"
 #include "asterisk/jingle.h"
 
 #define JINGLE_CONFIG "jingle.conf"
 
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
+
 enum jingle_protocol {
 	AJI_PROTOCOL_UDP = 1,
 	AJI_PROTOCOL_SSLTCP = 2,
@@ -107,6 +118,8 @@
 	struct ast_rtp *vrtp;
 	int jointcapability;	/*!< Supported capability at both ends (codecs ) */
 	int peercapability;
+	struct ast_jb_conf jbconf;
+	
 	struct jingle_pvt *next;	/* Next entity */
 };
 
@@ -684,6 +697,10 @@
 	}
 	ast_copy_string(tmp->exten, "s", sizeof(tmp->exten));
 	ast_mutex_init(&tmp->lock);
+
+	/* Assign default jb conf to the new sip_pvt */
+	memcpy(&tmp->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
+
 	ast_mutex_lock(&jinglelock);
 	tmp->next = client->p;
 	client->p = tmp;
@@ -773,6 +790,11 @@
 		ast_hangup(tmp);
 		tmp = NULL;
 	}
+
+	/* Configure the new channel jb */
+	if (tmp && i && i->rtp)
+		ast_jb_configure(tmp, &i->jbconf);
+
 	return tmp;
 }
 
@@ -1453,8 +1475,15 @@
 		return 0;
 	}
 
+	/* Copy the default jb config over global_jbconf */
+	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
 	cat = ast_category_browse(cfg, NULL);
 	for (var = ast_variable_browse(cfg, "general"); var; var = var->next) {
+		/* handle jb conf */
+		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
+			continue;
+
 		if (!strcasecmp(var->name, "allowguest"))
 			allowguest =
 				(ast_true(ast_variable_retrieve(cfg, "general", "allowguest"))) ? 1 : 0;
