[svn-commits] branch jcollie/base64 r31053 - in
/team/jcollie/base64: ./ apps/ channels/ co...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed May 31 09:59:05 MST 2006
Author: jcollie
Date: Wed May 31 11:59:04 2006
New Revision: 31053
URL: http://svn.digium.com/view/asterisk?rev=31053&view=rev
Log:
Merged revisions 31044,31049-31050,31052 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r31044 | kpfleming | 2006-05-31 11:04:49 -0500 (Wed, 31 May 2006) | 2 lines
a few more control frame types that don't need to generate useless notices in the log
........
r31049 | kpfleming | 2006-05-31 11:11:55 -0500 (Wed, 31 May 2006) | 2 lines
cleanups for commit from issue #5657... set a cause code for a rejected forward request, and actually set tmp->chan to NULL when we reject the forward request
........
r31050 | file | 2006-05-31 11:31:41 -0500 (Wed, 31 May 2006) | 2 lines
OKAY - Only replace our IP address in the outgoing SIP messages if the actual source address is within the specified local network. (issue #7051 reported by Luke-Jr with mods by me)
........
r31052 | russell | 2006-05-31 11:56:50 -0500 (Wed, 31 May 2006) | 7 lines
Add support for using a jitterbuffer for RTP on bridged calls. This includes
a new implementation of a fixed size jitterbuffer, as well as support for the
existing adaptive jitterbuffer implementation. (issue #3854, Slav Klenov)
Thank you very much to Slav Klenov of Securax and all of the people involved
in the testing of this feature for all of your hard work!
........
Added:
team/jcollie/base64/include/asterisk/abstract_jb.h
- copied unchanged from r31052, trunk/include/asterisk/abstract_jb.h
team/jcollie/base64/scx_jitterbuf.c
- copied unchanged from r31052, trunk/scx_jitterbuf.c
team/jcollie/base64/scx_jitterbuf.h
- copied unchanged from r31052, trunk/scx_jitterbuf.h
Modified:
team/jcollie/base64/ (props changed)
team/jcollie/base64/.cleancount
team/jcollie/base64/Makefile
team/jcollie/base64/apps/app_dial.c
team/jcollie/base64/channel.c
team/jcollie/base64/channels/chan_alsa.c
team/jcollie/base64/channels/chan_iax2.c
team/jcollie/base64/channels/chan_oss.c
team/jcollie/base64/channels/chan_sip.c
team/jcollie/base64/channels/chan_zap.c
team/jcollie/base64/configs/alsa.conf.sample
team/jcollie/base64/configs/oss.conf.sample
team/jcollie/base64/configs/sip.conf.sample
team/jcollie/base64/configs/zapata.conf.sample
team/jcollie/base64/frame.c
team/jcollie/base64/include/asterisk/channel.h
team/jcollie/base64/include/asterisk/frame.h
team/jcollie/base64/rtp.c
team/jcollie/base64/translate.c
Propchange: team/jcollie/base64/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed May 31 11:59:04 2006
@@ -1,1 +1,1 @@
-/trunk:1-31026
+/trunk:1-31052
Modified: team/jcollie/base64/.cleancount
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/.cleancount?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/.cleancount (original)
+++ team/jcollie/base64/.cleancount Wed May 31 11:59:04 2006
@@ -1,1 +1,1 @@
-17
+18
Modified: team/jcollie/base64/Makefile
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/Makefile?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/Makefile (original)
+++ team/jcollie/base64/Makefile Wed May 31 11:59:04 2006
@@ -282,7 +282,7 @@
astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
- cryptostub.o sha1.o http.o
+ cryptostub.o sha1.o http.o scx_jitterbuf.o abstract_jb.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
Modified: team/jcollie/base64/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/apps/app_dial.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/apps/app_dial.c (original)
+++ team/jcollie/base64/apps/app_dial.c Wed May 31 11:59:04 2006
@@ -488,6 +488,7 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", in->name, tech, stuff);
c = o->chan = NULL;
+ cause = AST_CAUSE_BUSY;
} else {
/* Setup parameters */
c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
@@ -1083,6 +1084,8 @@
ast_hangup(tmp->chan);
/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
if (ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
+ tmp->chan = NULL;
+ cause = AST_CAUSE_BUSY;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", chan->name, tech, stuff);
} else {
Modified: team/jcollie/base64/channel.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/channel.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/channel.c (original)
+++ team/jcollie/base64/channel.c Wed May 31 11:59:04 2006
@@ -1011,6 +1011,9 @@
while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
ast_var_delete(vardata);
+
+ /* Destroy the jitterbuffer */
+ ast_jb_destroy(chan);
ast_string_field_free_all(chan);
free(chan);
@@ -2547,7 +2550,12 @@
timeout = 0; /* trick to force exit from the while() */
break;
- case AST_CONTROL_PROGRESS: /* Ignore */
+ /* Ignore these */
+ case AST_CONTROL_PROGRESS:
+ case AST_CONTROL_PROCEEDING:
+ case AST_CONTROL_HOLD:
+ case AST_CONTROL_UNHOLD:
+ case AST_CONTROL_VIDUPDATE:
case -1: /* Ignore -- just stopping indications */
break;
@@ -3298,6 +3306,9 @@
int watch_c0_dtmf;
int watch_c1_dtmf;
void *pvt0, *pvt1;
+ /* Indicates whether a frame was queued into a jitterbuffer */
+ int frame_put_in_jb = 0;
+ int jb_in_use;
int to;
cs[0] = c0;
@@ -3309,6 +3320,9 @@
watch_c0_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_0;
watch_c1_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_1;
+ /* Check the need of a jitterbuffer for each channel */
+ jb_in_use = ast_jb_do_usecheck(c0, c1);
+
for (;;) {
struct ast_channel *who, *other;
@@ -3327,9 +3341,15 @@
}
} else
to = -1;
+ /* Calculate the appropriate max sleep interval - in general, this is the time,
+ left to the closest jb delivery moment */
+ if (jb_in_use)
+ to = ast_jb_get_when_to_wakeup(c0, c1, to);
who = ast_waitfor_n(cs, 2, &to);
if (!who) {
- ast_log(LOG_DEBUG, "Nobody there, continuing...\n");
+ /* No frame received within the specified timeout - check if we have to deliver now */
+ if (jb_in_use)
+ ast_jb_get_and_deliver(c0, c1);
if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) {
if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE)
c0->_softhangup = 0;
@@ -3349,6 +3369,9 @@
}
other = (who == c0) ? c1 : c0; /* the 'other' channel */
+ /* Try add the frame info the who's bridged channel jitterbuff */
+ if (jb_in_use)
+ frame_put_in_jb = !ast_jb_put(other, f);
if ((f->frametype == AST_FRAME_CONTROL) && !(config->flags & AST_BRIDGE_IGNORE_SIGS)) {
int bridge_exit = 0;
@@ -3385,8 +3408,13 @@
ast_log(LOG_DEBUG, "Got DTMF on channel (%s)\n", who->name);
break;
}
- /* other frames go to the other side */
- ast_write(other, f);
+ /* Write immediately frames, not passed through jb */
+ if (!frame_put_in_jb)
+ ast_write(other, f);
+
+ /* Check if we have to deliver now */
+ if (jb_in_use)
+ ast_jb_get_and_deliver(c0, c1);
}
/* XXX do we want to pass on also frames not matched above ? */
ast_frfree(f);
Modified: team/jcollie/base64/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/channels/chan_alsa.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/channels/chan_alsa.c (original)
+++ team/jcollie/base64/channels/chan_alsa.c Wed May 31 11:59:04 2006
@@ -69,6 +69,17 @@
#ifdef ALSA_MONITOR
#include "alsa-monitor.h"
#endif
+
+#include "asterisk/abstract_jb.h"
+/* 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;
#define DEBUG 0
/* Which device to use */
@@ -812,6 +823,8 @@
tmp = NULL;
}
}
+ if (tmp)
+ ast_jb_configure(tmp, &global_jbconf);
}
return tmp;
}
@@ -1051,9 +1064,18 @@
int x;
struct ast_config *cfg;
struct ast_variable *v;
+
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
if ((cfg = ast_config_load(config))) {
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;
+ }
if (!strcasecmp(v->name, "autoanswer"))
autoanswer = ast_true(v->value);
else if (!strcasecmp(v->name, "silencesuppression"))
Modified: team/jcollie/base64/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/channels/chan_iax2.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/channels/chan_iax2.c (original)
+++ team/jcollie/base64/channels/chan_iax2.c Wed May 31 11:59:04 2006
@@ -1543,6 +1543,7 @@
the IAX thread with the iaxsl lock held. */
struct iax_frame *fr = data;
fr->retrans = -1;
+ fr->af.has_timing_info = 0;
if (iaxs[fr->callno] && !ast_test_flag(iaxs[fr->callno], IAX_ALREADYGONE))
iax2_queue_frame(fr->callno, &fr->af);
/* Free our iax frame */
Modified: team/jcollie/base64/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/channels/chan_oss.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/channels/chan_oss.c (original)
+++ team/jcollie/base64/channels/chan_oss.c Wed May 31 11:59:04 2006
@@ -82,6 +82,17 @@
#include "ring10.h"
#include "answer.h"
+#include "asterisk/abstract_jb.h"
+/* 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;
+
/*
* Basic mode of operation:
*
@@ -140,6 +151,33 @@
; unless you know what you are doing.
; queuesize = 10 ; frames in device driver
; frags = 8 ; argument to SETFRAGMENT
+
+ ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+ ; 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".
+
+ ; 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 SIP
+ ; channel. Two implementation 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".
+ ;-----------------------------------------------------------------------------------
[card1]
; device = /dev/dsp1 ; alternate device
@@ -981,6 +1019,9 @@
/* XXX what about usecnt ? */
}
}
+ if (c)
+ ast_jb_configure(c, &global_jbconf);
+
return c;
}
@@ -1407,6 +1448,10 @@
for (v = ast_variable_browse(cfg, ctg);v; v=v->next) {
M_START(v->name, v->value);
+ /* handle jb conf */
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
+ continue;
+
M_BOOL("autoanswer", o->autoanswer)
M_BOOL("autohangup", o->autohangup)
M_BOOL("overridecontext", o->overridecontext)
@@ -1472,6 +1517,9 @@
int i;
struct ast_config *cfg;
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
/* load config file */
cfg = ast_config_load(config);
if (cfg != NULL) {
Modified: team/jcollie/base64/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/channels/chan_sip.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/channels/chan_sip.c (original)
+++ team/jcollie/base64/channels/chan_sip.c Wed May 31 11:59:04 2006
@@ -201,6 +201,17 @@
#define SIP_MAX_PACKET 4096 /*!< Also from RFC 3261 (2543), should sub headers tho */
#define INITIAL_CSEQ 101 /*!< our initial sip sequence number */
+
+#include "asterisk/abstract_jb.h"
+/* 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[] = "Session Initiation Protocol (SIP)";
static const char config[] = "sip.conf";
@@ -850,6 +861,7 @@
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)
@@ -1256,7 +1268,7 @@
.type = "SIP",
.description = "Session Initiation Protocol (SIP)",
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
- .properties = AST_CHAN_TP_WANTSJITTER,
+ .properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = sip_request_call,
.devicestate = sip_devicestate,
.call = sip_call,
@@ -1456,11 +1468,16 @@
* apply it to their address to see if we need to substitute our
* externip or can get away with our internal bindaddr
*/
- struct sockaddr_in theirs;
+ struct sockaddr_in theirs, ours;
+
+ /* Get our local information */
+ ast_ouraddrfor(them, us);
theirs.sin_addr = *them;
+ ours.sin_addr = *us;
if (localaddr && externip.sin_addr.s_addr &&
- ast_apply_ha(localaddr, &theirs)) {
+ ast_apply_ha(localaddr, &theirs) &&
+ !ast_apply_ha(localaddr, &ours)) {
if (externexpire && time(NULL) >= externexpire) {
struct ast_hostent ahp;
struct hostent *hp;
@@ -1480,8 +1497,6 @@
}
} else if (bindaddr.sin_addr.s_addr)
*us = bindaddr.sin_addr;
- else
- return ast_ouraddrfor(them, us);
return 0;
}
@@ -3309,7 +3324,11 @@
if (recordhistory)
append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);
-
+
+ /* Configure the new channel jb */
+ if (tmp && i && i->rtp)
+ ast_jb_configure(tmp, &i->jbconf);
+
return tmp;
}
@@ -3643,6 +3662,9 @@
(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);
@@ -13244,7 +13266,6 @@
for (; v; v = v->next) {
if (handle_common_options(&peerflags[0], &mask[0], v))
continue;
-
if (realtime && !strcasecmp(v->name, "regseconds")) {
ast_get_time_t(v->value, ®seconds, 0, NULL);
} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
@@ -13537,11 +13558,18 @@
global_relaxdtmf = FALSE;
global_callevents = FALSE;
global_t1min = DEFAULT_T1MIN;
+
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
ast_clear_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT);
/* Read the [general] config section of sip.conf (or from realtime config) */
for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
if (handle_common_options(&global_flags[0], &dummy[0], v))
+ continue;
+ /* handle jb conf */
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
continue;
/* Create the interface list */
Modified: team/jcollie/base64/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/channels/chan_zap.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/channels/chan_zap.c (original)
+++ team/jcollie/base64/channels/chan_zap.c Wed May 31 11:59:04 2006
@@ -108,6 +108,17 @@
#include "asterisk/astobj.h"
#define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
#endif
+
+#include "asterisk/abstract_jb.h"
+/* 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;
#if !defined(ZT_SIG_EM_E1) || (defined(HAVE_LIBPRI) && !defined(ZT_SIG_HARDHDLC))
#error "Your zaptel is too old. please update"
@@ -684,6 +695,7 @@
#endif
int polarity;
int dsp_features;
+ struct ast_jb_conf jbconf;
} *iflist = NULL, *ifend = NULL;
@@ -5195,6 +5207,9 @@
}
} else
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
+ /* Configure the new channel jb */
+ if (tmp && i)
+ ast_jb_configure(tmp, &i->jbconf);
return tmp;
}
@@ -6988,6 +7003,8 @@
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) {
@@ -10200,6 +10217,7 @@
{
struct ast_config *cfg;
struct ast_variable *v;
+ struct ast_variable *vjb;
struct zt_pvt *tmp;
char *chan;
char *c;
@@ -10289,6 +10307,11 @@
}
#endif
v = ast_variable_browse(cfg, "channels");
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+ /* Traverse all variables to handle jb conf */
+ for (vjb = v; vjb; vjb = vjb->next)
+ ast_jb_read_conf(&global_jbconf, vjb->name, vjb->value);
while(v) {
/* Create the interface list */
if (!strcasecmp(v->name, "channel")
Modified: team/jcollie/base64/configs/alsa.conf.sample
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/configs/alsa.conf.sample?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/configs/alsa.conf.sample (original)
+++ team/jcollie/base64/configs/alsa.conf.sample Wed May 31 11:59:04 2006
@@ -29,3 +29,31 @@
; To set which ALSA device to use, change this parameter
;input_device=hw:0,0
;output_device=hw:0,0
+
+;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+; 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".
+
+; 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 SIP
+ ; channel. Two implementation 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".
+;-----------------------------------------------------------------------------------
+
Modified: team/jcollie/base64/configs/oss.conf.sample
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/configs/oss.conf.sample?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/configs/oss.conf.sample (original)
+++ team/jcollie/base64/configs/oss.conf.sample Wed May 31 11:59:04 2006
@@ -46,6 +46,34 @@
; queuesize = 10 ; frames in device driver
; frags = 8 ; argument to SETFRAGMENT
+ ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+ ; 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".
+
+ ; 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 SIP
+ ; channel. Two implementation 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".
+ ;-----------------------------------------------------------------------------------
+
+
[card1]
; device = /dev/dsp1 ; alternate device
Modified: team/jcollie/base64/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/configs/sip.conf.sample?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/configs/sip.conf.sample (original)
+++ team/jcollie/base64/configs/sip.conf.sample Wed May 31 11:59:04 2006
@@ -301,6 +301,32 @@
; it may be a mandatory requirement for some
; destinations which do not have a prior
; account relationship with your server.
+
+;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
+ ; SIP 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 SIP channel can accept jitter,
+ ; thus a jitterbuffer on the receive SIP side will be used only
+ ; if it is forced and enabled.
+
+; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a SIP
+ ; 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 SIP
+ ; channel. Two implementation are currenlty available - "fixed"
+ ; (with size always equals to jbmaxsize) and "adaptive" (with
+ ; variable size, actually the new jb of IAX2). Defaults to fixed.
+
+; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
+;-----------------------------------------------------------------------------------
[authentication]
; Global credentials for outbound calls, i.e. when a proxy challenges your
Modified: team/jcollie/base64/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/configs/zapata.conf.sample?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/configs/zapata.conf.sample (original)
+++ team/jcollie/base64/configs/zapata.conf.sample Wed May 31 11:59:04 2006
@@ -495,6 +495,33 @@
;
;jitterbuffers=4
;
+;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
+ ; ZAP 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".
+
+; 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 SIP
+ ; channel. Two implementation 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".
+;-----------------------------------------------------------------------------------
+;
; You can define your own custom ring cadences here. You can define up to 8
; pairs. If the silence is negative, it indicates where the callerid spill is
; to be placed. Also, if you define any custom cadences, the default cadences
Modified: team/jcollie/base64/frame.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/frame.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/frame.c (original)
+++ team/jcollie/base64/frame.c Wed May 31 11:59:04 2006
@@ -316,6 +316,13 @@
out->samples = fr->samples;
out->offset = fr->offset;
out->data = fr->data;
+ /* Copy the timing data */
+ out->has_timing_info = fr->has_timing_info;
+ if (fr->has_timing_info) {
+ out->ts = fr->ts;
+ out->len = fr->len;
+ out->seqno = fr->seqno;
+ }
} else
out = fr;
@@ -380,6 +387,12 @@
out->prev = NULL;
out->next = NULL;
memcpy(out->data, f->data, out->datalen);
+ out->has_timing_info = f->has_timing_info;
+ if (f->has_timing_info) {
+ out->ts = f->ts;
+ out->len = f->len;
+ out->seqno = f->seqno;
+ }
return out;
}
Modified: team/jcollie/base64/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/include/asterisk/channel.h?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/include/asterisk/channel.h (original)
+++ team/jcollie/base64/include/asterisk/channel.h Wed May 31 11:59:04 2006
@@ -86,6 +86,8 @@
#ifndef _ASTERISK_CHANNEL_H
#define _ASTERISK_CHANNEL_H
+#include "asterisk/abstract_jb.h"
+
#include <unistd.h>
#ifdef POLLCOMPAT
#include "asterisk/poll-compat.h"
@@ -445,12 +447,20 @@
/*! For easy linking */
AST_LIST_ENTRY(ast_channel) chan_list;
+
+ /*! The jitterbuffer state */
+ struct ast_jb jb;
};
/* \defgroup chanprop Channel tech properties:
\brief Channels have this property if they can accept input with jitter; i.e. most VoIP channels */
/* @{ */
#define AST_CHAN_TP_WANTSJITTER (1 << 0)
+
+/* \defgroup chanprop Channel tech properties:
+ \brief Channels have this property if they can create jitter; i.e. most VoIP channels */
+/* @{ */
+#define AST_CHAN_TP_CREATESJITTER (1 << 1)
/* This flag has been deprecated by the transfercapbilty data member in struct ast_channel */
/* #define AST_FLAG_DIGITAL (1 << 0) */ /* if the call is a digital ISDN call */
Modified: team/jcollie/base64/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/include/asterisk/frame.h?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/include/asterisk/frame.h (original)
+++ team/jcollie/base64/include/asterisk/frame.h Wed May 31 11:59:04 2006
@@ -109,6 +109,14 @@
struct ast_frame *prev;
/*! Next/Prev for linking stand alone frames */
struct ast_frame *next;
+ /*! Timing data flag */
+ int has_timing_info;
+ /*! Timestamp in milliseconds */
+ long ts;
+ /*! Length in milliseconds */
+ long len;
+ /*! Sequence number */
+ int seqno;
};
/*!
Modified: team/jcollie/base64/rtp.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/rtp.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/rtp.c (original)
+++ team/jcollie/base64/rtp.c Wed May 31 11:59:04 2006
@@ -696,7 +696,6 @@
int padding;
int mark;
int ext;
- int x;
char iabuf[INET_ADDRSTRLEN];
unsigned int ssrc;
unsigned int timestamp;
@@ -835,17 +834,6 @@
if (!rtp->lastrxts)
rtp->lastrxts = timestamp;
- if (rtp->rxseqno) {
- for (x=rtp->rxseqno + 1; x < seqno; x++) {
- /* Queue empty frames */
- rtp->f.mallocd = 0;
- rtp->f.datalen = 0;
- rtp->f.data = NULL;
- rtp->f.offset = 0;
- rtp->f.samples = 0;
- rtp->f.src = "RTPMissedFrame";
- }
- }
rtp->rxseqno = seqno;
if (rtp->dtmfcount) {
@@ -877,6 +865,11 @@
if (rtp->f.subclass == AST_FORMAT_SLINEAR)
ast_frame_byteswap_be(&rtp->f);
calc_rxstamp(&rtp->f.delivery, rtp, timestamp, mark);
+ /* Add timing data to let ast_generic_bridge() put the frame into a jitterbuf */
+ rtp->f.has_timing_info = 1;
+ rtp->f.ts = timestamp / 8;
+ rtp->f.len = rtp->f.samples / 8;
+ rtp->f.seqno = seqno;
} else {
/* Video -- samples is # of samples vs. 90000 */
if (!rtp->lastividtimestamp)
@@ -1700,6 +1693,9 @@
*/
if (rtp->lastts > rtp->lastdigitts)
rtp->lastdigitts = rtp->lastts;
+
+ if (f->has_timing_info)
+ rtp->lastts = f->ts * 8;
/* Get a pointer to the header */
rtpheader = (unsigned char *)(f->data - hdrlen);
Modified: team/jcollie/base64/translate.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/base64/translate.c?rev=31053&r1=31052&r2=31053&view=diff
==============================================================================
--- team/jcollie/base64/translate.c (original)
+++ team/jcollie/base64/translate.c Wed May 31 11:59:04 2006
@@ -154,6 +154,12 @@
int16_t *dst = (int16_t *)pvt->outbuf;
int ret;
int samples = pvt->samples; /* initial value */
+
+ /* Copy the last in jb timing info to the pvt */
+ pvt->f.has_timing_info = f->has_timing_info;
+ pvt->f.ts = f->ts;
+ pvt->f.len = f->len;
+ pvt->f.seqno = f->seqno;
if (f->samples == 0) {
ast_log(LOG_WARNING, "no samples for %s\n", pvt->t->name);
@@ -285,6 +291,15 @@
struct ast_trans_pvt *p = path;
struct ast_frame *out = f;
struct timeval delivery;
+ int has_timing_info;
+ long ts;
+ long len;
+ int seqno;
+
+ has_timing_info = f->has_timing_info;
+ ts = f->ts;
+ len = f->len;
+ seqno = f->seqno;
/* XXX hmmm... check this below */
if (!ast_tvzero(f->delivery)) {
@@ -331,6 +346,12 @@
path->nextout = ast_tvadd(path->nextout, ast_samp2tv( out->samples, 8000));
} else {
out->delivery = ast_tv(0, 0);
+ out->has_timing_info = has_timing_info;
+ if (has_timing_info) {
+ out->ts = ts;
+ out->len = len;
+ out->seqno = seqno;
+ }
}
/* Invalidate prediction if we're entering a silence period */
if (out->frametype == AST_FRAME_CNG)
More information about the svn-commits
mailing list