diff options
author | Joshua Colp <jcolp@digium.com> | 2007-01-13 04:04:04 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2007-01-13 04:04:04 +0000 |
commit | 033d849bda7d10d8521e003eee08603e6f83f95e (patch) | |
tree | 20f2172aec6f43a0820e82b3595879b8c1a0ba70 | |
parent | 0d781f9553366154c6e488a78ca3e5d0c4afc2c4 (diff) |
Drop trunkrealloc option and just have the maximum size be a configurable option. This is per Kevin's comments on -dev and my own thoughts after I put the previous option in.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | channels/chan_iax2.c | 20 | ||||
-rw-r--r-- | configs/iax.conf.sample | 6 |
3 files changed, 17 insertions, 11 deletions
@@ -60,7 +60,7 @@ Changes since Asterisk 1.4-beta was branched: what Asterisk should set as the maximum number of open files when it loads. * Added the jittertargetextra configuration option. * Added the URI redirect option for the built-in HTTP server - * Added the trunkrealloc configuration option to chan_iax2. + * Added the trunkmaxsize configuration option to chan_iax2. SIP changes ----------- diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index cd355b805..2026f92e8 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -164,8 +164,12 @@ static int maxjitterbuffer=1000; static int resyncthreshold=1000; static int maxjitterinterps=10; static int jittertargetextra = 40; /* number of milliseconds the new jitter buffer adds on to its size */ + +#define MAX_TRUNKDATA 640 * 200 /*!< 40ms, uncompressed linear * 200 channels */ + static int trunkfreq = 20; -static int trunkrealloc = 0; +static int trunkmaxsize = MAX_TRUNKDATA; + static int authdebug = 1; static int autokill = 0; static int iaxcompat = 0; @@ -449,7 +453,6 @@ static AST_LIST_HEAD_STATIC(registrations, iax2_registry); #define MIN_JITTER_BUFFER 10 #define DEFAULT_TRUNKDATA 640 * 10 /*!< 40ms, uncompressed linear * 10 channels */ -#define MAX_TRUNKDATA 640 * 200 /*!< 40ms, uncompressed linear * 200 channels */ #define MAX_TIMESTAMP_SKEW 160 /*!< maximum difference between actual and predicted ts for sending */ @@ -3650,7 +3653,7 @@ static int iax2_trunk_queue(struct chan_iax2_pvt *pvt, struct iax_frame *fr) if (tpeer) { if (tpeer->trunkdatalen + f->datalen + 4 >= tpeer->trunkdataalloc) { /* Need to reallocate space */ - if (tpeer->trunkdataalloc < MAX_TRUNKDATA || trunkrealloc) { + if (tpeer->trunkdataalloc < trunkmaxsize) { if (!(tmp = ast_realloc(tpeer->trunkdata, tpeer->trunkdataalloc + DEFAULT_TRUNKDATA + IAX2_TRUNK_PREFACE))) { ast_mutex_unlock(&tpeer->lock); return -1; @@ -6020,7 +6023,7 @@ static int timing_read(int *id, int fd, short events, void *cbdata) #endif struct timeval now; if (iaxtrunkdebug) - ast_verbose("Beginning trunk processing. Trunk queue ceiling is %d bytes per host\n", MAX_TRUNKDATA); + ast_verbose("Beginning trunk processing. Trunk queue ceiling is %d bytes per host\n", trunkmaxsize); gettimeofday(&now, NULL); if (events & AST_IO_PRI) { #ifdef ZT_TIMERACK @@ -8910,8 +8913,6 @@ static int set_config(char *config_file, int reload) maxauthreq = 3; - trunkrealloc = 0; - v = ast_variable_browse(cfg, "general"); /* Seed initial tos value */ @@ -9054,8 +9055,10 @@ static int set_config(char *config_file, int reload) else ast_log(LOG_NOTICE, "trunkmtu value out of bounds (%d) at line %d\n", mtuv, v->lineno); - } else if (!strcasecmp(v->name, "trunkrealloc")) { - trunkrealloc = ast_true(v->value); + } else if (!strcasecmp(v->name, "trunkmaxsize")) { + trunkmaxsize = atoi(v->value); + if (trunkmaxsize == 0) + trunkmaxsize = MAX_TRUNKDATA; } else if (!strcasecmp(v->name, "autokill")) { if (sscanf(v->value, "%d", &x) == 1) { if (x >= 0) @@ -9239,6 +9242,7 @@ static int reload_config(void) strcpy(mohinterpret, "default"); strcpy(mohsuggest, ""); global_max_trunk_mtu = MAX_TRUNK_MTU; + trunkmaxsize = MAX_TRUNKDATA; amaflags = 0; delayreject = 0; ast_clear_flag((&globalflags), IAX_NOTRANSFER); diff --git a/configs/iax.conf.sample b/configs/iax.conf.sample index 000c1751a..1857dc302 100644 --- a/configs/iax.conf.sample +++ b/configs/iax.conf.sample @@ -173,8 +173,10 @@ forcejitterbuffer=no ; trunkmtu = 0 ; -; Set the below option to yes to have the trunking size grow beyond the normal limit. -; trunkrealloc=yes +; This option defines the maximum size an IAX2 trunk can grow to. The default value is 128000 which +; represents 40ms uncompressed linear with 200 channels. Depending on different things though +; (codec in use and channels) you may need to make this value larger. +; trunkmaxsize = 128000 ; IAX helper threads |