[asterisk-commits] trunk r31413 - in /trunk: channels/
channels/h323/ configs/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jun 1 09:47:29 MST 2006
Author: russell
Date: Thu Jun 1 11:47:28 2006
New Revision: 31413
URL: http://svn.digium.com/view/asterisk?rev=31413&view=rev
Log:
- add the ability to configure forced jitterbuffers on h323, jingle,
and mgcp channels
- remove the jitterbuffer configuration from the pvt structures in
the sip, zap, and skinny channel drivers, as copying the same global
configuration into each pvt structure has no benefit.
- update and fix some typos in jitterbuffer related documentation
(issue #7257, north, with additional updates and modifications)
Modified:
trunk/channels/chan_h323.c
trunk/channels/chan_jingle.c
trunk/channels/chan_mgcp.c
trunk/channels/chan_oss.c
trunk/channels/chan_sip.c
trunk/channels/chan_skinny.c
trunk/channels/chan_zap.c
trunk/channels/h323/h323.conf.sample
trunk/configs/alsa.conf.sample
trunk/configs/mgcp.conf.sample
trunk/configs/oss.conf.sample
trunk/configs/sip.conf.sample
trunk/configs/skinny.conf.sample
trunk/configs/zapata.conf.sample
Modified: trunk/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_h323.c?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Thu Jun 1 11:47:28 2006
@@ -83,6 +83,7 @@
#include "asterisk/dsp.h"
#include "asterisk/causes.h"
#include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
#ifdef __cplusplus
}
#endif
@@ -104,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";
@@ -788,6 +799,10 @@
ch = NULL;
}
}
+
+ /* Configure the new channel jb */
+ if (ch && pvt && pvt->rtp)
+ ast_jb_configure(ch, &global_jbconf);
} else {
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
}
@@ -2020,8 +2035,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) {
+ 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);
Modified: trunk/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_jingle.c?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/chan_jingle.c (original)
+++ trunk/channels/chan_jingle.c Thu Jun 1 11:47:28 2006
@@ -69,10 +69,21 @@
#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,
@@ -773,6 +784,11 @@
ast_hangup(tmp);
tmp = NULL;
}
+
+ /* Configure the new channel jb */
+ if (tmp && i && i->rtp)
+ ast_jb_configure(tmp, &global_jbconf);
+
return tmp;
}
@@ -1453,8 +1469,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, var->name, var->value))
+ continue;
+
if (!strcasecmp(var->name, "allowguest"))
allowguest =
(ast_true(ast_variable_retrieve(cfg, "general", "allowguest"))) ? 1 : 0;
Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Thu Jun 1 11:47:28 2006
@@ -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
@@ -136,6 +137,16 @@
#ifndef INADDR_NONE
#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";
@@ -353,10 +364,6 @@
This should be obsoleted */
char cxident[80];
char callid[80];
-/* SC: obsolete
- time_t lastouttime;
- int lastout;
-*/
int cxmode;
struct mgcp_request *cx_queue; /*!< SC: pending CX commands */
ast_mutex_t cx_queue_lock; /*!< SC: CX queue lock */
@@ -364,10 +371,6 @@
int iseq; /* Not used? RTP? */
int outgoing;
int alreadygone;
-/* SC: obsolete
- int messagepending;
- struct mgcp_message *msgs;
-*/
struct mgcp_subchannel *next; /* for out circular linked list */
};
@@ -1499,6 +1502,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, &global_jbconf);
} else {
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
}
@@ -4165,8 +4172,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) {
+ 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))) {
Modified: trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_oss.c?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Thu Jun 1 11:47:28 2006
@@ -156,13 +156,9 @@
; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an
; OSS channel. Defaults to "no". An enabled jitterbuffer will
; be used only if the sending side can create and the receiving
- ; side can not accept jitter. The ZAP channel can't accept jitter,
- ; thus an enabled jitterbuffer on the receive ZAP side will always
- ; be used if the sending side can create jitter or if ZAP jb is
- ; forced.
-
- ; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a ZAP
- ; channel. Defaults to "no".
+ ; side can not accept jitter. The OSS channel can't accept jitter,
+ ; thus an enabled jitterbuffer on the receive OSS side will always
+ ; be used if the sending side can create jitter.
; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
@@ -171,8 +167,8 @@
; big jumps in/broken timestamps, usualy sent from exotic devices
; and programs. Defaults to 1000.
- ; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
- ; channel. Two implementation are currenlty available - "fixed"
+ ; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of an OSS
+ ; channel. Two implementations are currenlty available - "fixed"
; (with size always equals to jbmax-size) and "adaptive" (with
; variable size, actually the new jb of IAX2). Defaults to fixed.
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jun 1 11:47:28 2006
@@ -857,7 +857,6 @@
struct ast_variable *chanvars; /*!< Channel variables to set for inbound call */
struct sip_pvt *next; /*!< Next dialog in chain */
struct sip_invite_param *options; /*!< Options for INVITE */
- struct ast_jb_conf jbconf;
} *iflist = NULL;
#define FLAG_RESPONSE (1 << 0)
@@ -3357,7 +3356,7 @@
/* Configure the new channel jb */
if (tmp && i && i->rtp)
- ast_jb_configure(tmp, &i->jbconf);
+ ast_jb_configure(tmp, &global_jbconf);
return tmp;
}
@@ -3692,9 +3691,6 @@
(ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
p->noncodeccapability |= AST_RTP_DTMF;
ast_string_field_set(p, context, default_context);
-
- /* Assign default jb conf to the new sip_pvt */
- memcpy(&p->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
/* Add to active dialog list */
ast_mutex_lock(&iflock);
Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Thu Jun 1 11:47:28 2006
@@ -826,8 +826,6 @@
int nat;
int outgoing;
int alreadygone;
- struct ast_jb_conf jbconf;
-
struct skinny_subchannel *next;
};
@@ -1615,10 +1613,6 @@
callnums++;
sub->cxmode = SKINNY_CX_INACTIVE;
sub->nat = nat;
-
- /* Assign default jb conf to the new skinny_subchannel */
- memcpy(&sub->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
-
sub->next = l->sub;
l->sub = sub;
} else {
@@ -2311,7 +2305,7 @@
/* Configure the new channel jb */
if (tmp && sub && sub->rtp)
- ast_jb_configure(tmp, &sub->jbconf);
+ ast_jb_configure(tmp, &global_jbconf);
} else {
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
}
@@ -3121,7 +3115,7 @@
/* load the general section */
v = ast_variable_browse(cfg, "general");
- while(v) {
+ while (v) {
/* handle jb conf */
if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
v = v->next;
Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Thu Jun 1 11:47:28 2006
@@ -698,8 +698,6 @@
#endif
int polarity;
int dsp_features;
- struct ast_jb_conf jbconf;
-
} *iflist = NULL, *ifend = NULL;
static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause);
@@ -5215,7 +5213,7 @@
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
/* Configure the new channel jb */
if (tmp && i)
- ast_jb_configure(tmp, &i->jbconf);
+ ast_jb_configure(tmp, &global_jbconf);
return tmp;
}
@@ -7011,8 +7009,6 @@
for (x = 0; x < 3; x++)
tmp->subs[x].zfd = -1;
tmp->channel = channel;
- /* Assign default jb conf to the new zt_pvt */
- memcpy(&tmp->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
}
if (tmp) {
Modified: trunk/channels/h323/h323.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/channels/h323/h323.conf.sample?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/channels/h323/h323.conf.sample (original)
+++ trunk/channels/h323/h323.conf.sample Thu Jun 1 11:47:28 2006
@@ -63,6 +63,32 @@
; use user authentication at all.
;
;context=default
+;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
+ ; H323 channel. Defaults to "no". An enabled jitterbuffer will
+ ; be used only if the sending side can create and the receiving
+ ; side can not accept jitter. The H323 channel can accept jitter,
+ ; thus an enabled jitterbuffer on the receive H323 side will only
+ ; be used if the sending side can create jitter and jbforce is
+ ; also set to yes.
+
+; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a H323
+ ; channel. Defaults to "no".
+
+; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
+
+; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
+ ; resynchronized. Useful to improve the quality of the voice, with
+ ; big jumps in/broken timestamps, usualy sent from exotic devices
+ ; and programs. Defaults to 1000.
+
+; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a H323
+ ; channel. Two implementations are currenlty available - "fixed"
+ ; (with size always equals to jbmax-size) and "adaptive" (with
+ ; variable size, actually the new jb of IAX2). Defaults to fixed.
+
+; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
+;-----------------------------------------------------------------------------------
;
; H.323 Alias definitions
;
Modified: trunk/configs/alsa.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/alsa.conf.sample?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/configs/alsa.conf.sample (original)
+++ trunk/configs/alsa.conf.sample Thu Jun 1 11:47:28 2006
@@ -34,13 +34,9 @@
; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an
; ALSA channel. Defaults to "no". An enabled jitterbuffer will
; be used only if the sending side can create and the receiving
- ; side can not accept jitter. The ZAP channel can't accept jitter,
- ; thus an enabled jitterbuffer on the receive ZAP side will always
- ; be used if the sending side can create jitter or if ZAP jb is
- ; forced.
-
-; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a ZAP
- ; channel. Defaults to "no".
+ ; side can not accept jitter. The ALSA channel can't accept jitter,
+ ; thus an enabled jitterbuffer on the receive ALSA side will always
+ ; be used if the sending side can create jitter.
; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
Modified: trunk/configs/mgcp.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/mgcp.conf.sample?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/configs/mgcp.conf.sample (original)
+++ trunk/configs/mgcp.conf.sample Thu Jun 1 11:47:28 2006
@@ -4,6 +4,33 @@
[general]
;port = 2427
;bindaddr = 0.0.0.0
+
+;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
+ ; MGCP channel. Defaults to "no". An enabled jitterbuffer will
+ ; be used only if the sending side can create and the receiving
+ ; side can not accept jitter. The MGCP channel can accept jitter,
+ ; thus an enabled jitterbuffer on the receive MGCP side will only
+ ; be used if the sending side can create jitter and jbforce is
+ ; also set to yes.
+
+; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a MGCP
+ ; channel. Defaults to "no".
+
+; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
+
+; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
+ ; resynchronized. Useful to improve the quality of the voice, with
+ ; big jumps in/broken timestamps, usualy sent from exotic devices
+ ; and programs. Defaults to 1000.
+
+; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a MGCP
+ ; channel. Two implementations are currenlty available - "fixed"
+ ; (with size always equals to jbmax-size) and "adaptive" (with
+ ; variable size, actually the new jb of IAX2). Defaults to fixed.
+
+; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
+;-----------------------------------------------------------------------------------
;[dlinkgw]
;host = 192.168.0.64
Modified: trunk/configs/oss.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/oss.conf.sample?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/configs/oss.conf.sample (original)
+++ trunk/configs/oss.conf.sample Thu Jun 1 11:47:28 2006
@@ -50,13 +50,9 @@
; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an
; OSS channel. Defaults to "no". An enabled jitterbuffer will
; be used only if the sending side can create and the receiving
- ; side can not accept jitter. The ZAP channel can't accept jitter,
- ; thus an enabled jitterbuffer on the receive ZAP side will always
- ; be used if the sending side can create jitter or if ZAP jb is
- ; forced.
-
- ; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a ZAP
- ; channel. Defaults to "no".
+ ; side can not accept jitter. The OSS channel can't accept jitter,
+ ; thus an enabled jitterbuffer on the receive OSS side will always
+ ; be used if the sending side can create jitter.
; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
@@ -65,8 +61,8 @@
; big jumps in/broken timestamps, usualy sent from exotic devices
; and programs. Defaults to 1000.
- ; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
- ; channel. Two implementation are currenlty available - "fixed"
+ ; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of an OSS
+ ; channel. Two implementations are currenlty available - "fixed"
; (with size always equals to jbmax-size) and "adaptive" (with
; variable size, actually the new jb of IAX2). Defaults to fixed.
Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Thu Jun 1 11:47:28 2006
@@ -321,7 +321,7 @@
; and programs. Defaults to 1000.
; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
- ; channel. Two implementation are currenlty available - "fixed"
+ ; channel. Two implementations are currenlty available - "fixed"
; (with size always equals to jbmaxsize) and "adaptive" (with
; variable size, actually the new jb of IAX2). Defaults to fixed.
Modified: trunk/configs/skinny.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/skinny.conf.sample?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/configs/skinny.conf.sample (original)
+++ trunk/configs/skinny.conf.sample Thu Jun 1 11:47:28 2006
@@ -29,7 +29,7 @@
; and programs. Defaults to 1000.
;jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a
- ; skinny channel. Two implementation are currently available
+ ; skinny channel. Two implementations are currently available
; - "fixed" (with size always equals to jbmaxsize)
; - "adaptive" (with variable size, actually the new jb of IAX2).
; Defaults to fixed.
Modified: trunk/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/zapata.conf.sample?rev=31413&r1=31412&r2=31413&view=diff
==============================================================================
--- trunk/configs/zapata.conf.sample (original)
+++ trunk/configs/zapata.conf.sample Thu Jun 1 11:47:28 2006
@@ -501,11 +501,7 @@
; be used only if the sending side can create and the receiving
; side can not accept jitter. The ZAP channel can't accept jitter,
; thus an enabled jitterbuffer on the receive ZAP side will always
- ; be used if the sending side can create jitter or if ZAP jb is
- ; forced.
-
-; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a ZAP
- ; channel. Defaults to "no".
+ ; be used if the sending side can create jitter.
; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
@@ -514,8 +510,8 @@
; big jumps in/broken timestamps, usualy sent from exotic devices
; and programs. Defaults to 1000.
-; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
- ; channel. Two implementation are currenlty available - "fixed"
+; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a ZAP
+ ; channel. Two implementations are currenlty available - "fixed"
; (with size always equals to jbmax-size) and "adaptive" (with
; variable size, actually the new jb of IAX2). Defaults to fixed.
More information about the asterisk-commits
mailing list