diff -urN asterisk-jb/.svn/entries asterisk-vanilla/.svn/entries
--- asterisk-jb/.svn/entries	2006-01-19 11:37:44.000000000 +0100
+++ asterisk-vanilla/.svn/entries	2006-01-19 11:43:18.000000000 +0100
@@ -53,12 +53,12 @@
 <entry
    committed-rev="8162"
    name="loader.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:17.000000Z"
    committed-date="2006-01-18T00:47:04.076953Z"
    checksum="35839aa101a85d77a2b18993aca3e35a"
    last-author="mogorman"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:17.000000Z"/>
 <entry
    committed-rev="7221"
    name="poll.c"
@@ -410,12 +410,12 @@
 <entry
    committed-rev="8122"
    name="asterisk.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:18.000000Z"
    committed-date="2006-01-17T13:11:55.298353Z"
    checksum="a0ace214e246bba9bbe82a56e291bf41"
    last-author="kpfleming"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:18.000000Z"/>
 <entry
    committed-rev="7221"
    name="dsp.c"
@@ -608,12 +608,12 @@
 <entry
    committed-rev="8124"
    name="logger.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:18.000000Z"
    committed-date="2006-01-17T16:55:30.033314Z"
    checksum="68f4147c4050379fbb6b98ddf48aa41c"
    last-author="mogorman"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:18.000000Z"/>
 <entry
    name="images"
    kind="dir"/>
diff -urN asterisk-jb/Makefile asterisk-vanilla/Makefile
--- asterisk-jb/Makefile	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/Makefile	2006-01-11 21:41:22.000000000 +0100
@@ -74,9 +74,6 @@
 # Uncomment next one to enable ast_frame tracing (for debugging)
 TRACE_FRAMES = #-DTRACE_FRAMES
 
-# Uncomment next one to enable the asterisk generic jitterbuffer
-GENERIC_JB = #-DAST_JB
-
 # Uncomment next one to enable malloc debugging
 # You can view malloc debugging with:
 #   *CLI> show memory allocations [filename]
@@ -332,7 +329,6 @@
 
 ASTCFLAGS+= $(DEBUG_THREADS)
 ASTCFLAGS+= $(TRACE_FRAMES)
-ASTCFLAGS+= $(GENERIC_JB)
 ASTCFLAGS+= $(MALLOC_DEBUG)
 ASTCFLAGS+= $(BUSYDETECT)
 ASTCFLAGS+= $(OPTIONS)
@@ -345,7 +341,7 @@
 	cdr.o tdd.o acl.o rtp.o manager.o asterisk.o \
 	dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
 	astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
-	utils.o plc.o jitterbuf.o scx_jitterbuf.o abstract_jb.o dnsmgr.o devicestate.o \
+	utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
 	netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
 	cryptostub.o
 
diff -urN asterisk-jb/abstract_jb.c asterisk-vanilla/abstract_jb.c
--- asterisk-jb/abstract_jb.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/abstract_jb.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,873 +0,0 @@
-/*
- * abstract_jb: common implementation-independent jitterbuffer stuff
- *
- * Copyright (C) 2005, Attractel OOD
- *
- * Author:
- * Slav Klenov <slav@securax.org>
- */
-
-/*! \file
- *
- * \brief Common implementation-independent jitterbuffer stuff.
- * 
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $")
-
-#include "asterisk/frame.h"
-#include "asterisk/channel.h"
-#include "asterisk/logger.h"
-#include "asterisk/term.h"
-#include "asterisk/options.h"
-#include "asterisk/utils.h"
-
-#ifdef AST_JB
-
-#include "asterisk/abstract_jb.h"
-#include "scx_jitterbuf.h"
-#include "jitterbuf.h"
-
-
-/* Internal jb flags */
-#define JB_USE (1 << 0)
-#define JB_TIMEBASE_INITIALIZED (1 << 1)
-#define JB_CREATED (1 << 2)
-
-
-/* Hooks for the abstract jb implementation */
-
-/* Create */
-typedef void * (*jb_create_impl)(struct ast_jb_conf *general_config, long resynch_threshold);
-/* Destroy */
-typedef void (*jb_destroy_impl)(void *jb);
-/* Put first frame */
-typedef int (*jb_put_first_impl)(void *jb, struct ast_frame *fin, long now);
-/* Put frame */
-typedef int (*jb_put_impl)(void *jb, struct ast_frame *fin, long now);
-/* Get frame for now */
-typedef int (*jb_get_impl)(void *jb, struct ast_frame **fout, long now, long interpl);
-/* Get next */
-typedef long (*jb_next_impl)(void *jb);
-/* Remove first frame */
-typedef int (*jb_remove_impl)(void *jb, struct ast_frame **fout);
-/* Force resynch */
-typedef void (*jb_force_resynch_impl)(void *jb);
-
-
-/*!
- * \brief Jitterbuffer implementation private struct.
- */
-struct ast_jb_impl
-{
-	char name[AST_JB_IMPL_NAME_SIZE];
-	jb_create_impl create;
-	jb_destroy_impl destroy;
-	jb_put_first_impl put_first;
-	jb_put_impl put;
-	jb_get_impl get;
-	jb_next_impl next;
-	jb_remove_impl remove;
-	jb_force_resynch_impl force_resync;
-};
-
-/* Implementation functions */
-/* scx */
-static void * jb_create_scx(struct ast_jb_conf *general_config, long resynch_threshold);
-static void jb_destroy_scx(void *jb);
-static int jb_put_first_scx(void *jb, struct ast_frame *fin, long now);
-static int jb_put_scx(void *jb, struct ast_frame *fin, long now);
-static int jb_get_scx(void *jb, struct ast_frame **fout, long now, long interpl);
-static long jb_next_scx(void *jb);
-static int jb_remove_scx(void *jb, struct ast_frame **fout);
-static void jb_force_resynch_scx(void *jb);
-/* stevek */
-static void * jb_create_stevek(struct ast_jb_conf *general_config, long resynch_threshold);
-static void jb_destroy_stevek(void *jb);
-static int jb_put_first_stevek(void *jb, struct ast_frame *fin, long now);
-static int jb_put_stevek(void *jb, struct ast_frame *fin, long now);
-static int jb_get_stevek(void *jb, struct ast_frame **fout, long now, long interpl);
-static long jb_next_stevek(void *jb);
-static int jb_remove_stevek(void *jb, struct ast_frame **fout);
-static void jb_force_resynch_stevek(void *jb);
-
-/* Available jb implementations */
-static struct ast_jb_impl avail_impl[] = 
-{
-	{
-		.name = "fixed",
-		.create = jb_create_scx,
-		.destroy = jb_destroy_scx,
-		.put_first = jb_put_first_scx,
-		.put = jb_put_scx,
-		.get = jb_get_scx,
-		.next = jb_next_scx,
-		.remove = jb_remove_scx,
-		.force_resync = jb_force_resynch_scx
-	},
-	{
-		.name = "adaptive",
-		.create = jb_create_stevek,
-		.destroy = jb_destroy_stevek,
-		.put_first = jb_put_first_stevek,
-		.put = jb_put_stevek,
-		.get = jb_get_stevek,
-		.next = jb_next_stevek,
-		.remove = jb_remove_stevek,
-		.force_resync = jb_force_resynch_stevek
-	}
-};
-
-static int default_impl = 0;
-
-
-/* Abstract return codes */
-#define JB_IMPL_OK 0
-#define JB_IMPL_DROP 1
-#define JB_IMPL_INTERP 2
-#define JB_IMPL_NOFRAME 3
-
-/* Translations between impl and abstract return codes */
-static int scx_to_abstract_code[] =
-	{JB_IMPL_OK, JB_IMPL_DROP, JB_IMPL_INTERP, JB_IMPL_NOFRAME};
-static int stevek_to_abstract_code[] =
-	{JB_IMPL_OK, JB_IMPL_NOFRAME, JB_IMPL_NOFRAME, JB_IMPL_INTERP, JB_IMPL_DROP, JB_IMPL_OK};
-
-/* JB_GET actions (used only for the frames log) */
-static char *jb_get_actions[] = {"Delivered", "Dropped", "Interpolated", "No"};
-
-/* Macros for JB logs */
-/*#define jb_verbose(...) ast_verbose(VERBOSE_PREFIX_3 " ***[JB LOG]*** " __VA_ARGS__)*/
-#define jb_verbose(...) if(1){\
-	char tmp[256];\
-	char msg[192];\
-	snprintf(msg, sizeof(msg), VERBOSE_PREFIX_3 "***[JB LOG]*** " __VA_ARGS__);\
-	ast_verbose("%s\n", term_color(tmp, msg, COLOR_BRGREEN, 0, sizeof(tmp)));}
-
-/* Macros for the frame log files */
-#define jb_framelog(...) \
-if(jb->logfile) \
-{ \
-	fprintf(jb->logfile, __VA_ARGS__); \
-	fflush(jb->logfile); \
-} \
-
-
-/* Internal utility functions */
-static void jb_choose_impl(struct ast_channel *chan);
-static void jb_get_and_deliver(struct ast_channel *chan);
-static int create_jb(struct ast_channel *chan, struct ast_frame *first_frame);
-static long get_now(struct ast_jb *jb, struct timeval *tv);
-
-
-/* Interface ast jb functions impl */
-
-
-static void jb_choose_impl(struct ast_channel *chan)
-{
-	struct ast_jb *jb = &chan->jb;
-	struct ast_jb_conf *jbconf = &jb->conf;
-	struct ast_jb_impl *test_impl;
-	int i, avail_impl_count = sizeof(avail_impl) / sizeof(avail_impl[0]);
-	
-	jb->impl = &avail_impl[default_impl];
-	
-	if(*jbconf->impl == '\0')
-	{
-		return;
-	}
-		
-	for(i=0; i<avail_impl_count; i++)
-	{
-		test_impl = &avail_impl[i];
-		if(strcmp(jbconf->impl, test_impl->name) == 0)
-		{
-			jb->impl = test_impl;
-			return;
-		}
-	}
-}
-
-
-void ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1)
-{
-	struct ast_jb *jb0 = &c0->jb;
-	struct ast_jb *jb1 = &c1->jb;
-	struct ast_jb_conf *conf0 = &jb0->conf;
-	struct ast_jb_conf *conf1 = &jb1->conf;
-	int c0_wants_jitter = c0->tech->properties & AST_CHAN_TP_WANTSJITTER;
-	int c0_creates_jitter = c0->tech->properties & AST_CHAN_TP_CREATESJITTER;
-	int c0_jb_enabled = ast_test_flag(conf0, AST_JB_ENABLED);
-	int c0_force_jb = ast_test_flag(conf0, AST_JB_FORCED);
-	int c0_jb_timebase_initialized = ast_test_flag(jb0, JB_TIMEBASE_INITIALIZED);
-	int c0_jb_created = ast_test_flag(jb0, JB_CREATED);
-	int c1_wants_jitter = c1->tech->properties & AST_CHAN_TP_WANTSJITTER;
-	int c1_creates_jitter = c1->tech->properties & AST_CHAN_TP_CREATESJITTER;
-	int c1_jb_enabled = ast_test_flag(conf1, AST_JB_ENABLED);
-	int c1_force_jb = ast_test_flag(conf1, AST_JB_FORCED);
-	int c1_jb_timebase_initialized = ast_test_flag(jb1, JB_TIMEBASE_INITIALIZED);
-	int c1_jb_created = ast_test_flag(jb1, JB_CREATED);
-	
-	if(((!c0_wants_jitter && c1_creates_jitter) || c0_force_jb) && c0_jb_enabled)
-	{
-		ast_set_flag(jb0, JB_USE);
-		if(!c0_jb_timebase_initialized)
-		{
-			if(c1_jb_timebase_initialized)
-			{
-				memcpy(&jb0->timebase, &jb1->timebase, sizeof(struct timeval));
-			}
-			else
-			{
-				gettimeofday(&jb0->timebase, NULL);
-			}
-			ast_set_flag(jb0, JB_TIMEBASE_INITIALIZED);
-		}
-		
-		if(!c0_jb_created)
-		{
-			jb_choose_impl(c0);
-		}
-	}
-	
-	if(((!c1_wants_jitter && c0_creates_jitter) || c1_force_jb) && c1_jb_enabled)
-	{
-		ast_set_flag(jb1, JB_USE);
-		if(!c1_jb_timebase_initialized)
-		{
-			if(c0_jb_timebase_initialized)
-			{
-				memcpy(&jb1->timebase, &jb0->timebase, sizeof(struct timeval));
-			}
-			else
-			{
-				gettimeofday(&jb1->timebase, NULL);
-			}
-			ast_set_flag(jb1, JB_TIMEBASE_INITIALIZED);
-		}
-		
-		if(!c1_jb_created)
-		{
-			jb_choose_impl(c1);
-		}
-	}
-}
-
-
-int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, int time_left)
-{
-	struct ast_jb *jb0 = &c0->jb;
-	struct ast_jb *jb1 = &c1->jb;
-	int c0_use_jb = ast_test_flag(jb0, JB_USE);
-	int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED);
-	int c1_use_jb = ast_test_flag(jb1, JB_USE);
-	int c1_jb_is_created = ast_test_flag(jb1, JB_CREATED);
-	int wait, wait0, wait1;
-	struct timeval tv_now;
-	
-	if(time_left == 0)
-	{
-		/* No time left - the bridge will be retried */
-		/* TODO: Test disable this */
-		/*return 0;*/
-	}
-	
-	if(time_left < 0)
-	{
-		time_left = INT_MAX;
-	}
-	
-	gettimeofday(&tv_now, NULL);
-	
-	wait0 = (c0_use_jb && c0_jb_is_created) ? jb0->next - get_now(jb0, &tv_now) : time_left;
-	wait1 = (c1_use_jb && c1_jb_is_created) ? jb1->next - get_now(jb1, &tv_now) : time_left;
-	
-	wait = wait0 < wait1 ? wait0 : wait1;
-	wait = wait < time_left ? wait : time_left;
-	
-	if(wait == INT_MAX)
-	{
-		wait = -1;
-	}
-	else if(wait < 1)
-	{
-		/* don't let wait=0, because this can cause the pbx thread to loop without any sleeping at all */
-		wait = 1;
-	}
-	
-	return wait;
-}
-
-
-int ast_jb_put(struct ast_channel *chan, struct ast_frame *f)
-{
-	struct ast_jb *jb = &chan->jb;
-	struct ast_jb_impl *jbimpl = jb->impl;
-	void *jbobj = jb->jbobj;
-	struct ast_frame *frr;
-	long now = 0;
-	
-	if(!ast_test_flag(jb, JB_USE))
-	{
-		return -1;
-	}
-	
-	if(f->frametype != AST_FRAME_VOICE)
-	{
-		if(f->frametype == AST_FRAME_DTMF && ast_test_flag(jb, JB_CREATED))
-		{
-			jb_framelog("JB_PUT {now=%ld}: Received DTMF frame. Force resynching jb...\n", now);
-			jbimpl->force_resync(jbobj);
-		}
-		
-		return -1;
-	}
-	
-	if(!f->has_timing_info || f->len < 2 || f->ts < 0)
-	{
-		/* TODO: Shouldn't we disable the jb here? Or we can produce timestamp and seqno? */
-		return -1;
-	}
-	
-	if(f->mallocd & AST_MALLOCD_HDR)
-	{
-		frr = ast_frdup(f);
-	}
-	else
-	{
-		frr = ast_frisolate(f);
-	}
-	if(frr == NULL)
-	{
-		ast_log(LOG_ERROR, "Failed to isolate frame for the jitterbuffer on channel '%s'\n", chan->name);
-		return -1;
-	}
-	
-	if(!ast_test_flag(jb, JB_CREATED))
-	{
-		if(create_jb(chan, frr))
-		{
-			ast_frfree(frr);
-			/* Disable the jitterbuffer */
-			ast_clear_flag(jb, JB_USE);
-			return -1;
-		}
-		
-		ast_set_flag(jb, JB_CREATED);
-		return 0;
-	}
-	else
-	{
-		now = get_now(jb, NULL);
-		if(jbimpl->put(jbobj, frr, now) != JB_IMPL_OK)
-		{
-			jb_framelog("JB_PUT {now=%ld}: Dropped frame with ts=%ld and len=%ld\n", now, frr->ts, frr->len);
-			ast_frfree(frr);
-			/*return -1;*/
-			/* TODO: Check this fix - should return 0 here, because the dropped frame shouldn't 
-			   be delivered at all */
-			return 0;
-		}
-		
-		jb->next = jbimpl->next(jbobj);
-		
-		jb_framelog("JB_PUT {now=%ld}: Queued frame with ts=%ld and len=%ld\n", now, frr->ts, frr->len);
-		
-		return 0;
-	}
-}
-
-
-void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1)
-{
-	struct ast_jb *jb0 = &c0->jb;
-	struct ast_jb *jb1 = &c1->jb;
-	int c0_use_jb = ast_test_flag(jb0, JB_USE);
-	int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED);
-	int c1_use_jb = ast_test_flag(jb1, JB_USE);
-	int c1_jb_is_created = ast_test_flag(jb1, JB_CREATED);
-	
-	if(c0_use_jb && c0_jb_is_created)
-	{
-		jb_get_and_deliver(c0);
-	}
-	
-	if(c1_use_jb && c1_jb_is_created)
-	{
-		jb_get_and_deliver(c1);
-	}
-}
-
-
-static void jb_get_and_deliver(struct ast_channel *chan)
-{
-	struct ast_jb *jb = &chan->jb;
-	struct ast_jb_impl *jbimpl = jb->impl;
-	void *jbobj = jb->jbobj;
-	struct ast_frame *f, finterp;
-	long now;
-	int interpolation_len, res;
-	
-	now = get_now(jb, NULL);
-	jb->next = jbimpl->next(jbobj);
-	if(now < jb->next)
-	{
-		jb_framelog("\tJB_GET {now=%ld}: now < next=%ld\n", now, jb->next);
-		return;
-	}
-	
-	while(now >= jb->next)
-	{
-		interpolation_len = ast_codec_interp_len(jb->last_format);
-		
-		res = jbimpl->get(jbobj, &f, now, interpolation_len);
-		
-		switch(res)
-		{
-		case JB_IMPL_OK:
-			/* deliver the frame */
-			ast_write(chan, f);
-		case JB_IMPL_DROP:
-			jb_framelog("\tJB_GET {now=%ld}: %s frame with ts=%ld and len=%ld\n",
-				now, jb_get_actions[res], f->ts, f->len);
-			jb->last_format = f->subclass;
-			ast_frfree(f);
-			break;
-		case JB_IMPL_INTERP:
-			/* interpolate a frame */
-			f = &finterp;
-			f->frametype = AST_FRAME_VOICE;
-			f->subclass = jb->last_format;
-			f->datalen  = 0;
-			f->samples  = interpolation_len * 8;
-			f->mallocd  = 0;
-			f->src  = "JB interpolation";
-			f->data  = NULL;
-			f->delivery = ast_tvadd(jb->timebase, ast_samp2tv(jb->next, 1000));
-			f->offset=AST_FRIENDLY_OFFSET;
-			/* deliver the interpolated frame */
-			ast_write(chan, f);
-			jb_framelog("\tJB_GET {now=%ld}: Interpolated frame with len=%d\n", now, interpolation_len);
-			break;
-		case JB_IMPL_NOFRAME:
-			ast_log(LOG_WARNING,
-				"JB_IMPL_NOFRAME is retuned from the %s jb when now=%ld >= next=%ld, jbnext=%ld!\n",
-				jbimpl->name, now, jb->next, jbimpl->next(jbobj));
-			jb_framelog("\tJB_GET {now=%ld}: No frame for now!?\n", now);
-			return;
-		default:
-			ast_log(LOG_ERROR, "This should never happen!\n");
-			CRASH;
-			break;
-		}
-		
-		jb->next = jbimpl->next(jbobj);
-	}
-}
-
-
-static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
-{
-	struct ast_jb *jb = &chan->jb;
-	struct ast_jb_conf *jbconf = &jb->conf;
-	struct ast_jb_impl *jbimpl = jb->impl;
-	void *jbobj;
-	struct ast_channel *bridged;
-	long now;
-	char logfile_pathname[20 + AST_JB_IMPL_NAME_SIZE + 2*AST_CHANNEL_NAME + 1];
-	char name1[AST_CHANNEL_NAME], name2[AST_CHANNEL_NAME], *tmp;
-	int res;
-
-	jbobj = jb->jbobj = jbimpl->create(jbconf, jbconf->resync_threshold);
-	if(jbobj == NULL)
-	{
-		ast_log(LOG_WARNING, "Failed to create jitterbuffer on channel '%s'\n", chan->name);
-		return -1;
-	}
-	
-	now = get_now(jb, NULL);
-	res = jbimpl->put_first(jbobj, frr, now);
-	
-	/* The result of putting the first frame should not differ from OK. However, its possible
-	   some implementations (i.e. stevek's when resynch_threshold is specified) to drop it. */
-	if(res != JB_IMPL_OK)
-	{
-		ast_log(LOG_WARNING, "Failed to put first frame in the jitterbuffer on channel '%s'\n", chan->name);
-		/*
-		jbimpl->destroy(jbobj);
-		return -1;
-		*/
-	}
-	
-	/* Init next */
-	jb->next = jbimpl->next(jbobj);
-	
-	/* Init last format for a first time. */
-	jb->last_format = frr->subclass;
-	
-	/* Create a frame log file */
-	if(ast_test_flag(jbconf, AST_JB_LOG))
-	{
-		snprintf(name2, sizeof(name2), "%s", chan->name);
-		tmp = strchr(name2, '/');
-		if(tmp != NULL)
-		{
-			*tmp = '#';
-		}
-		bridged = ast_bridged_channel(chan);
-		if(bridged == NULL)
-		{
-			/* We should always have bridged chan if a jitterbuffer is in use */
-			CRASH;
-		}
-		snprintf(name1, sizeof(name1), "%s", bridged->name);
-		tmp = strchr(name1, '/');
-		if(tmp != NULL)
-		{
-			*tmp = '#';
-		}
-		snprintf(logfile_pathname, sizeof(logfile_pathname),
-			"/tmp/ast_%s_jb_%s--%s.log", jbimpl->name, name1, name2);
-		jb->logfile = fopen(logfile_pathname, "w+b");
-		
-		if(jb->logfile == NULL)
-		{
-			ast_log(LOG_WARNING, "Failed to create frame log file with pathname '%s'\n", logfile_pathname);
-		}
-		
-		if(res == JB_IMPL_OK)
-		{
-			jb_framelog("JB_PUT_FIRST {now=%ld}: Queued frame with ts=%ld and len=%ld\n",
-				now, frr->ts, frr->len);
-		}
-		else
-		{
-			jb_framelog("JB_PUT_FIRST {now=%ld}: Dropped frame with ts=%ld and len=%ld\n",
-				now, frr->ts, frr->len);
-		}
-	}
-	
-	jb_verbose("%s jitterbuffer created on channel %s", jbimpl->name, chan->name);
-	
-	/* Free the frame if it has not been queued in the jb */
-	if(res != JB_IMPL_OK)
-	{
-		ast_frfree(frr);
-	}
-	
-	return 0;
-}
-
-
-void ast_jb_destroy(struct ast_channel *chan)
-{
-	struct ast_jb *jb = &chan->jb;
-	struct ast_jb_impl *jbimpl = jb->impl;
-	void *jbobj = jb->jbobj;
-	struct ast_frame *f;
-
-	if(jb->logfile != NULL)
-	{
-		fclose(jb->logfile);
-		jb->logfile = NULL;
-	}
-	
-	if(ast_test_flag(jb, JB_CREATED))
-	{
-		/* Remove and free all frames still queued in jb */
-		while(jbimpl->remove(jbobj, &f) == JB_IMPL_OK)
-		{
-			ast_frfree(f);
-		}
-		
-		jbimpl->destroy(jbobj);
-		jb->jbobj = NULL;
-		
-		ast_clear_flag(jb, JB_CREATED);
-		
-		jb_verbose("%s jitterbuffer destroyed on channel %s", jbimpl->name, chan->name);
-	}
-}
-
-
-static long get_now(struct ast_jb *jb, struct timeval *tv)
-{
-	struct timeval now;
-	
-	if(tv == NULL)
-	{
-		tv = &now;
-		gettimeofday(tv, NULL);
-	}
-	
-	return (long) ((tv->tv_sec - jb->timebase.tv_sec) * 1000) +
-		(long) ((double) (tv->tv_usec - jb->timebase.tv_usec) / 1000.0);
-	
-	/* TODO: For asterisk complience, we should use: */
-	/* return ast_tvdiff_ms(*tv, jb->timebase); */
-}
-
-
-int ast_jb_read_conf(struct ast_jb_conf *conf, char *varname, char *value)
-{
-	int prefixlen = sizeof(AST_JB_CONF_PREFIX) - 1;
-	char *name;
-	int tmp;
-	
-	if(memcmp(AST_JB_CONF_PREFIX, varname, prefixlen) != 0)
-	{
-		return -1;
-	}
-	
-	name = varname + prefixlen;
-	
-	if(strcmp(name, AST_JB_CONF_ENABLE) == 0)
-	{
-		if(ast_true(value))
-		{
-			conf->flags |= AST_JB_ENABLED;
-		}
-	}
-	else if(strcmp(name, AST_JB_CONF_FORCE) == 0)
-	{
-		if(ast_true(value))
-		{
-			conf->flags |= AST_JB_FORCED;
-		}
-	}
-	else if(strcmp(name, AST_JB_CONF_MAX_SIZE) == 0)
-	{
-		if((tmp = atoi(value)) > 0)
-		{
-			conf->max_size = tmp;
-		}
-	}
-	else if(strcmp(name, AST_JB_CONF_RESYNCH_THRESHOLD) == 0)
-	{
-		if((tmp = atoi(value)) > 0)
-		{
-			conf->resync_threshold = tmp;
-		}
-	}
-	else if(strcmp(name, AST_JB_CONF_IMPL) == 0)
-	{
-		if(*value)
-		{
-			snprintf(conf->impl, sizeof(conf->impl), "%s", value);
-		}
-	}
-	else if(strcmp(name, AST_JB_CONF_LOG) == 0)
-	{
-		if(ast_true(value))
-		{
-			conf->flags |= AST_JB_LOG;
-		}
-	}
-	else
-	{
-		return -1;
-	}
-	
-	return 0;
-}
-
-
-void ast_jb_configure(struct ast_channel *chan, struct ast_jb_conf *conf)
-{
-	struct ast_jb *jb = &chan->jb;
-	struct ast_jb_conf *jbconf = &jb->conf;
-	
-	memcpy(jbconf, conf, sizeof(struct ast_jb_conf));
-}
-
-
-void ast_jb_get_config(struct ast_channel *chan, struct ast_jb_conf *conf)
-{
-	struct ast_jb *jb = &chan->jb;
-	struct ast_jb_conf *jbconf = &jb->conf;
-	
-	memcpy(conf, jbconf, sizeof(struct ast_jb_conf));
-}
-
-
-/* Implementation functions */
-
-/* scx */
-
-static void * jb_create_scx(struct ast_jb_conf *general_config, long resynch_threshold)
-{
-	struct scx_jb_conf conf;
-	
-	conf.jbsize = general_config->max_size;
-	conf.resync_threshold = resynch_threshold;
-	
-	return scx_jb_new(&conf);
-}
-
-
-static void jb_destroy_scx(void *jb)
-{
-	struct scx_jb *scxjb = (struct scx_jb *) jb;
-	
-	/* destroy the jb */
-	scx_jb_destroy(scxjb);
-}
-
-
-static int jb_put_first_scx(void *jb, struct ast_frame *fin, long now)
-{
-	struct scx_jb *scxjb = (struct scx_jb *) jb;
-	int res;
-	
-	res = scx_jb_put_first(scxjb, fin, fin->len, fin->ts, now);
-	
-	return scx_to_abstract_code[res];
-}
-
-
-static int jb_put_scx(void *jb, struct ast_frame *fin, long now)
-{
-	struct scx_jb *scxjb = (struct scx_jb *) jb;
-	int res;
-	
-	res = scx_jb_put(scxjb, fin, fin->len, fin->ts, now);
-	
-	return scx_to_abstract_code[res];
-}
-
-
-static int jb_get_scx(void *jb, struct ast_frame **fout, long now, long interpl)
-{
-	struct scx_jb *scxjb = (struct scx_jb *) jb;
-	struct scx_jb_frame frame;
-	int res;
-	
-	res = scx_jb_get(scxjb, &frame, now, interpl);
-	*fout = frame.data;
-	
-	return scx_to_abstract_code[res];
-}
-
-
-static long jb_next_scx(void *jb)
-{
-	struct scx_jb *scxjb = (struct scx_jb *) jb;
-	
-	return scx_jb_next(scxjb);
-}
-
-
-static int jb_remove_scx(void *jb, struct ast_frame **fout)
-{
-	struct scx_jb *scxjb = (struct scx_jb *) jb;
-	struct scx_jb_frame frame;
-	int res;
-	
-	res = scx_jb_remove(scxjb, &frame);
-	*fout = frame.data;
-	
-	return scx_to_abstract_code[res];
-}
-
-
-static void jb_force_resynch_scx(void *jb)
-{
-	struct scx_jb *scxjb = (struct scx_jb *) jb;
-	
-	scx_jb_set_force_resynch(scxjb);
-}
-
-
-/* stevek */
-
-static void * jb_create_stevek(struct ast_jb_conf *general_config, long resynch_threshold)
-{
-	jb_conf jbconf;
-	jitterbuf *stevekjb;
-
-	stevekjb = jb_new();
-	if(stevekjb != NULL)
-	{
-		jbconf.max_jitterbuf = general_config->max_size;
-		jbconf.resync_threshold = general_config->resync_threshold;
-		jbconf.max_contig_interp = 10;
-		jb_setconf(stevekjb, &jbconf);
-	}
-	
-	return stevekjb;
-}
-
-
-static void jb_destroy_stevek(void *jb)
-{
-	jitterbuf *stevekjb = (jitterbuf *) jb;
-	
-	jb_destroy(stevekjb);
-}
-
-
-static int jb_put_first_stevek(void *jb, struct ast_frame *fin, long now)
-{
-	return jb_put_stevek(jb, fin, now);
-}
-
-
-static int jb_put_stevek(void *jb, struct ast_frame *fin, long now)
-{
-	jitterbuf *stevekjb = (jitterbuf *) jb;
-	int res;
-	
-	res = jb_put(stevekjb, fin, JB_TYPE_VOICE, fin->len, fin->ts, now);
-	
-	return stevek_to_abstract_code[res];
-}
-
-
-static int jb_get_stevek(void *jb, struct ast_frame **fout, long now, long interpl)
-{
-	jitterbuf *stevekjb = (jitterbuf *) jb;
-	jb_frame frame;
-	int res;
-	
-	res = jb_get(stevekjb, &frame, now, interpl);
-	*fout = frame.data;
-	
-	return stevek_to_abstract_code[res];
-}
-
-
-static long jb_next_stevek(void *jb)
-{
-	jitterbuf *stevekjb = (jitterbuf *) jb;
-	
-	return jb_next(stevekjb);
-}
-
-
-static int jb_remove_stevek(void *jb, struct ast_frame **fout)
-{
-	jitterbuf *stevekjb = (jitterbuf *) jb;
-	jb_frame frame;
-	int res;
-	
-	res = jb_getall(stevekjb, &frame);
-	*fout = frame.data;
-	
-	return stevek_to_abstract_code[res];
-}
-
-
-static void jb_force_resynch_stevek(void *jb)
-{
-}
-
-
-#endif /* AST_JB */
-
-
diff -urN asterisk-jb/apps/.svn/entries asterisk-vanilla/apps/.svn/entries
--- asterisk-jb/apps/.svn/entries	2006-01-19 11:37:44.000000000 +0100
+++ asterisk-vanilla/apps/.svn/entries	2006-01-19 11:43:18.000000000 +0100
@@ -113,12 +113,12 @@
 <entry
    committed-rev="8140"
    name="app_festival.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:17.000000Z"
    committed-date="2006-01-17T20:10:29.348516Z"
    checksum="3469f3499978e4421efe4716f90bbc20"
    last-author="mogorman"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:17.000000Z"/>
 <entry
    committed-rev="7221"
    name="app_softhangup.c"
@@ -302,12 +302,12 @@
 <entry
    committed-rev="8232"
    name="app_milliwatt.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:17.000000Z"
    committed-date="2006-01-19T04:17:45.294135Z"
    checksum="03eada8bd1cbb72ed15505f1c98cdb2e"
    last-author="russell"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:17.000000Z"/>
 <entry
    committed-rev="7221"
    name="app_parkandannounce.c"
@@ -329,12 +329,12 @@
 <entry
    committed-rev="8194"
    name="app_meetme.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:17.000000Z"
    committed-date="2006-01-18T21:02:06.962882Z"
    checksum="ddc1d4a73ffc0720c44341dd200381f1"
    last-author="mogorman"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:17.000000Z"/>
 <entry
    committed-rev="7221"
    name="app_test.c"
@@ -473,12 +473,12 @@
 <entry
    committed-rev="7999"
    name="app_voicemail.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:18.000000Z"
    committed-date="2006-01-12T06:14:22.978651Z"
    checksum="fe857c1ce43263caf3e7d15e35575831"
    last-author="tilghman"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:18.000000Z"/>
 <entry
    committed-rev="7957"
    name="app_dial.c"
diff -urN asterisk-jb/channel.c asterisk-vanilla/channel.c
--- asterisk-jb/channel.c	2006-01-19 11:42:53.000000000 +0100
+++ asterisk-vanilla/channel.c	2006-01-11 21:41:14.000000000 +0100
@@ -956,11 +956,6 @@
 	while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
 		ast_var_delete(vardata);
 
-#ifdef AST_JB
-	/* Destroy the jitterbuffer */
-	ast_jb_destroy(chan);
-#endif /* AST_JB */
-
 	free(chan);
 	ast_mutex_unlock(&chlock);
 
@@ -3219,10 +3214,6 @@
 	int watch_c0_dtmf;
 	int watch_c1_dtmf;
 	void *pvt0, *pvt1;
-#ifdef AST_JB
-	/* Indicates whether a frame was queued into a jitterbuffer */
-	int frame_put_in_jb;
-#endif /* AST_JB */
 	int to;
 	
 	cs[0] = c0;
@@ -3234,11 +3225,6 @@
 	watch_c0_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_0;
 	watch_c1_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_1;
 
-#ifdef AST_JB
-	/* Check the need of a jitterbuffer for each channel */
-	ast_jb_do_usecheck(c0, c1);
-#endif /* AST_JB */
-
 	for (;;) {
 		if ((c0->tech_pvt != pvt0) || (c1->tech_pvt != pvt1) ||
 		    (o0nativeformats != c0->nativeformats) ||
@@ -3252,17 +3238,8 @@
 			res = AST_BRIDGE_RETRY;
 			break;
 		}
-#ifdef AST_JB
-		/* Calculate the appropriate max sleep interval - in general, this is the time,
-		   left to the closest jb delivery moment */
-		to = ast_jb_get_when_to_wakeup(c0, c1, to);
-#endif /* AST_JB */
 		who = ast_waitfor_n(cs, 2, &to);
 		if (!who) {
-#ifdef AST_JB
-			/* No frame received within the specified timeout - check if we have to deliver now */
-			ast_jb_get_and_deliver(c0, c1);
-#endif /* AST_JB */
 			ast_log(LOG_DEBUG, "Nobody there, continuing...\n"); 
 			if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) {
 				if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE)
@@ -3283,11 +3260,6 @@
 			break;
 		}
 
-#ifdef AST_JB
-		/* Try add the frame info the who's bridged channel jitterbuff */
-		frame_put_in_jb = !ast_jb_put((who == c0) ? c1 : c0, f);
-#endif /* AST_JB */
-
 		if ((f->frametype == AST_FRAME_CONTROL) && !(config->flags & AST_BRIDGE_IGNORE_SIGS)) {
 			if ((f->subclass == AST_CONTROL_HOLD) || (f->subclass == AST_CONTROL_UNHOLD) ||
 			    (f->subclass == AST_CONTROL_VIDUPDATE)) {
@@ -3325,18 +3297,7 @@
 				last = who;
 #endif
 tackygoto:
-#ifdef AST_JB
-				/* Write immediately frames, not passed through jb */
-				if(!frame_put_in_jb)
-				{
-					ast_write((who == c0) ? c1 : c0, f);
-				}
-				
-				/* Check if we have to deliver now */
-				ast_jb_get_and_deliver(c0, c1);
-#else /* AST_JB */
 				ast_write((who == c0) ? c1 : c0, f);
-#endif /* AST_JB */
 			}
 		}
 		ast_frfree(f);
diff -urN asterisk-jb/channels/.svn/entries asterisk-vanilla/channels/.svn/entries
--- asterisk-jb/channels/.svn/entries	2006-01-19 11:37:44.000000000 +0100
+++ asterisk-vanilla/channels/.svn/entries	2006-01-19 11:43:18.000000000 +0100
@@ -125,21 +125,21 @@
 <entry
    committed-rev="8242"
    name="chan_sip.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:17.000000Z"
    committed-date="2006-01-19T04:56:48.032762Z"
    checksum="78703683d0b94bc26877329929e02bd4"
    last-author="russell"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:17.000000Z"/>
 <entry
    committed-rev="8047"
    name="chan_agent.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:17.000000Z"
    committed-date="2006-01-13T06:07:39.090149Z"
    checksum="d53e68a789bb91eda78d3f8f23e24a62"
    last-author="russell"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:17.000000Z"/>
 <entry
    committed-rev="7221"
    name="iax2-provision.c"
diff -urN asterisk-jb/channels/chan_iax2.c asterisk-vanilla/channels/chan_iax2.c
--- asterisk-jb/channels/chan_iax2.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/channels/chan_iax2.c	2006-01-11 21:41:17.000000000 +0100
@@ -101,19 +101,6 @@
 #include "../jitterbuf.h"
 #endif
 
-#ifdef AST_JB
-#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;
-#endif /* AST_JB */
-
 #ifndef IPTOS_MINCOST
 #define IPTOS_MINCOST 0x02
 #endif
@@ -607,9 +594,6 @@
 	int frames_dropped;
 	/*! received frame count: (just for stats) */
 	int frames_received;
-#ifdef AST_JB
-	struct ast_jb_conf jbconf;
-#endif /* AST_JB */
 };
 
 static struct ast_iax2_queue {
@@ -762,11 +746,7 @@
 	.type = channeltype,
 	.description = tdesc,
 	.capabilities = IAX_CAPABILITY_FULLBANDWIDTH,
-#ifdef AST_JB
-	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
-#else /* AST_JB */
 	.properties = AST_CHAN_TP_WANTSJITTER,
-#endif /* AST_JB */
 	.requester = iax2_request,
 	.devicestate = iax2_devicestate,
 	.send_digit = iax2_digit,
@@ -938,11 +918,6 @@
 			jb_setconf(tmp->jb,&jbconf);
 		}
 #endif
-		
-#ifdef AST_JB
-		/* Assign default jb conf to the new chan_iax2_pvt */
-		memcpy(&tmp->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
-#endif /* AST_JB */
 	}
 	return tmp;
 }
@@ -1435,12 +1410,6 @@
 	  the IAX thread with the iaxsl lock held. */
 	struct iax_frame *fr = data;
 	fr->retrans = -1;
-#ifdef AST_JB
-	fr->af.has_timing_info = 1;
-	fr->af.ts = fr->ts;
-	fr->af.len = ast_codec_get_samples(&fr->af) / 8;
-	fr->af.seqno = fr->iseqno;
-#endif /* AST_JB */
 	if (iaxs[fr->callno] && !ast_test_flag(iaxs[fr->callno], IAX_ALREADYGONE))
 		iax2_queue_frame(fr->callno, &fr->af);
 	/* Free our iax frame */
@@ -2243,9 +2212,6 @@
 			af.data  = NULL;
 			af.delivery = ast_tvadd(pvt->rxcore, ast_samp2tv(next, 1000));
 			af.offset=AST_FRIENDLY_OFFSET;
-#ifdef AST_JB
-			af.has_timing_info = 0;
-#endif /* AST_JB */
 	
 			/* queue the frame:  For consistency, we would call __do_deliver here, but __do_deliver wants an iax_frame,
 			 * which we'd need to malloc, and then it would free it.  That seems like a drag */
@@ -3465,10 +3431,6 @@
 		for (v = i->vars ; v ; v = v->next)
 			pbx_builtin_setvar_helper(tmp,v->name,v->value);
 		
-#ifdef AST_JB
-		/* Configure the new channel jb */
-		ast_jb_configure(tmp, &i->jbconf);
-#endif /* AST_JB */
 	}
 	return tmp;
 }
@@ -8643,11 +8605,6 @@
 
 	min_reg_expire = IAX_DEFAULT_REG_EXPIRE;
 	max_reg_expire = IAX_DEFAULT_REG_EXPIRE;
-	
-#ifdef AST_JB
-	/* Copy the default jb config over global_jbconf */
-	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
-#endif /* AST_JB */
 
 	v = ast_variable_browse(cfg, "general");
 
@@ -8658,15 +8615,6 @@
 			ast_log(LOG_WARNING, "Invalid tos value, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n");
 	}
 	while(v) {
-#ifdef AST_JB
-		/* handle jb conf */
-		if(ast_jb_read_conf(&global_jbconf, v->name, v->value) == 0)
-		{
-			v = v->next;
-			continue;
-		}
-#endif /* AST_JB */
-
 		if (!strcasecmp(v->name, "bindport")){ 
 			if (reload)
 				ast_log(LOG_NOTICE, "Ignoring bindport on reload\n");
diff -urN asterisk-jb/channels/chan_sip.c asterisk-vanilla/channels/chan_sip.c
--- asterisk-jb/channels/chan_sip.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/channels/chan_sip.c	2006-01-19 11:43:17.000000000 +0100
@@ -139,19 +139,6 @@
 #define DEBUG_READ	0			/* Recieved data	*/
 #define DEBUG_SEND	1			/* Transmit data	*/
 
-#ifdef AST_JB
-#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;
-#endif /* AST_JB */
-
 static const char desc[] = "Session Initiation Protocol (SIP)";
 static const char channeltype[] = "SIP";
 static const char config[] = "sip.conf";
@@ -701,9 +688,6 @@
 	struct ast_variable *chanvars;		/*!< Channel variables to set for call */
 	struct sip_pvt *next;			/*!< Next call in chain */
 	struct sip_invite_param *options;	/*!< Options for INVITE */
-#ifdef AST_JB
-	struct ast_jb_conf jbconf;
-#endif /* AST_JB */
 } *iflist = NULL;
 
 #define FLAG_RESPONSE (1 << 0)
@@ -943,11 +927,7 @@
 	.type = channeltype,
 	.description = "Session Initiation Protocol (SIP)",
 	.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
-#ifdef AST_JB
-	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
-#else /* AST_JB */
 	.properties = AST_CHAN_TP_WANTSJITTER,
-#endif /* AST_JB */
 	.requester = sip_request_call,
 	.devicestate = sip_devicestate,
 	.call = sip_call,
@@ -2843,14 +2823,6 @@
 	for (v = i->chanvars ; v ; v = v->next)
 		pbx_builtin_setvar_helper(tmp,v->name,v->value);
 				
-#ifdef AST_JB
-	/* Configure the new channel jb */
-	if(tmp != NULL && i != NULL && i->rtp != NULL)
-	{
-		ast_jb_configure(tmp, &i->jbconf);
-	}
-#endif /* AST_JB */
-				
 	return tmp;
 }
 
@@ -3119,11 +3091,6 @@
 		p->noncodeccapability |= AST_RTP_DTMF;
 	strcpy(p->context, default_context);
 
-#ifdef AST_JB
-	/* Assign default jb conf to the new sip_pvt */
-	memcpy(&p->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
-#endif /* AST_JB */
-
 	/* Add to active dialog list */
 	ast_mutex_lock(&iflock);
 	p->next = iflist;
@@ -12361,11 +12328,6 @@
 	tos = 0;
 	expiry = DEFAULT_EXPIRY;
 	global_allowguest = 1;
-	
-#ifdef AST_JB
-	/* Copy the default jb config over global_jbconf */
-	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
-#endif /* AST_JB */
 
 	/* Read the [general] config section of sip.conf (or from realtime config) */
 	v = ast_variable_browse(cfg, "general");
@@ -12374,14 +12336,6 @@
 			v = v->next;
 			continue;
 		}
-#ifdef AST_JB
-		/* handle jb conf */
-		if(ast_jb_read_conf(&global_jbconf, v->name, v->value) == 0)
-		{
-			v = v->next;
-			continue;
-		}
-#endif /* AST_JB */
 
 		/* Create the interface list */
 		if (!strcasecmp(v->name, "context")) {
diff -urN asterisk-jb/channels/chan_zap.c asterisk-vanilla/channels/chan_zap.c
--- asterisk-jb/channels/chan_zap.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/channels/chan_zap.c	2006-01-11 21:41:16.000000000 +0100
@@ -97,19 +97,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/transcap.h"
 
-#ifdef AST_JB
-#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;
-#endif /* AST_JB */
-
 #ifndef ZT_SIG_EM_E1
 #error "Your zaptel is too old.  please cvs update"
 #endif
@@ -696,9 +683,6 @@
 #endif	
 	int polarity;
 	int dsp_features;
-#ifdef AST_JB
-	struct ast_jb_conf jbconf;
-#endif /* AST_JB */
 
 } *iflist = NULL, *ifend = NULL;
 
@@ -5143,13 +5127,6 @@
 		}
 	} else
 		ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
-#ifdef AST_JB
-	/* Configure the new channel jb */
-	if(tmp != NULL && i != NULL)
-	{
-		ast_jb_configure(tmp, &i->jbconf);
-	}
-#endif /* AST_JB */
 	return tmp;
 }
 
@@ -6865,10 +6842,6 @@
 		for (x=0;x<3;x++)
 			tmp->subs[x].zfd = -1;
 		tmp->channel = channel;
-#ifdef AST_JB
-		/* Assign default jb conf to the new zt_pvt */
-		memcpy(&tmp->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
-#endif /* AST_JB */
 	}
 
 	if (tmp) {
@@ -10194,20 +10167,8 @@
 		}
 	}
 #endif
-#ifdef AST_JB
-	/* Copy the default jb config over global_jbconf */
-	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
-#endif /* AST_JB */
 	v = ast_variable_browse(cfg, "channels");
 	while(v) {
-#ifdef AST_JB
-		/* handle jb conf */
-		if(ast_jb_read_conf(&global_jbconf, v->name, v->value) == 0)
-		{
-			v = v->next;
-			continue;
-		}
-#endif /* AST_JB */
 		/* Create the interface list */
 		if (!strcasecmp(v->name, "channel")
 #ifdef ZAPATA_PRI
diff -urN asterisk-jb/configs/.svn/entries asterisk-vanilla/configs/.svn/entries
--- asterisk-jb/configs/.svn/entries	2006-01-19 11:37:44.000000000 +0100
+++ asterisk-vanilla/configs/.svn/entries	2006-01-19 11:43:18.000000000 +0100
@@ -229,12 +229,12 @@
 <entry
    committed-rev="7999"
    name="voicemail.conf.sample"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:18.000000Z"
    committed-date="2006-01-12T06:14:22.978651Z"
    checksum="3472eff3e13d71db74732a8d8e7e188d"
    last-author="tilghman"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:18.000000Z"/>
 <entry
    committed-rev="7221"
    name="misdn.conf.sample"
diff -urN asterisk-jb/configs/iax.conf.sample asterisk-vanilla/configs/iax.conf.sample
--- asterisk-jb/configs/iax.conf.sample	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/configs/iax.conf.sample	2006-01-11 21:41:51.000000000 +0100
@@ -147,32 +147,6 @@
 ;minexcessbuffer=10
 ;jittershrinkrate=1
 
-;------------------------------ GENERIC JITTER BUFFER CONFIGURATION ----------------
-; jb-enable = yes             ; Enables the use of a jitterbuffer on the receiving side of an
-                              ; IAX2 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 IAX2 channel can accept jitter,
-                              ; thus a jitterbuffer on the receive IAX2 side will be used only
-                              ; if it is forced and enabled.
-
-; jb-force = no               ; Forces the use of a jitterbuffer on the receive side of a IAX2
-                              ; channel. Defaults to "no".
-
-; jb-max-size = 200           ; Max length of the jitterbuffer in milliseconds.
-
-; jb-resynch-threshold = 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.
-
-; jb-impl = fixed             ; Jitterbuffer implementation, used on the receiving side of a IAX2
-                              ; channel. Two implementation are currenlty available - "fixed"
-                              ; (with size always equals to jb-max-size) and "adaptive" (with
-                              ; variable size, actually the new jb of IAX2). Defaults to fixed.
-
-; jb-log = no                 ; Enables jitterbuffer frame logging. Defaults to "no".
-;-----------------------------------------------------------------------------------
-
 ;trunkfreq=20			; How frequently to send trunk msgs (in ms)
 
 ; Should we send timestamps for the individual sub-frames within trunk frames?
diff -urN asterisk-jb/configs/sip.conf.sample asterisk-vanilla/configs/sip.conf.sample
--- asterisk-jb/configs/sip.conf.sample	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/configs/sip.conf.sample	2006-01-11 21:41:51.000000000 +0100
@@ -242,32 +242,6 @@
                           ; destinations which do not have a prior
                           ; account relationship with your server. 
 
-;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
-; jb-enable = 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.
-
-; jb-force = no               ; Forces the use of a jitterbuffer on the receive side of a SIP
-                              ; channel. Defaults to "no".
-
-; jb-max-size = 200           ; Max length of the jitterbuffer in milliseconds.
-
-; jb-resynch-threshold = 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.
-
-; jb-impl = fixed             ; Jitterbuffer implementation, used on the receiving side of a SIP
-                              ; channel. Two implementation are currenlty available - "fixed"
-                              ; (with size always equals to jb-max-size) and "adaptive" (with
-                              ; variable size, actually the new jb of IAX2). Defaults to fixed.
-
-; jb-log = no                 ; Enables jitterbuffer frame logging. Defaults to "no".
-;-----------------------------------------------------------------------------------
-
 [authentication]
 ; Global credentials for outbound calls, i.e. when a proxy challenges your
 ; Asterisk server for authentication. These credentials override
diff -urN asterisk-jb/configs/zapata.conf.sample asterisk-vanilla/configs/zapata.conf.sample
--- asterisk-jb/configs/zapata.conf.sample	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/configs/zapata.conf.sample	2006-01-11 21:41:51.000000000 +0100
@@ -472,33 +472,6 @@
 ;
 ;jitterbuffers=4
 ;
-;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
-; jb-enable = 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.
-
-; jb-force = no               ; Forces the use of a jitterbuffer on the receive side of a ZAP
-                              ; channel. Defaults to "no".
-
-; jb-max-size = 200           ; Max length of the jitterbuffer in milliseconds.
-
-; jb-resynch-threshold = 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.
-
-; jb-impl = fixed             ; Jitterbuffer implementation, used on the receiving side of a SIP
-                              ; channel. Two implementation are currenlty available - "fixed"
-                              ; (with size always equals to jb-max-size) and "adaptive" (with
-                              ; variable size, actually the new jb of IAX2). Defaults to fixed.
-
-; jb-log = 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
diff -urN asterisk-jb/frame.c asterisk-vanilla/frame.c
--- asterisk-jb/frame.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/frame.c	2006-01-11 21:41:24.000000000 +0100
@@ -318,16 +318,6 @@
 		out->offset = fr->offset;
 		out->src = NULL;
 		out->data = fr->data;
-#ifdef AST_JB
-		/* 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;
-		}
-#endif /* AST_JB */
 	} else {
 		out = fr;
 	}
@@ -391,15 +381,6 @@
 	out->prev = NULL;
 	out->next = NULL;
 	memcpy(out->data, f->data, out->datalen);	
-#ifdef AST_JB
-	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;
-	}
-#endif /* AST_JB */
 	return out;
 }
 
diff -urN asterisk-jb/funcs/.svn/entries asterisk-vanilla/funcs/.svn/entries
--- asterisk-jb/funcs/.svn/entries	2006-01-19 11:37:44.000000000 +0100
+++ asterisk-vanilla/funcs/.svn/entries	2006-01-19 11:43:18.000000000 +0100
@@ -68,12 +68,12 @@
 <entry
    committed-rev="8074"
    name="func_strings.c"
-   text-time="2006-01-19T10:37:43.000000Z"
+   text-time="2006-01-19T10:43:18.000000Z"
    committed-date="2006-01-14T19:06:44.607924Z"
    checksum="eacaa0e555fbd971ab5f6667213c1937"
    last-author="tilghman"
    kind="file"
-   prop-time="2006-01-19T10:37:43.000000Z"/>
+   prop-time="2006-01-19T10:43:18.000000Z"/>
 <entry
    committed-rev="7221"
    name="func_math.c"
diff -urN asterisk-jb/include/asterisk/abstract_jb.h asterisk-vanilla/include/asterisk/abstract_jb.h
--- asterisk-jb/include/asterisk/abstract_jb.h	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/include/asterisk/abstract_jb.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,203 +0,0 @@
-/*
- * abstract_jb: common implementation-independent jitterbuffer stuff
- *
- * Copyright (C) 2005, Attractel OOD
- *
- * Author:
- * Slav Klenov <slav@securax.org>
- */
-
-/*! \file
- *
- * \brief Common implementation-independent jitterbuffer stuff.
- * 
- */
-
-#ifndef _ABSTRACT_JB_H_
-#define _ABSTRACT_JB_H_
-
-#include <stdio.h>
-#include <sys/time.h>
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-struct ast_channel;
-struct ast_frame;
-
-
-/* Configuration flags */
-#define AST_JB_ENABLED         (1 << 0)
-#define AST_JB_FORCED          (1 << 1)
-#define AST_JB_LOG             (1 << 2)
-
-#define AST_JB_IMPL_NAME_SIZE 12
-
-/*!
- * \brief General jitterbuffer configuration.
- */
-struct ast_jb_conf
-{
-	/*! \brief Combination of the AST_JB_ENABLED, AST_JB_FORCED and AST_JB_LOG flags. */
-	unsigned int flags;
-	/*! \brief Max size of the jitterbuffer implementation. */
-	long max_size;
-	/*! \brief Resynchronization threshold of the jitterbuffer implementation. */
- 	long resync_threshold;
-	/*! \brief Name of the jitterbuffer implementation to be used. */
- 	char impl[AST_JB_IMPL_NAME_SIZE];
-};
-
-
-/* Jitterbuffer configuration property names */
-#define AST_JB_CONF_PREFIX "jb-"
-#define AST_JB_CONF_ENABLE "enable"
-#define AST_JB_CONF_FORCE "force"
-#define AST_JB_CONF_MAX_SIZE "max-size"
-#define AST_JB_CONF_RESYNCH_THRESHOLD "resynch-threshold"
-#define AST_JB_CONF_IMPL "impl"
-#define AST_JB_CONF_LOG "log"
-
-
-struct ast_jb_impl;
-
-
-/*!
- * \brief General jitterbuffer state.
- */
-struct ast_jb
-{
-	/*! \brief Jitterbuffer configuration. */
-	struct ast_jb_conf conf;
-	/*! \brief Jitterbuffer implementation to be used. */
-	struct ast_jb_impl *impl;
-	/*! \brief Jitterbuffer object, passed to the implementation. */
-	void *jbobj;
-	/*! \brief The time the jitterbuffer was created. */
-	struct timeval timebase;
-	/*! \brief The time the next frame should be played. */
-	long next;
-	/*! \brief Voice format of the last frame in. */
-	int last_format;
-	/*! \brief File for frame timestamp tracing. */
-	FILE *logfile;
-	/*! \brief Jitterbuffer internal state flags. */
-	unsigned int flags;
-};
-
-
-/*!
- * \brief Checks the need of a jb use in a generic bridge.
- * \param c0 first bridged channel.
- * \param c1 second bridged channel.
- *
- * Called from ast_generic_bridge() when two channels are entering in a bridge.
- * The function checks the need of a jitterbuffer, depending on both channel's
- * configuration and technology properties. As a result, this function sets
- * appropriate internal jb flags to the channels, determining further behaviour
- * of the bridged jitterbuffers.
- */
-void ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1);
-
-
-/*!
- * \brief Calculates the time, left to the closest delivery moment in a bridge.
- * \param c0 first bridged channel.
- * \param c1 second bridged channel.
- * \param time_left bridge time limit, or -1 if not set.
- *
- * Called from ast_generic_bridge() to determine the maximum time to wait for
- * activity in ast_waitfor_n() call. If neihter of the channels is using jb,
- * this function returns the time limit passed.
- *
- * \return maximum time to wait.
- */
-int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, int time_left);
-
-
-/*!
- * \brief Puts a frame into a channel jitterbuffer.
- * \param chan channel.
- * \param frame frame.
- *
- * Called from ast_generic_bridge() to put a frame into a channel's jitterbuffer.
- * The function will successfuly enqueue a frame if and only if:
- * 1. the channel is using a jitterbuffer (as determined by ast_jb_do_usecheck()),
- * 2. the frame's type is AST_FRAME_VOICE,
- * 3. the frame has timing info set and has length >= 2 ms,
- * 4. there is no some internal error happened (like failed memory allocation).
- * Frames, successfuly queued, should be delivered by the channel's jitterbuffer,
- * when their delivery time has came.
- * Frames, not successfuly queued, should be delivered immediately.
- * Dropped by the jb implementation frames are considered successfuly enqueued as
- * far as they should not be delivered at all.
- *
- * \return zero if the frame was queued, -1 if not.
- */
-int ast_jb_put(struct ast_channel *chan, struct ast_frame *f);
-
-
-/*!
- * \brief Deliver the queued frames that should be delivered now for both channels.
- * \param c0 first bridged channel.
- * \param c1 second bridged channel.
- *
- * Called from ast_generic_bridge() to deliver any frames, that should be delivered
- * for the moment of invocation. Does nothing if neihter of the channels is using jb
- * or has any frames currently queued in. The function delivers frames usig ast_write()
- * each of the channels.
- */
-void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1);
-
-
-/*!
- * \brief Destroys jitterbuffer on a channel.
- * \param chan channel.
- *
- * Called from ast_channel_free() when a channel is destroyed.
- */
-void ast_jb_destroy(struct ast_channel *chan);
-
-
-/*!
- * \brief Sets jitterbuffer configuration property.
- * \param conf configuration to store the property in.
- * \param varname property name.
- * \param value property value.
- *
- * Called from a channel driver to build a jitterbuffer configuration tipically when
- * reading a configuration file. It is not neccessary for a channel driver to know
- * each of the jb configuration property names. The jitterbuffer itself knows them.
- * The channel driver can pass each config var it reads through this function. It will
- * return 0 if the variable was consumed from the jb conf.
- *
- * \return zero if the property was set to the configuration, -1 if not.
- */
-int ast_jb_read_conf(struct ast_jb_conf *conf, char *varname, char *value);
-
-
-/*!
- * \brief Configures a jitterbuffer on a channel.
- * \param chan channel to configure.
- * \param conf configuration to apply.
- *
- * Called from a channel driver when a channel is created and its jitterbuffer needs
- * to be configured.
- */
-void ast_jb_configure(struct ast_channel *chan, struct ast_jb_conf *conf);
-
-
-/*!
- * \brief Copies a channel's jitterbuffer configuration.
- * \param chan channel.
- * \param conf destination.
- */
-void ast_jb_get_config(struct ast_channel *chan, struct ast_jb_conf *conf);
-
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _ABSTRACT_JB_H_ */
diff -urN asterisk-jb/include/asterisk/channel.h asterisk-vanilla/include/asterisk/channel.h
--- asterisk-jb/include/asterisk/channel.h	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/include/asterisk/channel.h	2006-01-11 21:41:22.000000000 +0100
@@ -86,10 +86,6 @@
 #ifndef _ASTERISK_CHANNEL_H
 #define _ASTERISK_CHANNEL_H
 
-#ifdef AST_JB
-#include "asterisk/abstract_jb.h"
-#endif /* AST_JB */
-
 #include <unistd.h>
 #include <setjmp.h>
 #ifdef POLLCOMPAT 
@@ -417,11 +413,6 @@
 
 	/*! For easy linking */
 	struct ast_channel *next;
-
-#ifdef AST_JB
-	/*! The jitterbuffer state  */
-	struct ast_jb jb;
-#endif /* AST_JB */
 };
 
 /* \defgroup chanprop Channel tech properties:
@@ -429,13 +420,6 @@
 /* @{ */
 #define AST_CHAN_TP_WANTSJITTER	(1 << 0)	
 
-#ifdef AST_JB
-/* \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)
-#endif /* AST_JB */
-
 /* 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 */
 #define AST_FLAG_DEFER_DTMF	(1 << 1)	/*!< if dtmf should be deferred */
diff -urN asterisk-jb/include/asterisk/frame.h asterisk-vanilla/include/asterisk/frame.h
--- asterisk-jb/include/asterisk/frame.h	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/include/asterisk/frame.h	2006-01-11 21:41:22.000000000 +0100
@@ -109,16 +109,6 @@
 	struct ast_frame *prev;			
 	/*! Next/Prev for linking stand alone frames */
 	struct ast_frame *next;			
-#ifdef AST_JB
-	/*! Timing data flag */
-	int has_timing_info;
-	/*! Timestamp in milliseconds */
-	long ts;
-	/*! Length in milliseconds */
-	long len;
-	/*! Sequence number */
-	int seqno;
-#endif /* AST_JB */
 };
 
 #define AST_FRIENDLY_OFFSET 	64	/*! It's polite for a a new frame to
diff -urN asterisk-jb/res/.svn/entries asterisk-vanilla/res/.svn/entries
--- asterisk-jb/res/.svn/entries	2006-01-19 11:37:44.000000000 +0100
+++ asterisk-vanilla/res/.svn/entries	2006-01-19 11:43:18.000000000 +0100
@@ -41,12 +41,12 @@
 <entry
    committed-rev="8134"
    name="res_features.c"
-   text-time="2006-01-19T10:37:44.000000Z"
+   text-time="2006-01-19T10:43:18.000000Z"
    committed-date="2006-01-17T18:29:57.417658Z"
    checksum="2503acad205eded302bdc87ebf6e5db0"
    last-author="mattf"
    kind="file"
-   prop-time="2006-01-19T10:37:44.000000Z"/>
+   prop-time="2006-01-19T10:43:18.000000Z"/>
 <entry
    committed-rev="7221"
    name="res_adsi.c"
diff -urN asterisk-jb/rtp.c asterisk-vanilla/rtp.c
--- asterisk-jb/rtp.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/rtp.c	2006-01-11 21:41:23.000000000 +0100
@@ -434,10 +434,7 @@
 	int padding;
 	int mark;
 	int ext;
-	/* Remove the variable for the pointless loop */
-#ifndef AST_JB
 	int x;
-#endif /* AST_JB */
 	char iabuf[INET_ADDRSTRLEN];
 	unsigned int timestamp;
 	unsigned int *rtpheader;
@@ -578,8 +575,6 @@
 	if (!rtp->lastrxts)
 		rtp->lastrxts = timestamp;
 
-	/* Remove this pointless loop - it will generate unnecessary CPU load on a big jump in seqno. */
-#ifndef AST_JB
 	if (rtp->rxseqno) {
 		for (x=rtp->rxseqno + 1; x < seqno; x++) {
 			/* Queue empty frames */
@@ -591,7 +586,6 @@
 			rtp->f.src = "RTPMissedFrame";
 		}
 	}
-#endif /* AST_JB */
 	rtp->rxseqno = seqno;
 
 	if (rtp->dtmfcount) {
@@ -623,13 +617,6 @@
 		if (rtp->f.subclass == AST_FORMAT_SLINEAR) 
 			ast_frame_byteswap_be(&rtp->f);
 		calc_rxstamp(&rtp->f.delivery, rtp, timestamp, mark);
-#ifdef AST_JB
-		/* 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;
-#endif /* AST_JB */
 	} else {
 		/* Video -- samples is # of samples vs. 90000 */
 		if (!rtp->lastividtimestamp)
diff -urN asterisk-jb/scx_jitterbuf.c asterisk-vanilla/scx_jitterbuf.c
--- asterisk-jb/scx_jitterbuf.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/scx_jitterbuf.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,364 +0,0 @@
-/*
- * scx_jitterbuf: jitterbuffering algorithm
- *
- * Copyright (C) 2005, Attractel OOD
- *
- * Author:
- * Slav Klenov <slav@securax.org>
- */
-
-/*! \file 
- * 
- * \brief Jitterbuffering algorithm.
- * 
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include "scx_jitterbuf.h"
-
-
-/* private scx_jb structure */
-struct scx_jb
-{
-	struct scx_jb_frame *frames;
-	struct scx_jb_frame *tail;
-	struct scx_jb_conf conf;
-	long rxcore;
-	long delay;
-	long next_delivery;
-	int force_resynch;
-};
-
-
-static struct scx_jb_frame * alloc_jb_frame(struct scx_jb *jb);
-static void release_jb_frame(struct scx_jb *jb, struct scx_jb_frame *frame);
-static void get_jb_head(struct scx_jb *jb, struct scx_jb_frame *frame);
-static int resynch_jb(struct scx_jb *jb, void *data, long ms, long ts, long now);
-
-
-static struct scx_jb_frame * alloc_jb_frame(struct scx_jb *jb)
-{
-	return (struct scx_jb_frame *) calloc(1, sizeof(struct scx_jb_frame));
-}
-
-
-static void release_jb_frame(struct scx_jb *jb, struct scx_jb_frame *frame)
-{
-	free(frame);
-}
-
-
-static void get_jb_head(struct scx_jb *jb, struct scx_jb_frame *frame)
-{
-	struct scx_jb_frame *fr;
-	
-	/* unlink the frame */
-	fr = jb->frames;
-	jb->frames = fr->next;
-	if(jb->frames != NULL)
-	{
-		jb->frames->prev = NULL;
-	}
-	else
-	{
-		/* the jb is empty - update tail */
-		jb->tail = NULL;
-	}
-	
-	/* update next */
-	jb->next_delivery = fr->delivery + fr->ms;
-	
-	/* copy the destination */
-	memcpy(frame, fr, sizeof(struct scx_jb_frame));
-	
-	/* and release the frame */
-	release_jb_frame(jb, fr);
-}
-
-
-struct scx_jb * scx_jb_new(struct scx_jb_conf *conf)
-{
-	struct scx_jb *jb;
-	
-	jb = calloc(1, sizeof(struct scx_jb));
-	if(jb == NULL)
-	{
-		return NULL;
-	}
-	
-	/* First copy our config */
-	memcpy(&jb->conf, conf, sizeof(struct scx_jb_conf));
-	/* we dont need the passed config anymore - continue working with the saved one */
-	conf = &jb->conf;
-	
-	/* validate the configuration */
-	if(conf->jbsize < 1)
-	{
-		conf->jbsize = SCX_JB_SIZE_DEFAULT;
-	}
-	if(conf->resync_threshold < 1)
-	{
-		conf->resync_threshold = SCX_JB_RESYNCH_THRESHOLD_DEFAULT;
-	}
-	
-	/* Set the constant delay to the jitterbuf */
-	jb->delay = conf->jbsize;
-	
-	return jb;
-}
-
-
-void scx_jb_destroy(struct scx_jb *jb)
-{
-	/* jitterbuf MUST be empty before it can be destroyed */
-	assert(jb->frames == NULL);
-	
-	free(jb);
-}
-
-
-static int resynch_jb(struct scx_jb *jb, void *data, long ms, long ts, long now)
-{
-	long diff, offset;
-	struct scx_jb_frame *frame;
-	
-	/* If jb is empty, just reinitialize the jb */
-	if(jb->frames == NULL)
-	{
-		/* debug check: tail should also be NULL */
-		assert(jb->tail == NULL);
-		
-		return scx_jb_put_first(jb, data, ms, ts, now);
-	}
-	
-	/* Adjust all jb state just as the new frame is with delivery = the delivery of the last
-	   frame (e.g. this one with max delivery) + the length of the last frame. */
-	
-	/* Get the diff in timestamps */
-	diff = ts - jb->tail->ts;
-	
-	/* Ideally this should be just the length of the last frame. The deviation is the desired
-	   offset */
-	offset = diff - jb->tail->ms;
-	
-	/* Do we really need to resynch, or this is just a frame for dropping? */
-	if(!jb->force_resynch && (offset < jb->conf.resync_threshold && offset > -jb->conf.resync_threshold))
-	{
-		return SCX_JB_DROP;
-	}
-	
-	/* Reset the force resynch flag */
-	jb->force_resynch = 0;
-	
-	/* apply the offset to the jb state */
-	jb->rxcore -= offset;
-	frame = jb->frames;
-	while(frame)
-	{
-		frame->ts += offset;
-		frame = frame->next;
-	}
-	
-	/* now jb_put() should add the frame at a last position */
-	return scx_jb_put(jb, data, ms, ts, now);
-}
-
-
-void scx_jb_set_force_resynch(struct scx_jb *jb)
-{
-	jb->force_resynch = 1;
-}
-
-
-int scx_jb_put_first(struct scx_jb *jb, void *data, long ms, long ts, long now)
-{
-	/* this is our first frame - set the base of the receivers time */
-	jb->rxcore = now - ts;
-	
-	/* init next for a first time - it should be the time the first frame should be played */
-	jb->next_delivery = now + jb->delay;
-	
-	/* put the frame */
-	return scx_jb_put(jb, data, ms, ts, now);
-}
-
-
-int scx_jb_put(struct scx_jb *jb, void *data, long ms, long ts, long now)
-{
-	struct scx_jb_frame *frame, *next, *newframe;
-	long delivery;
-	
-	/* debug check the validity of the input params */
-	assert(data != NULL);
-	/* do not allow frames shorter than 2 ms */
-	assert(ms >= 2);
-	assert(ts >= 0);
-	assert(now >= 0);
-	
-	delivery = jb->rxcore + jb->delay + ts;
-	
-	/* check if the new frame is not too late */
-	if(delivery < jb->next_delivery)
-	{
-		/* should drop the frame, but let first resynch_jb() check if this is not a jump in ts, or
-		   the force resynch flag was not set. */
-		return resynch_jb(jb, data, ms, ts, now);
-	}
-	
-	/* what if the delivery time is bigger than next + delay? Seems like a frame for the future.
-	   However, allow more resync_threshold ms in advance */
-	if(delivery > jb->next_delivery + jb->delay + jb->conf.resync_threshold)
-	{
-		/* should drop the frame, but let first resynch_jb() check if this is not a jump in ts, or
-		   the force resynch flag was not set. */
-		return resynch_jb(jb, data, ms, ts, now);
-	}
-
-	/* find the right place in the frames list, sorted by delivery time */
-	frame = jb->tail;
-	while(frame != NULL && frame->delivery > delivery)
-	{
-		frame = frame->prev;
-	}
-	
-	/* Check if the new delivery time is not covered already by the chosen frame */
-	if(frame && (frame->delivery == delivery ||
-		         delivery < frame->delivery + frame->ms ||
-		         (frame->next && delivery + ms > frame->next->delivery)))
-	{
-		/* TODO: Should we check for resynch here? Be careful to do not allow threshold smaller than
-		   the size of the jb */
-		
-		/* should drop the frame, but let first resynch_jb() check if this is not a jump in ts, or
-		   the force resynch flag was not set. */
-		return resynch_jb(jb, data, ms, ts, now);
-	}
-	
-	/* Reset the force resynch flag */
-	jb->force_resynch = 0;
-	
-	/* Get a new frame */
-	newframe = alloc_jb_frame(jb);
-	newframe->data = data;
-	newframe->ts = ts;
-	newframe->ms = ms;
-	newframe->delivery = delivery;
-	
-	/* and insert it right on place */
-	if(frame != NULL)
-	{
-		next = frame->next;
-		frame->next = newframe;
-		if(next != NULL)
-		{
-			newframe->next = next;
-			next->prev = newframe;
-		}
-		else
-		{
-			/* insert after the last frame - should update tail */
-			jb->tail = newframe;
-			newframe->next = NULL;
-		}
-		newframe->prev = frame;
-		
-		return SCX_JB_OK;
-	}
-	else if(jb->frames == NULL)
-	{
-		/* the frame list is empty or thats just the first frame ever */
-		/* tail should also be NULL is that case */
-		assert(jb->tail == NULL);
-		jb->frames = jb->tail = newframe;
-		newframe->next = NULL;
-		newframe->prev = NULL;
-		
-		return SCX_JB_OK;
-	}
-	else
-	{
-		/* insert on a first position - should update frames head */
-		newframe->next = jb->frames;
-		newframe->prev = NULL;
-		jb->frames->prev = newframe;
-		jb->frames = newframe;
-		
-		return SCX_JB_OK;
-	}
-}
-
-
-int scx_jb_get(struct scx_jb *jb, struct scx_jb_frame *frame, long now, long interpl)
-{
-	long halflen;
-	
-	assert(now >= 0);
-	assert(interpl >= 2);
-	
-	if(now < jb->next_delivery)
-	{
-		/* too early for the next frame */
-		return SCX_JB_NOFRAME;
-	}
-	
-	/* Is the jb empty? */
-	if(jb->frames == NULL)
-	{
-		/* should interpolate a frame */
-		/* update next */
-		jb->next_delivery += interpl;
-		
-		return SCX_JB_INTERP;
-	}
-	
-	halflen = (long) ((double) jb->frames->ms / 2.0);
-	
-	/* Isn't it too late for the first frame available in the jb? */
-	if(now > jb->frames->delivery + halflen)
-	{
-		/* yes - should drop this frame and update next to point the next frame (get_jb_head() does it) */
-		get_jb_head(jb, frame);
-		
-		return SCX_JB_DROP;
-	}
-	
-	/* isn't it too early to play the first frame available? */
-	if(now < jb->frames->delivery  - halflen)
-	{
-		/* yes - should interpolate one frame */
-		/* update next */
-		jb->next_delivery += interpl;
-		
-		return SCX_JB_INTERP;
-	}
-	
-	/* we have a frame for playing now (get_jb_head() updates next) */
-	get_jb_head(jb, frame);
-	
-	return SCX_JB_OK;
-}
-
-
-long scx_jb_next(struct scx_jb *jb)
-{
-	return jb->next_delivery;
-}
-
-
-int scx_jb_remove(struct scx_jb *jb, struct scx_jb_frame *frameout)
-{
-	if(jb->frames == NULL)
-	{
-		return SCX_JB_NOFRAME;
-	}
-	
-	get_jb_head(jb, frameout);
-	
-	return SCX_JB_OK;
-}
-
-
-
diff -urN asterisk-jb/scx_jitterbuf.h asterisk-vanilla/scx_jitterbuf.h
--- asterisk-jb/scx_jitterbuf.h	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/scx_jitterbuf.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,81 +0,0 @@
-/*
- * scx_jitterbuf: jitterbuffering algorithm
- *
- * Copyright (C) 2005, Attractel OOD
- *
- * Author:
- * Slav Klenov <slav@securax.org>
- */
-
-/*! \file 
- * 
- * \brief Jitterbuffering algorithm.
- * 
- */
-
-#ifndef _SCX_JITTERBUF_H_
-#define _SCX_JITTERBUF_H_
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-
-/* return codes */
-#define SCX_JB_OK		0
-#define SCX_JB_DROP		1
-#define SCX_JB_INTERP	2
-#define SCX_JB_NOFRAME	3
-
-
-/* defaults */
-#define SCX_JB_SIZE_DEFAULT 200
-#define SCX_JB_RESYNCH_THRESHOLD_DEFAULT 1000
-
-
-/* jb configuration properties */
-struct scx_jb_conf
-{
-	long jbsize;
- 	long resync_threshold;
-};
-
-
-struct scx_jb_frame
-{
-	void *data;
-	long ts;
-	long ms;
-	long delivery;
-	struct scx_jb_frame *next;
-	struct scx_jb_frame *prev;
-};
-
-
-struct scx_jb;
-
-
-/* jb interface */
-
-struct scx_jb * scx_jb_new(struct scx_jb_conf *conf);
-
-void scx_jb_destroy(struct scx_jb *jb);
-
-int scx_jb_put_first(struct scx_jb *jb, void *data, long ms, long ts, long now);
-
-int scx_jb_put(struct scx_jb *jb, void *data, long ms, long ts, long now);
-
-int scx_jb_get(struct scx_jb *jb, struct scx_jb_frame *frame, long now, long interpl);
-
-long scx_jb_next(struct scx_jb *jb);
-
-int scx_jb_remove(struct scx_jb *jb, struct scx_jb_frame *frameout);
-
-void scx_jb_set_force_resynch(struct scx_jb *jb);
-
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _SCX_JITTERBUF_H_ */
diff -urN asterisk-jb/translate.c asterisk-vanilla/translate.c
--- asterisk-jb/translate.c	2006-01-19 11:41:17.000000000 +0100
+++ asterisk-vanilla/translate.c	2006-01-11 21:41:22.000000000 +0100
@@ -156,17 +156,6 @@
 	struct ast_trans_pvt *p;
 	struct ast_frame *out;
 	struct timeval delivery;
-#ifdef AST_JB
-	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;
-#endif /* AST_JB */
 	p = path;
 	/* Feed the first frame into the first translator */
 	p->step->framein(p->state, f);
@@ -221,15 +210,6 @@
 			/* Invalidate prediction if we're entering a silence period */
 			if (out->frametype == AST_FRAME_CNG)
 				path->nextout = ast_tv(0, 0);
-#ifdef AST_JB
-			out->has_timing_info = has_timing_info;
-			if(has_timing_info)
-			{
-				out->ts = ts;
-				out->len = len;
-				out->seqno = seqno;
-			}
-#endif /* AST_JB */
 			return out;
 		}
 		p = p->next;
