aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-01 16:47:28 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-01 16:47:28 +0000
commitf796193575703618e2b05e84545e3354543a8276 (patch)
tree65c18318da656f3d8bdc20876d5774763985c46a
parent9f95248be1f852e3b6d2171eb0d95c715471f881 (diff)
- 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) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@31413 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_h323.c27
-rw-r--r--channels/chan_jingle.c23
-rw-r--r--channels/chan_mgcp.c35
-rw-r--r--channels/chan_oss.c14
-rw-r--r--channels/chan_sip.c6
-rw-r--r--channels/chan_skinny.c10
-rw-r--r--channels/chan_zap.c6
-rw-r--r--channels/h323/h323.conf.sample26
-rw-r--r--configs/alsa.conf.sample10
-rw-r--r--configs/mgcp.conf.sample27
-rw-r--r--configs/oss.conf.sample14
-rw-r--r--configs/sip.conf.sample2
-rw-r--r--configs/skinny.conf.sample2
-rw-r--r--configs/zapata.conf.sample10
14 files changed, 150 insertions, 62 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 2714d78c1..a252f4e64 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -83,6 +83,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/dsp.h"
#include "asterisk/causes.h"
#include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
#ifdef __cplusplus
}
#endif
@@ -105,6 +106,16 @@ setcapabilities_cb on_setcapabilities;
/* 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";
@@ -788,6 +799,10 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
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 @@ int reload_config(void)
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);
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index f335d4b26..3caa2dfe5 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -69,11 +69,22 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#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,
@@ -773,6 +784,11 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
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 @@ static int jingle_load_config(void)
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;
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index de459d7f5..3a4902159 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -117,6 +117,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#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 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#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 @@ struct mgcp_subchannel {
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 @@ struct mgcp_subchannel {
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 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
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 @@ static int reload_config(void)
}
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))) {
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 8e1f60413..ef6da80bc 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -156,13 +156,9 @@ START_CONFIG
; 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 @@ START_CONFIG
; 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.
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 4f4901723..93bd72df5 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -857,7 +857,6 @@ static struct sip_pvt {
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 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
/* Configure the new channel jb */
if (tmp && i && i->rtp)
- ast_jb_configure(tmp, &i->jbconf);
+ ast_jb_configure(tmp, &global_jbconf);
return tmp;
}
@@ -3693,9 +3692,6 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si
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);
p->next = iflist;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index db10d829f..914297aed 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -826,8 +826,6 @@ struct skinny_subchannel {
int nat;
int outgoing;
int alreadygone;
- struct ast_jb_conf jbconf;
-
struct skinny_subchannel *next;
};
@@ -1615,10 +1613,6 @@ static struct skinny_device *build_device(char *cat, struct ast_variable *v)
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 @@ static struct ast_channel *skinny_new(struct skinny_subchannel *sub, int state)
/* 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 @@ static int reload_config(void)
/* 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;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 9ee5ed0a8..f30a851dd 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -698,8 +698,6 @@ static struct zt_pvt {
#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 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
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 @@ static struct zt_pvt *mkintf(int channel, int signalling, int outsignalling, int
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) {
diff --git a/channels/h323/h323.conf.sample b/channels/h323/h323.conf.sample
index 42858ed74..164397580 100644
--- a/channels/h323/h323.conf.sample
+++ b/channels/h323/h323.conf.sample
@@ -63,6 +63,32 @@ allow=gsm ; Always allow GSM, it's cool :)
; 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
;
diff --git a/configs/alsa.conf.sample b/configs/alsa.conf.sample
index bfe77101f..e39197719 100644
--- a/configs/alsa.conf.sample
+++ b/configs/alsa.conf.sample
@@ -34,13 +34,9 @@ extension=s
; 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.
diff --git a/configs/mgcp.conf.sample b/configs/mgcp.conf.sample
index 2279977d8..c80104e32 100644
--- a/configs/mgcp.conf.sample
+++ b/configs/mgcp.conf.sample
@@ -5,6 +5,33 @@
;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
;context = default
diff --git a/configs/oss.conf.sample b/configs/oss.conf.sample
index 6997ccb9c..ec42da771 100644
--- a/configs/oss.conf.sample
+++ b/configs/oss.conf.sample
@@ -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.
diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample
index 67d6dd21f..2b898437b 100644
--- a/configs/sip.conf.sample
+++ b/configs/sip.conf.sample
@@ -321,7 +321,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
; 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.
diff --git a/configs/skinny.conf.sample b/configs/skinny.conf.sample
index ab368b1ab..e18709334 100644
--- a/configs/skinny.conf.sample
+++ b/configs/skinny.conf.sample
@@ -29,7 +29,7 @@ keepAlive=120
; 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.
diff --git a/configs/zapata.conf.sample b/configs/zapata.conf.sample
index aacbce020..c20ecbe5f 100644
--- a/configs/zapata.conf.sample
+++ b/configs/zapata.conf.sample
@@ -501,11 +501,7 @@ immediate=no
; 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 @@ immediate=no
; 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.