[asterisk-commits] branch group/sip-threading r26717 - in
/team/group/sip-threading: ./ apps/ ch...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu May 11 00:46:10 MST 2006
Author: file
Date: Thu May 11 02:46:09 2006
New Revision: 26717
URL: http://svn.digium.com/view/asterisk?rev=26717&view=rev
Log:
Fix silly merges
Modified:
team/group/sip-threading/ (props changed)
team/group/sip-threading/apps/app_chanspy.c
team/group/sip-threading/apps/app_playback.c
team/group/sip-threading/apps/app_sendtext.c
team/group/sip-threading/channels/chan_iax2.c
team/group/sip-threading/channels/chan_sip.c
team/group/sip-threading/channels/chan_zap.c
team/group/sip-threading/configs/iax.conf.sample
team/group/sip-threading/configs/say.conf.sample
team/group/sip-threading/funcs/func_channel.c
team/group/sip-threading/netsock.c
team/group/sip-threading/pbx.c
team/group/sip-threading/pbx/pbx_realtime.c
team/group/sip-threading/res/res_monitor.c
team/group/sip-threading/rtp.c
Propchange: team/group/sip-threading/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu May 11 02:46:09 2006
@@ -1,1 +1,1 @@
-/trunk:1-26495
+/trunk:1-26716
Modified: team/group/sip-threading/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/apps/app_chanspy.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/apps/app_chanspy.c (original)
+++ team/group/sip-threading/apps/app_chanspy.c Thu May 11 02:46:09 2006
@@ -198,9 +198,9 @@
ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan->name, chan->name);
- ast_mutex_lock(&chan->lock);
+ ast_channel_lock(chan);
res = ast_channel_spy_add(chan, spy);
- ast_mutex_unlock(&chan->lock);
+ ast_channel_unlock(chan);
if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
@@ -219,9 +219,9 @@
if (!chan)
return;
- ast_mutex_lock(&chan->lock);
+ ast_channel_lock(chan);
ast_channel_spy_remove(chan, spy);
- ast_mutex_unlock(&chan->lock);
+ ast_channel_unlock(chan);
};
/* Map 'volume' levels from -4 through +4 into
Modified: team/group/sip-threading/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/apps/app_playback.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/apps/app_playback.c (original)
+++ team/group/sip-threading/apps/app_playback.c Thu May 11 02:46:09 2006
@@ -451,6 +451,16 @@
return res;
}
+static int reload(void *mod)
+{
+ if (say_cfg) {
+ ast_config_destroy(say_cfg);
+ ast_log(LOG_NOTICE, "Reloading say.conf\n");
+ }
+ say_cfg = ast_config_load("say.conf");
+ return 0;
+}
+
static int unload_module(void *mod)
{
int res;
@@ -464,6 +474,7 @@
static int load_module(void *mod)
{
+ reload(mod);
ast_cli_register_multiple(myclis, sizeof(myclis)/sizeof(struct ast_cli_entry));
return ast_register_application(app, playback_exec, synopsis, descrip);
}
@@ -478,4 +489,4 @@
return ASTERISK_GPL_KEY;
}
-STD_MOD1;
+STD_MOD(MOD_1,reload,NULL,NULL);
Modified: team/group/sip-threading/apps/app_sendtext.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/apps/app_sendtext.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/apps/app_sendtext.c (original)
+++ team/group/sip-threading/apps/app_sendtext.c Thu May 11 02:46:09 2006
@@ -93,9 +93,9 @@
priority_jump = 1;
}
- ast_mutex_lock(&chan->lock);
+ ast_channel_lock(chan);
if (!chan->tech->send_text) {
- ast_mutex_unlock(&chan->lock);
+ ast_channel_unlock(chan);
/* Does not support transport */
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
@@ -103,7 +103,7 @@
return 0;
}
status = "FAILURE";
- ast_mutex_unlock(&chan->lock);
+ ast_channel_unlock(chan);
res = ast_sendtext(chan, args.text);
if (!res)
status = "SUCCESS";
Modified: team/group/sip-threading/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/channels/chan_iax2.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/channels/chan_iax2.c (original)
+++ team/group/sip-threading/channels/chan_iax2.c Thu May 11 02:46:09 2006
@@ -98,10 +98,7 @@
#include "iax2.h"
#include "iax2-parser.h"
#include "iax2-provision.h"
-
-/* Define NEWJB to use the new channel independent jitterbuffer,
- * otherwise, use the old jitterbuffer */
-#define NEWJB
+#include "../jitterbuf.h"
/* Define SCHED_MULTITHREADED to run the scheduler in a special
multithreaded mode. */
@@ -110,10 +107,6 @@
/* Define DEBUG_SCHED_MULTITHREADED to keep track of where each
thread is actually doing. */
#define DEBUG_SCHED_MULTITHREAD
-
-#ifdef NEWJB
-#include "../jitterbuf.h"
-#endif
#ifndef IPTOS_MINCOST
#define IPTOS_MINCOST 0x02
@@ -166,11 +159,8 @@
static int maxtrunkcall = TRUNK_CALL_START;
static int maxnontrunkcall = 1;
static int maxjitterbuffer=1000;
-#ifdef NEWJB
static int resyncthreshold=1000;
static int maxjitterinterps=10;
-#endif
-static int jittershrinkrate=2;
static int trunkfreq = 20;
static int authdebug = 1;
static int autokill = 0;
@@ -219,8 +209,6 @@
static struct sched_context *sched;
static int iax2_capability = IAX_CAPABILITY_FULLBANDWIDTH;
-
-static int iax2_dropcount = DEFAULT_DROP;
static int iaxdebug = 0;
@@ -446,11 +434,6 @@
/* If consecutive voice frame timestamps jump by more than this many milliseconds, then jitter buffer will resync */
#define TS_GAP_FOR_JB_RESYNC 5000
-
-/* If we have more than this much excess real jitter buffer, shrink it. */
-static int max_jitter_buffer = MAX_JITTER_BUFFER;
-/* If we have less than this much excess real jitter buffer, enlarge it. */
-static int min_jitter_buffer = MIN_JITTER_BUFFER;
static int iaxthreadcount = DEFAULT_THREAD_COUNT;
static int iaxmaxthreadcount = DEFAULT_MAX_THREAD_COUNT;
@@ -506,21 +489,10 @@
struct timeval offset;
/*! timeval that we base our delivery on */
struct timeval rxcore;
-#ifdef NEWJB
/*! The jitterbuffer */
jitterbuf *jb;
/*! active jb read scheduler id */
int jbid;
-#else
- /*! Historical delivery time */
- int history[MEMORY_SIZE];
- /*! Current base jitterbuffer */
- int jitterbuffer;
- /*! Current jitter measure */
- int jitter;
- /*! Historic jitter value */
- int historicjitter;
-#endif
/*! LAG */
int lag;
/*! Error, as discovered by the manager */
@@ -738,7 +710,6 @@
ast_log(LOG_WARNING, "%s", data);
}
-#ifdef NEWJB
static void jb_error_output(const char *fmt, ...)
{
va_list args;
@@ -774,8 +745,6 @@
ast_verbose(buf);
}
-#endif
-
/* XXX We probably should use a mutex when working with this XXX */
static struct chan_iax2_pvt *iaxs[IAX_MAX_CALLS];
@@ -1058,6 +1027,7 @@
static struct chan_iax2_pvt *new_iax(struct sockaddr_in *sin, int lockpeer, const char *host)
{
struct chan_iax2_pvt *tmp;
+ jb_conf jbconf;
if (!(tmp = ast_calloc(1, sizeof(*tmp))))
return NULL;
@@ -1075,18 +1045,14 @@
/* ast_copy_string(tmp->context, context, sizeof(tmp->context)); */
ast_copy_string(tmp->exten, "s", sizeof(tmp->exten));
ast_copy_string(tmp->host, host, sizeof(tmp->host));
-#ifdef NEWJB
- {
- jb_conf jbconf;
-
- tmp->jb = jb_new();
- tmp->jbid = -1;
- jbconf.max_jitterbuf = maxjitterbuffer;
- jbconf.resync_threshold = resyncthreshold;
- jbconf.max_contig_interp = maxjitterinterps;
- jb_setconf(tmp->jb,&jbconf);
- }
-#endif
+
+ tmp->jb = jb_new();
+ tmp->jbid = -1;
+ jbconf.max_jitterbuf = maxjitterbuffer;
+ jbconf.resync_threshold = resyncthreshold;
+ jbconf.max_contig_interp = maxjitterinterps;
+ jb_setconf(tmp->jb,&jbconf);
+
return tmp;
}
@@ -1582,28 +1548,6 @@
return 0;
}
-#ifndef NEWJB
-static int __real_do_deliver(void *data)
-{
- /* Locking version of __do_deliver */
- struct iax_frame *fr = data;
- int callno = fr->callno;
- int res;
- ast_mutex_lock(&iaxsl[callno]);
- res = __do_deliver(data);
- ast_mutex_unlock(&iaxsl[callno]);
- return res;
-}
-static int do_deliver(void *data)
-{
-#ifdef SCHED_MULTITHREADED
- if (schedule_action(__do_deliver, data))
-#endif
- __real_do_deliver(data);
- return 0;
-}
-#endif /* NEWJB */
-
static int handle_error(void)
{
/* XXX Ideally we should figure out why an error occured and then abort those
@@ -1703,11 +1647,9 @@
if (pvt->initid > -1)
ast_sched_del(sched, pvt->initid);
pvt->initid = -1;
-#ifdef NEWJB
if (pvt->jbid > -1)
ast_sched_del(sched, pvt->jbid);
pvt->jbid = -1;
-#endif
}
static int iax2_predestroy(int callno)
@@ -1798,18 +1740,15 @@
if (pvt->reg)
pvt->reg->callno = 0;
if (!owner) {
+ jb_frame frame;
if (pvt->vars) {
- ast_variables_destroy(pvt->vars);
- pvt->vars = NULL;
+ ast_variables_destroy(pvt->vars);
+ pvt->vars = NULL;
}
-#ifdef NEWJB
- {
- jb_frame frame;
- while(jb_getall(pvt->jb,&frame) == JB_OK)
+
+ while (jb_getall(pvt->jb, &frame) == JB_OK)
iax2_frame_free(frame.data);
- jb_destroy(pvt->jb);
- }
-#endif
+ jb_destroy(pvt->jb);
free(pvt);
}
}
@@ -1938,43 +1877,6 @@
__attempt_transmit(data);
return 0;
}
-
-static int iax2_set_jitter(int fd, int argc, char *argv[])
-{
-#ifdef NEWJB
- ast_cli(fd, "sorry, this command is deprecated\n");
- return RESULT_SUCCESS;
-#else
- if ((argc != 4) && (argc != 5))
- return RESULT_SHOWUSAGE;
- if (argc == 4) {
- max_jitter_buffer = atoi(argv[3]);
- if (max_jitter_buffer < 0)
- max_jitter_buffer = 0;
- } else {
- if (argc == 5) {
- int callno = atoi(argv[3]);
- if ((callno >= 0) && (callno < IAX_MAX_CALLS)) {
- if (iaxs[callno]) {
- iaxs[callno]->jitterbuffer = atoi(argv[4]);
- if (iaxs[callno]->jitterbuffer < 0)
- iaxs[callno]->jitterbuffer = 0;
- } else
- ast_cli(fd, "No such call '%d'\n", callno);
- } else
- ast_cli(fd, "%d is not a valid call number\n", callno);
- }
- }
- return RESULT_SUCCESS;
-#endif
-}
-
-static char jitter_usage[] =
-"Usage: iax set jitter [callid] <value>\n"
-" If used with a callid, it sets the jitter buffer to the given static\n"
-"value (until its next calculation). If used without a callid, the value is used\n"
-"to establish the maximum excess jitter buffer that is permitted before the jitter\n"
-"buffer size is reduced.";
static int iax2_prune_realtime(int fd, int argc, char *argv[])
{
@@ -2300,7 +2202,6 @@
}
}
-#ifdef NEWJB
static int get_from_jb(void *p);
static void update_jbsched(struct chan_iax2_pvt *pvt)
@@ -2415,80 +2316,16 @@
__get_from_jb(data);
return 0;
}
-#endif
-
-/* while we transition from the old JB to the new one, we can either make two schedule_delivery functions, or
- * make preprocessor swiss-cheese out of this one. I'm not sure which is less revolting.. */
+
static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtrunk, unsigned int *tsout)
{
-#ifdef NEWJB
int type, len;
int ret;
int needfree = 0;
-#else
- int x;
- int ms;
- int delay;
- unsigned int orig_ts;
- int drops[MEMORY_SIZE];
- int min, max=0, prevjitterbuffer, maxone=0,y,z, match;
-
- /* Remember current jitterbuffer so we can log any change */
- prevjitterbuffer = iaxs[fr->callno]->jitterbuffer;
- /* Similarly for the frame timestamp */
- orig_ts = fr->ts;
-#endif
-
-#if 0
- if (option_debug && iaxdebug)
- ast_log(LOG_DEBUG, "schedule_delivery: ts=%d, last=%d, update=%d\n",
- fr->ts, iaxs[fr->callno]->last, updatehistory);
-#endif
/* Attempt to recover wrapped timestamps */
unwrap_timestamp(fr);
- if (updatehistory) {
-#ifndef NEWJB
-
- /* Attempt to spot a change of timebase on timestamps coming from the other side
- We detect by noticing a jump in consecutive timestamps that can't reasonably be explained
- by network jitter or reordering. Sometimes, also, the peer stops sending us frames
- for a while - in this case this code might also resync us. But that's not a bad thing.
- Be careful of non-voice frames which are timestamped differently (especially ACKS!)
- [that's why we only do this when updatehistory is true]
- */
- x = fr->ts - iaxs[fr->callno]->last;
- if (x > TS_GAP_FOR_JB_RESYNC || x < -TS_GAP_FOR_JB_RESYNC) {
- if (option_debug && iaxdebug)
- ast_log(LOG_DEBUG, "schedule_delivery: call=%d: TS jumped. resyncing rxcore (ts=%d, last=%d)\n",
- fr->callno, fr->ts, iaxs[fr->callno]->last);
- /* zap rxcore - calc_rxstamp will make a new one based on this frame */
- iaxs[fr->callno]->rxcore = ast_tv(0, 0);
- /* wipe "last" if stamps have jumped backwards */
- if (x<0)
- iaxs[fr->callno]->last = 0;
- /* should we also empty history? */
- }
- /* ms is a measure of the "lateness" of the frame relative to the "reference"
- frame we received. (initially the very first, but also see code just above here).
- Understand that "ms" can easily be -ve if lag improves since the reference frame.
- Called by IAX thread, with iaxsl lock held. */
- ms = calc_rxstamp(iaxs[fr->callno], fr->ts) - fr->ts;
-
- /* Rotate our history queue of "lateness". Don't worry about those initial
- zeros because the first entry will always be zero */
- for (x=0;x<MEMORY_SIZE - 1;x++)
- iaxs[fr->callno]->history[x] = iaxs[fr->callno]->history[x+1];
- /* Add a history entry for this one */
- iaxs[fr->callno]->history[x] = ms;
-#endif
- }
-#ifndef NEWJB
- else
- ms = 0;
-#endif
-
/* delivery time is sender's sent timestamp converted back into absolute time according to our clock */
if ( !fromtrunk && !ast_tvzero(iaxs[fr->callno]->rxcore))
@@ -2500,40 +2337,6 @@
fr->af.delivery = ast_tv(0,0);
}
-#ifndef NEWJB
- /* Initialize the minimum to reasonable values. It's too much
- work to do the same for the maximum, repeatedly */
- min=iaxs[fr->callno]->history[0];
- for (z=0;z < iax2_dropcount + 1;z++) {
- /* Start very optimistic ;-) */
- max=-999999999;
- for (x=0;x<MEMORY_SIZE;x++) {
- if (max < iaxs[fr->callno]->history[x]) {
- /* We have a candidate new maximum value. Make
- sure it's not in our drop list */
- match = 0;
- for (y=0;!match && (y<z);y++)
- match |= (drops[y] == x);
- if (!match) {
- /* It's not in our list, use it as the new maximum */
- max = iaxs[fr->callno]->history[x];
- maxone = x;
- }
-
- }
- if (!z) {
- /* On our first pass, find the minimum too */
- if (min > iaxs[fr->callno]->history[x])
- min = iaxs[fr->callno]->history[x];
- }
- }
-#if 1
- drops[z] = maxone;
-#endif
- }
-#endif
-
-#ifdef NEWJB
type = JB_TYPE_CONTROL;
len = 0;
@@ -2574,9 +2377,7 @@
*tsout = fr->ts;
__do_deliver(fr);
return -1;
-
- }
-
+ }
/* insert into jitterbuffer */
/* TODO: Perhaps we could act immediately if it's not droppable and late */
@@ -2587,88 +2388,6 @@
} else if (ret == JB_SCHED) {
update_jbsched(iaxs[fr->callno]);
}
-#else
- /* Just for reference, keep the "jitter" value, the difference between the
- earliest and the latest. */
- if (max >= min)
- iaxs[fr->callno]->jitter = max - min;
-
- /* IIR filter for keeping track of historic jitter, but always increase
- historic jitter immediately for increase */
-
- if (iaxs[fr->callno]->jitter > iaxs[fr->callno]->historicjitter )
- iaxs[fr->callno]->historicjitter = iaxs[fr->callno]->jitter;
- else
- iaxs[fr->callno]->historicjitter = GAMMA * (double)iaxs[fr->callno]->jitter + (1-GAMMA) *
- iaxs[fr->callno]->historicjitter;
-
- /* If our jitter buffer is too big (by a significant margin), then we slowly
- shrink it to avoid letting the change be perceived */
- if (max < iaxs[fr->callno]->jitterbuffer - max_jitter_buffer)
- iaxs[fr->callno]->jitterbuffer -= jittershrinkrate;
-
- /* If our jitter buffer headroom is too small (by a significant margin), then we slowly enlarge it */
- /* min_jitter_buffer should be SMALLER than max_jitter_buffer - leaving a "no mans land"
- in between - otherwise the jitterbuffer size will hunt up and down causing unnecessary
- disruption. Set maxexcessbuffer to say 150msec, minexcessbuffer to say 50 */
- if (max > iaxs[fr->callno]->jitterbuffer - min_jitter_buffer)
- iaxs[fr->callno]->jitterbuffer += jittershrinkrate;
-
- /* If our jitter buffer is smaller than our maximum delay, grow the jitter
- buffer immediately to accomodate it (and a little more). */
- if (max > iaxs[fr->callno]->jitterbuffer)
- iaxs[fr->callno]->jitterbuffer = max
- /* + ((float)iaxs[fr->callno]->jitter) * 0.1 */;
-
- /* update "min", just for RRs and stats */
- iaxs[fr->callno]->min = min;
-
- /* Subtract the lateness from our jitter buffer to know how long to wait
- before sending our packet. */
- delay = iaxs[fr->callno]->jitterbuffer - ms;
-
- /* Whatever happens, no frame waits longer than maxjitterbuffer */
- if (delay > maxjitterbuffer)
- delay = maxjitterbuffer;
-
- /* If jitter buffer is disabled then just pretend the frame is "right on time" */
- /* If frame came from trunk, also don't do any delay */
- if ( (!ast_test_flag(iaxs[fr->callno], IAX_USEJITTERBUF)) || fromtrunk )
- delay = 0;
-
- if (option_debug && iaxdebug) {
- /* Log jitter stats for possible offline analysis */
- ast_log(LOG_DEBUG, "Jitter: call=%d ts=%d orig=%d last=%d %s: min=%d max=%d jb=%d %+d lateness=%d jbdelay=%d jitter=%d historic=%d\n",
- fr->callno, fr->ts, orig_ts, iaxs[fr->callno]->last,
- (fr->af.frametype == AST_FRAME_VOICE) ? "VOICE" : "CONTROL",
- min, max, iaxs[fr->callno]->jitterbuffer,
- iaxs[fr->callno]->jitterbuffer - prevjitterbuffer,
- ms, delay,
- iaxs[fr->callno]->jitter, iaxs[fr->callno]->historicjitter);
- }
-
- if (delay < 1) {
- /* Don't deliver it more than 4 ms late */
- if ((delay > -4) || (fr->af.frametype != AST_FRAME_VOICE)) {
- if (option_debug && iaxdebug)
- ast_log(LOG_DEBUG, "schedule_delivery: Delivering immediately (Calculated delay is %d)\n", delay);
- if (tsout)
- *tsout = fr->ts;
- __do_deliver(fr);
- return -1;
- } else {
- if (option_debug && iaxdebug)
- ast_log(LOG_DEBUG, "schedule_delivery: Dropping voice packet since %dms delay is too old\n", delay);
- iaxs[fr->callno]->frames_dropped++;
- needfree++;
- }
- } else {
- if (option_debug && iaxdebug)
- ast_log(LOG_DEBUG, "schedule_delivery: Scheduling delivery in %d ms\n", delay);
- fr->retrans = ast_sched_add(sched, delay, do_deliver, fr);
- signal_condition(&sched_lock, &sched_cond);
- }
-#endif
if (tsout)
*tsout = fr->ts;
if (needfree) {
@@ -4607,21 +4326,6 @@
#undef FORMAT2
}
-#ifndef NEWJB
-static int jitterbufsize(struct chan_iax2_pvt *pvt) {
- int min, i;
- min = 99999999;
- for (i=0; i<MEMORY_SIZE; i++) {
- if (pvt->history[i] < min)
- min = pvt->history[i];
- }
- if (pvt->jitterbuffer - min > maxjitterbuffer)
- return maxjitterbuffer;
- else
- return pvt->jitterbuffer - min;
-}
-#endif
-
static int iax2_show_channels(int fd, int argc, char *argv[])
{
#define FORMAT2 "%-20.20s %-15.15s %-10.10s %-11.11s %-11.11s %-7.7s %-6.6s %-6.6s %s\n"
@@ -4650,7 +4354,6 @@
#endif
{
int lag, jitter, localdelay;
-#ifdef NEWJB
jb_info jbinfo;
if(ast_test_flag(iaxs[x], IAX_USEJITTERBUF)) {
@@ -4661,10 +4364,6 @@
jitter = -1;
localdelay = 0;
}
-#else
- jitter = iaxs[x]->jitter;
- localdelay = ast_test_flag(iaxs[x], IAX_USEJITTERBUF) ? jitterbufsize(iaxs[x]) : 0;
-#endif
lag = iaxs[x]->remote_rr.delay;
ast_cli(fd, FORMAT,
iaxs[x]->owner ? iaxs[x]->owner->name : "(None)",
@@ -4716,7 +4415,6 @@
{
int localjitter, localdelay, locallost, locallosspct, localdropped, localooo;
char *fmt;
-#ifdef NEWJB
jb_info jbinfo;
if(ast_test_flag(iaxs[x], IAX_USEJITTERBUF)) {
@@ -4735,17 +4433,6 @@
localdropped = 0;
localooo = -1;
}
-#else
- localjitter = iaxs[x]->jitter;
- if(ast_test_flag(iaxs[x], IAX_USEJITTERBUF))
- {
- localdelay = jitterbufsize(iaxs[x]);
- localdropped = iaxs[x]->frames_dropped;
- } else {
- localdelay = localdropped = 0;
- }
- locallost = locallosspct = localooo = -1;
-#endif
if (limit_fmt)
fmt = "%-25.25s %4d %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d\n";
else
@@ -4830,9 +4517,7 @@
{
if (argc != 3)
return RESULT_SHOWUSAGE;
-#ifdef NEWJB
jb_setoutput(jb_error_output, jb_warning_output, jb_debug_output);
-#endif
ast_cli(fd, "IAX2 Jitterbuffer Debugging Enabled\n");
return RESULT_SUCCESS;
}
@@ -4859,10 +4544,8 @@
{
if (argc != 4)
return RESULT_SHOWUSAGE;
-#ifdef NEWJB
jb_setoutput(jb_error_output, jb_warning_output, NULL);
jb_debug_output("\n");
-#endif
ast_cli(fd, "IAX2 Jitterbuffer Debugging Disabled\n");
return RESULT_SUCCESS;
}
@@ -5639,6 +5322,7 @@
int peercallno = 0;
struct chan_iax2_pvt *pvt = iaxs[callno];
struct iax_frame *cur;
+ jb_frame frame;
if (ies->callno)
peercallno = ies->callno;
@@ -5663,20 +5347,10 @@
pvt->transfercallno = -1;
memset(&pvt->rxcore, 0, sizeof(pvt->rxcore));
memset(&pvt->offset, 0, sizeof(pvt->offset));
-#ifdef NEWJB
- { /* reset jitterbuffer */
- jb_frame frame;
- while(jb_getall(pvt->jb,&frame) == JB_OK)
- iax2_frame_free(frame.data);
-
- jb_reset(pvt->jb);
- }
-#else
- memset(&pvt->history, 0, sizeof(pvt->history));
- pvt->jitterbuffer = 0;
- pvt->jitter = 0;
- pvt->historicjitter = 0;
-#endif
+ /* reset jitterbuffer */
+ while(jb_getall(pvt->jb,&frame) == JB_OK)
+ iax2_frame_free(frame.data);
+ jb_reset(pvt->jb);
pvt->lag = 0;
pvt->last = 0;
pvt->lastsent = 0;
@@ -6519,7 +6193,6 @@
static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep)
{
-#ifdef NEWJB
jb_info stats;
jb_getinfo(pvt->jb, &stats);
@@ -6532,18 +6205,6 @@
iax_ie_append_short(iep,IAX_IE_RR_DELAY, stats.current - stats.min);
iax_ie_append_int(iep,IAX_IE_RR_DROPPED, stats.frames_dropped);
iax_ie_append_int(iep,IAX_IE_RR_OOO, stats.frames_ooo);
-#else
- memset(iep, 0, sizeof(*iep));
- iax_ie_append_int(iep,IAX_IE_RR_JITTER, pvt->jitter);
- iax_ie_append_int(iep,IAX_IE_RR_PKTS, pvt->frames_received);
- if(!ast_test_flag(pvt, IAX_USEJITTERBUF))
- iax_ie_append_short(iep,IAX_IE_RR_DELAY, 0);
- else
- iax_ie_append_short(iep,IAX_IE_RR_DELAY, pvt->jitterbuffer - pvt->min);
- iax_ie_append_int(iep,IAX_IE_RR_DROPPED, pvt->frames_dropped);
- /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_OOO, 0); */
- /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_LOSS, 0); */
-#endif
}
static void save_rr(struct iax_frame *fr, struct iax_ies *ies)
@@ -9154,22 +8815,12 @@
}
else if (!strcasecmp(v->name, "maxjitterbuffer"))
maxjitterbuffer = atoi(v->value);
-#ifdef NEWJB
else if (!strcasecmp(v->name, "resyncthreshold"))
resyncthreshold = atoi(v->value);
else if (!strcasecmp(v->name, "maxjitterinterps"))
maxjitterinterps = atoi(v->value);
-#endif
- else if (!strcasecmp(v->name, "jittershrinkrate"))
- jittershrinkrate = atoi(v->value);
- else if (!strcasecmp(v->name, "maxexcessbuffer"))
- max_jitter_buffer = atoi(v->value);
- else if (!strcasecmp(v->name, "minexcessbuffer"))
- min_jitter_buffer = atoi(v->value);
else if (!strcasecmp(v->name, "lagrqtime"))
lagrq_time = atoi(v->value);
- else if (!strcasecmp(v->name, "dropcount"))
- iax2_dropcount = atoi(v->value);
else if (!strcasecmp(v->name, "maxregexpire"))
max_reg_expire = atoi(v->value);
else if (!strcasecmp(v->name, "minregexpire"))
@@ -9968,8 +9619,6 @@
#endif /* IAXTESTS */
static struct ast_cli_entry iax2_cli[] = {
- { { "iax2", "set", "jitter", NULL }, iax2_set_jitter,
- "Sets IAX jitter buffer", jitter_usage },
{ { "iax2", "show", "stats", NULL }, iax2_show_stats,
"Display IAX statistics", show_stats_usage },
{ { "iax2", "show", "cache", NULL }, iax2_show_cache,
@@ -10099,9 +9748,7 @@
iax_set_output(iax_debug_output);
iax_set_error(iax_error_output);
-#ifdef NEWJB
jb_setoutput(jb_error_output, jb_warning_output, NULL);
-#endif
#ifdef HAVE_ZAPTEL
#ifdef ZT_TIMERACK
Modified: team/group/sip-threading/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/channels/chan_sip.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/channels/chan_sip.c (original)
+++ team/group/sip-threading/channels/chan_sip.c Thu May 11 02:46:09 2006
@@ -2537,7 +2537,7 @@
case 420: /* Bad extension */
return AST_CAUSE_NO_ROUTE_DESTINATION;
case 480: /* No answer */
- return AST_CAUSE_FAILURE;
+ return AST_CAUSE_NO_ANSWER;
case 481: /* No answer */
return AST_CAUSE_INTERWORKING;
case 482: /* Loop detected */
@@ -12213,10 +12213,7 @@
/* If we're supposed to be stopped -- stay stopped */
if (monitor_thread == AST_PTHREADT_STOP)
return 0;
- if (ast_mutex_lock(&monlock)) {
- ast_log(LOG_WARNING, "Unable to lock monitor\n");
- return -1;
- }
+ ast_mutex_lock(&monlock);
if (monitor_thread == pthread_self()) {
ast_mutex_unlock(&monlock);
ast_log(LOG_WARNING, "Cannot kill myself\n");
@@ -14098,6 +14095,7 @@
ast_manager_unregister("SIPpeers");
ast_manager_unregister("SIPshowpeer");
+
/* Stop idle and active threads */
AST_LIST_LOCK(&idle_list);
while ((thread = AST_LIST_REMOVE_HEAD(&idle_list, entry))) {
@@ -14147,6 +14145,15 @@
return -1;
}
+ ast_mutex_lock(&monlock);
+ if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
+ pthread_cancel(monitor_thread);
+ pthread_kill(monitor_thread, SIGURG);
+ pthread_join(monitor_thread, NULL);
+ }
+ monitor_thread = AST_PTHREADT_STOP;
+ ast_mutex_unlock(&monlock);
+
AST_LIST_LOCK(&iflist);
AST_LIST_TRAVERSE(&iflist, p, entry) {
ast_mutex_destroy(&p->lock);
Modified: team/group/sip-threading/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/channels/chan_zap.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/channels/chan_zap.c (original)
+++ team/group/sip-threading/channels/chan_zap.c Thu May 11 02:46:09 2006
@@ -6539,10 +6539,7 @@
#endif
for(;;) {
/* Lock the interface list */
- if (ast_mutex_lock(&iflock)) {
- ast_log(LOG_ERROR, "Unable to grab interface lock\n");
- return NULL;
- }
+ ast_mutex_lock(&iflock);
if (!pfds || (lastalloc != ifcount)) {
if (pfds)
free(pfds);
@@ -6588,10 +6585,7 @@
}
/* Alright, lock the interface list again, and let's look and see what has
happened */
- if (ast_mutex_lock(&iflock)) {
- ast_log(LOG_WARNING, "Unable to lock the interface list\n");
- continue;
- }
+ ast_mutex_lock(&iflock);
found = 0;
spoint = 0;
lastpass = thispass;
@@ -6731,10 +6725,7 @@
/* If we're supposed to be stopped -- stay stopped */
if (monitor_thread == AST_PTHREADT_STOP)
return 0;
- if (ast_mutex_lock(&monlock)) {
- ast_log(LOG_WARNING, "Unable to lock monitor\n");
- return -1;
- }
+ ast_mutex_lock(&monlock);
if (monitor_thread == pthread_self()) {
ast_mutex_unlock(&monlock);
ast_log(LOG_WARNING, "Cannot kill myself\n");
@@ -7609,10 +7600,7 @@
}
}
/* Search for an unowned channel */
- if (ast_mutex_lock(lock)) {
- ast_log(LOG_ERROR, "Unable to lock interface list???\n");
- return NULL;
- }
+ ast_mutex_lock(lock);
exit = p;
while(p && !tmp) {
if (roundrobin)
@@ -10103,57 +10091,45 @@
ast_manager_unregister( "ZapDNDon" );
ast_manager_unregister("ZapShowChannels");
ast_channel_unregister(&zap_tech);
- if (!ast_mutex_lock(&iflock)) {
- /* Hangup all interfaces if they have an owner */
- p = iflist;
- while(p) {
- if (p->owner)
- ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
- p = p->next;
- }
- ast_mutex_unlock(&iflock);
- } else {
- ast_log(LOG_WARNING, "Unable to lock the monitor\n");
- return -1;
- }
- if (!ast_mutex_lock(&monlock)) {
- if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP) && (monitor_thread != AST_PTHREADT_NULL)) {
- pthread_cancel(monitor_thread);
- pthread_kill(monitor_thread, SIGURG);
- pthread_join(monitor_thread, NULL);
- }
- monitor_thread = AST_PTHREADT_STOP;
- ast_mutex_unlock(&monlock);
- } else {
- ast_log(LOG_WARNING, "Unable to lock the monitor\n");
- return -1;
- }
-
- if (!ast_mutex_lock(&iflock)) {
- /* Destroy all the interfaces and free their memory */
- p = iflist;
- while(p) {
- /* Free any callerid */
- if (p->cidspill)
- free(p->cidspill);
- /* Close the zapata thingy */
- if (p->subs[SUB_REAL].zfd > -1)
- zt_close(p->subs[SUB_REAL].zfd);
- pl = p;
- p = p->next;
- x++;
- /* Free associated memory */
- if(pl)
- destroy_zt_pvt(&pl);
- ast_verbose(VERBOSE_PREFIX_3 "Unregistered channel %d\n", x);
- }
- iflist = NULL;
- ifcount = 0;
- ast_mutex_unlock(&iflock);
- } else {
- ast_log(LOG_WARNING, "Unable to lock the monitor\n");
- return -1;
- }
+ ast_mutex_lock(&iflock);
+ /* Hangup all interfaces if they have an owner */
+ p = iflist;
+ while(p) {
+ if (p->owner)
+ ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
+ p = p->next;
+ }
+ ast_mutex_unlock(&iflock);
+ ast_mutex_lock(&monlock);
+ if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP) && (monitor_thread != AST_PTHREADT_NULL)) {
+ pthread_cancel(monitor_thread);
+ pthread_kill(monitor_thread, SIGURG);
+ pthread_join(monitor_thread, NULL);
+ }
+ monitor_thread = AST_PTHREADT_STOP;
+ ast_mutex_unlock(&monlock);
+
+ ast_mutex_lock(&iflock);
+ /* Destroy all the interfaces and free their memory */
+ p = iflist;
+ while(p) {
+ /* Free any callerid */
+ if (p->cidspill)
+ free(p->cidspill);
+ /* Close the zapata thingy */
+ if (p->subs[SUB_REAL].zfd > -1)
+ zt_close(p->subs[SUB_REAL].zfd);
+ pl = p;
+ p = p->next;
+ x++;
+ /* Free associated memory */
+ if(pl)
+ destroy_zt_pvt(&pl);
+ ast_verbose(VERBOSE_PREFIX_3 "Unregistered channel %d\n", x);
+ }
+ iflist = NULL;
+ ifcount = 0;
+ ast_mutex_unlock(&iflock);
#ifdef HAVE_LIBPRI
for(i=0;i<NUM_SPANS;i++) {
if (pris[i].master && (pris[i].master != AST_PTHREADT_NULL))
@@ -10204,11 +10180,8 @@
}
- if (ast_mutex_lock(&iflock)) {
- /* It's a little silly to lock it, but we mind as well just to be sure */
- ast_log(LOG_ERROR, "Unable to lock interface list???\n");
- return -1;
- }
+ /* It's a little silly to lock it, but we mind as well just to be sure */
+ ast_mutex_lock(&iflock);
#ifdef HAVE_LIBPRI
if (!reload) {
/* Process trunkgroups first */
Modified: team/group/sip-threading/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/configs/iax.conf.sample?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/configs/iax.conf.sample (original)
+++ team/group/sip-threading/configs/iax.conf.sample Thu May 11 02:46:09 2006
@@ -75,12 +75,6 @@
; The jitter buffer's function is to compensate for varying
; network delay.
;
-; There are presently two jitterbuffer implementations available for Asterisk
-; and chan_iax2; the classic and the new, channel/application independent
-; implementation. These are controlled at compile-time. The new jitterbuffer
-; additionally has support for PLC which greatly improves quality as the
-; jitterbuffer adapts size, and in compensating for lost packets.
-;
; All the jitter buffer settings except dropcount are in milliseconds.
; The jitter buffer works for INCOMING audio - the outbound audio
; will be dejittered by the jitter buffer at the other end.
@@ -93,12 +87,6 @@
; can each handle this. However, some endpoints may have poor jitterbuffers
; themselves, so this option will force * to always jitterbuffer, even in this
; case.
-; [This option presently applies only to the new jitterbuffer implementation]
-;
-; dropcount: the jitter buffer is sized such that no more than "dropcount"
-; frames would have been "too late" over the last 2 seconds.
-; Set to a small number. "3" represents 1.5% of frames dropped
-; [This option is not applicable to, and ignored by the new jitterbuffer implementation]
;
; maxjitterbuffer: a maximum size for the jitter buffer.
; Setting a reasonable maximum here will prevent the call delay
@@ -111,35 +99,13 @@
; change in delay is measured as twice the measured jitter plus this resync
; threshold.
; Resyncing can be disabled by setting this parameter to -1.
-; [This option presently applies only to the new jitterbuffer implementation]
;
; maxjitterinterps: the maximum number of interpolation frames the jitterbuffer
; should return in a row. Since some clients do not send CNG/DTX frames to
; indicate silence, the jitterbuffer will assume silence has begun after
; returning this many interpolations. This prevents interpolating throughout
; a long silence.
-; [This option presently applies only to the new jitterbuffer implementation]
-;
-; maxexcessbuffer: If conditions improve after a period of high jitter,
-; the jitter buffer can end up bigger than necessary. If it ends up
-; more than "maxexcessbuffer" bigger than needed, Asterisk will start
-; gradually decreasing the amount of jitter buffering.
-; This option is not applicable to,
-; and ignored by the new jitterbuffer implementation
-;
-; minexcessbuffer: Sets a desired mimimum amount of headroom in
-; the jitter buffer. If Asterisk has less headroom than this, then
-; it will start gradually increasing the amount of jitter buffering.
-; This option is not applicable to,
-; and ignored by the new jitterbuffer implementation
-;
-; jittershrinkrate: when the jitter buffer is being gradually shrunk
-; (or enlarged), how many millisecs shall we take off per 20ms frame
-; received? Use a small number, or you will be able to hear it
-; changing. An example: if you set this to 2, then the jitter buffer
-; size will change by 100 millisecs per second.
-; This option is not applicable to,
-; and ignored by the new jitterbuffer implementation
+;
jitterbuffer=no
forcejitterbuffer=no
Modified: team/group/sip-threading/configs/say.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/configs/say.conf.sample?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/configs/say.conf.sample (original)
+++ team/group/sip-threading/configs/say.conf.sample Thu May 11 02:46:09 2006
@@ -27,7 +27,7 @@
;
; Processing occurs as follows:
; If the format is empty, or there is no format, the entire
-; string is matched agains one of the pattern on the left hand side.
+; string is matched against one of the pattern on the left hand side.
; On the first match, the various comma-separated components on the right
; hand side are pronounced, as follows:
; + a component starting with a prefix: (i.e. with a ':' in it)
@@ -148,3 +148,24 @@
_time::. => date:IMp:${SAY}
+[de](date-base,digit-base)
+ _[n]um:0. => num:${SAY:1}
+ _[n]um:X => digits/${SAY}
+ _[n]um:1X => digits/${SAY}
+ _[n]um:[2-9]0 => digits/${SAY}
+ _[n]um:[2-9][2-9] => digits/${SAY:1}-and, digits/${SAY:0:1}0
+ _[n]um:1XX => digits/ein, digits/hundred, num:${SAY:1}
+ _[n]um:[2-9]XX => digits/${SAY:0:1}, digits/hundred, num:${SAY:1}
+ _[n]um:1XXX => digits/ein, digits/thousand, num:${SAY:1}
+ _[n]um:[2-9]XXX => digits/${SAY:0:1}, digits/thousand, num:${SAY:1}
+ _[n]um:XXXXX => num:${SAY:0:2}, digits/thousand, num:${SAY:2}
+ _[n]um:X00XXX => digits/${SAY:0:1}, digits/hundred, digits/thousand, num:${SAY:3}
+ _[n]um:XXXXXX => digits/${SAY:0:1}, digits/hundred, num:${SAY:1}
+ _[n]um:1XXXXXX => digits/eine, digits/million, num:${SAY:1}
+ _[n]um:[2-9]XXXXXX => digits/${SAY:0:1}, digits/millions, num:${SAY:1}
+ _[n]um:XXXXXXXX => num:${SAY:0:1}, digits/millions, num:${SAY:2}
+
+ _datetime::. => date:AdBY 'digits/at' IMp:${SAY}
+ _date::. => date:AdBY:${SAY}
+ _time::. => date:IMp:${SAY}
+
Modified: team/group/sip-threading/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/funcs/func_channel.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/funcs/func_channel.c (original)
+++ team/group/sip-threading/funcs/func_channel.c Thu May 11 02:46:09 2006
@@ -40,15 +40,15 @@
#include "asterisk/stringfields.h"
#define locked_copy_string(chan, dest, source, len) \
do { \
- ast_mutex_lock(&chan->lock); \
+ ast_channel_lock(chan); \
ast_copy_string(dest, source, len); \
- ast_mutex_unlock(&chan->lock); \
+ ast_channel_unlock(chan); \
} while (0)
#define locked_string_field_set(chan, field, source) \
do { \
- ast_mutex_lock(&chan->lock); \
+ ast_channel_lock(chan); \
ast_string_field_set(chan, field, source); \
- ast_mutex_unlock(&chan->lock); \
+ ast_channel_unlock(chan); \
} while (0)
static int func_channel_read(struct ast_channel *chan, char *function,
Modified: team/group/sip-threading/netsock.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/netsock.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/netsock.c (original)
+++ team/group/sip-threading/netsock.c Thu May 11 02:46:09 2006
@@ -85,11 +85,7 @@
struct ast_netsock_list *ast_netsock_list_alloc(void)
{
- struct ast_netsock_list *res;
-
- res = calloc(1, sizeof(*res));
-
- return res;
+ return ast_calloc(1, sizeof(struct ast_netsock_list));
}
int ast_netsock_init(struct ast_netsock_list *list)
@@ -149,27 +145,24 @@
if (setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)))
ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos);
- ns = ast_calloc(1, sizeof(struct ast_netsock));
- if (ns) {
- /* Establish I/O callback for socket read */
- ioref = ast_io_add(ioc, netsocket, callback, AST_IO_IN, ns);
- if (!ioref) {
- ast_log(LOG_WARNING, "Out of memory!\n");
- close(netsocket);
- free(ns);
- return NULL;
- }
- ASTOBJ_INIT(ns);
- ns->ioref = ioref;
- ns->ioc = ioc;
- ns->sockfd = netsocket;
- ns->data = data;
- memcpy(&ns->bindaddr, bindaddr, sizeof(ns->bindaddr));
- ASTOBJ_CONTAINER_LINK(list, ns);
- } else {
- ast_log(LOG_WARNING, "Out of memory!\n");
+ if (!(ns = ast_calloc(1, sizeof(struct ast_netsock)))) {
close(netsocket);
+ return NULL;
}
+
+ /* Establish I/O callback for socket read */
+ if (!(ioref = ast_io_add(ioc, netsocket, callback, AST_IO_IN, ns))) {
+ close(netsocket);
+ free(ns);
+ return NULL;
+ }
+ ASTOBJ_INIT(ns);
+ ns->ioref = ioref;
+ ns->ioc = ioc;
+ ns->sockfd = netsocket;
+ ns->data = data;
+ memcpy(&ns->bindaddr, bindaddr, sizeof(ns->bindaddr));
+ ASTOBJ_CONTAINER_LINK(list, ns);
return ns;
}
Modified: team/group/sip-threading/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/pbx.c?rev=26717&r1=26716&r2=26717&view=diff
==============================================================================
--- team/group/sip-threading/pbx.c (original)
+++ team/group/sip-threading/pbx.c Thu May 11 02:46:09 2006
@@ -569,6 +569,12 @@
* a pattern.
* ! zero or more of anything. Also impacts the result of CANMATCH
* and MATCHMORE. Only allowed at the end of a pattern.
+ * In the core routine, ! causes a match with a return code of 2.
[... 466 lines stripped ...]
More information about the asterisk-commits
mailing list