[asterisk-commits] branch oej/siptransfer r34091 - in
/team/oej/siptransfer: ./ apps/ cdr/ chann...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Jun 14 07:15:54 MST 2006
Author: oej
Date: Wed Jun 14 09:15:54 2006
New Revision: 34091
URL: http://svn.digium.com/view/asterisk?rev=34091&view=rev
Log:
Update
Added:
team/oej/siptransfer/abstract_jb.c
- copied unchanged from r31250, trunk/abstract_jb.c
team/oej/siptransfer/include/asterisk/abstract_jb.h
- copied unchanged from r31250, trunk/include/asterisk/abstract_jb.h
team/oej/siptransfer/scx_jitterbuf.c
- copied unchanged from r31250, trunk/scx_jitterbuf.c
team/oej/siptransfer/scx_jitterbuf.h
- copied unchanged from r31250, trunk/scx_jitterbuf.h
Modified:
team/oej/siptransfer/ (props changed)
team/oej/siptransfer/.cleancount
team/oej/siptransfer/Makefile
team/oej/siptransfer/apps/app_dial.c
team/oej/siptransfer/apps/app_meetme.c
team/oej/siptransfer/cdr/cdr_radius.c
team/oej/siptransfer/channel.c
team/oej/siptransfer/channels/chan_alsa.c
team/oej/siptransfer/channels/chan_h323.c
team/oej/siptransfer/channels/chan_iax2.c
team/oej/siptransfer/channels/chan_jingle.c
team/oej/siptransfer/channels/chan_mgcp.c
team/oej/siptransfer/channels/chan_oss.c
team/oej/siptransfer/channels/chan_sip.c
team/oej/siptransfer/channels/chan_skinny.c
team/oej/siptransfer/channels/chan_zap.c
team/oej/siptransfer/cli.c
team/oej/siptransfer/configs/alsa.conf.sample
team/oej/siptransfer/configs/oss.conf.sample
team/oej/siptransfer/configs/sip.conf.sample
team/oej/siptransfer/configs/skinny.conf.sample
team/oej/siptransfer/configs/zapata.conf.sample
team/oej/siptransfer/frame.c
team/oej/siptransfer/include/asterisk/channel.h
team/oej/siptransfer/include/asterisk/frame.h
team/oej/siptransfer/res/res_agi.c
team/oej/siptransfer/rtp.c
team/oej/siptransfer/translate.c
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
automerge = http://edvina.net/training/
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jun 14 09:15:54 2006
@@ -1,1 +1,1 @@
-/trunk:1-30980
+/trunk:1-31273
Modified: team/oej/siptransfer/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/.cleancount?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/.cleancount (original)
+++ team/oej/siptransfer/.cleancount Wed Jun 14 09:15:54 2006
@@ -1,1 +1,1 @@
-17
+18
Modified: team/oej/siptransfer/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/Makefile?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/Makefile (original)
+++ team/oej/siptransfer/Makefile Wed Jun 14 09:15:54 2006
@@ -282,7 +282,7 @@
astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
- cryptostub.o sha1.o http.o
+ cryptostub.o sha1.o http.o scx_jitterbuf.o abstract_jb.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
@@ -371,7 +371,7 @@
@echo " + make install +"
@echo " +-------------------------------------------+"
-all: cleantest defaults.h config.status menuselect.makeopts depend asterisk subdirs
+all: cleantest config.status menuselect.makeopts depend asterisk subdirs
config.status: configure
@CFLAGS="" ./configure
@@ -907,6 +907,7 @@
cleantest:
@if cmp -s .cleancount .lastclean ; then echo ; else \
$(MAKE) clean; cp -f .cleancount .lastclean;\
+ $(MAKE) defaults.h;\
fi
_uninstall:
Modified: team/oej/siptransfer/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_dial.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_dial.c (original)
+++ team/oej/siptransfer/apps/app_dial.c Wed Jun 14 09:15:54 2006
@@ -117,6 +117,8 @@
" action post answer options in conjunction with this option.\n"
" h - Allow the called party to hang up by sending the '*' DTMF digit.\n"
" H - Allow the calling party to hang up by hitting the '*' DTMF digit.\n"
+" i - Asterisk will ignore any forwarding requests it may receive on this\n"
+" dial attempt.\n"
" j - Jump to priority n+101 if all of the requested channels were busy.\n"
" L(x[:y][:z]) - Limit the call to 'x' ms. Play a warning when 'y' ms are\n"
" left. Repeat the warning every 'z' ms. The following special\n"
@@ -233,6 +235,7 @@
OPT_OPERMODE = (1 << 24),
OPT_CALLEE_PARK = (1 << 25),
OPT_CALLER_PARK = (1 << 26),
+ OPT_IGNORE_FORWARDING = (1 << 27),
} dial_exec_option_flags;
#define DIAL_STILLGOING (1 << 30)
@@ -262,6 +265,7 @@
AST_APP_OPTION_ARG('G', OPT_GOTO, OPT_ARG_GOTO),
AST_APP_OPTION('h', OPT_CALLEE_HANGUP),
AST_APP_OPTION('H', OPT_CALLER_HANGUP),
+ AST_APP_OPTION('i', OPT_IGNORE_FORWARDING),
AST_APP_OPTION('j', OPT_PRIORITY_JUMP),
AST_APP_OPTION_ARG('L', OPT_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
AST_APP_OPTION_ARG('m', OPT_MUSICBACK, OPT_ARG_MUSICBACK),
@@ -479,10 +483,20 @@
ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
/* Setup parameters */
c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
- if (!c)
- ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
- else
- ast_channel_inherit_variables(in, o->chan);
+ /* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
+ if (ast_test_flag(peerflags, OPT_IGNORE_FORWARDING)) {
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", in->name, tech, stuff);
+ c = o->chan = NULL;
+ cause = AST_CAUSE_BUSY;
+ } else {
+ /* Setup parameters */
+ c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
+ if (!c)
+ ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
+ else
+ ast_channel_inherit_variables(in, o->chan);
+ }
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", c->name);
@@ -819,7 +833,7 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting operator services mode to %d.\n", opermode);
}
-
+
if (ast_test_flag(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
calldurationlimit = atoi(opt_args[OPT_ARG_DURATION_STOP]);
if (!calldurationlimit) {
@@ -1015,7 +1029,7 @@
/* If a channel group has been specified, get it for use when we create peer channels */
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
- ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP);
+ ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
/* loop through the list of dial destinations */
rest = args.peers;
while ((cur = strsep(&rest, "&")) ) {
@@ -1068,8 +1082,15 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", chan->name, tech, stuff, tmp->chan->name);
ast_hangup(tmp->chan);
- /* Setup parameters */
- tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause);
+ /* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
+ if (ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
+ tmp->chan = NULL;
+ cause = AST_CAUSE_BUSY;
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", chan->name, tech, stuff);
+ } else {
+ tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause);
+ }
if (!tmp->chan)
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
else
Modified: team/oej/siptransfer/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_meetme.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_meetme.c (original)
+++ team/oej/siptransfer/apps/app_meetme.c Wed Jun 14 09:15:54 2006
@@ -151,7 +151,7 @@
/*! If set, user will be asked to record name on entry of conference
* without review */
CONFFLAG_STARTMUTED = (1 << 24)
- /*! If set, the user will be initially muted by admin */
+ /*! If set, the user will be initially self-muted */
};
AST_APP_OPTIONS(meetme_opts, {
@@ -212,7 +212,7 @@
" 'i' -- announce user join/leave with review\n"
" 'I' -- announce user join/leave without review\n"
" 'l' -- set listen only mode (Listen only, no talking)\n"
-" 'm' -- set initially muted by admin\n"
+" 'm' -- set initially muted\n"
" 'M' -- enable music on hold when the conference has a single caller\n"
" 'o' -- set talker optimization - treats talkers who aren't speaking as\n"
" being muted, meaning (a) No encode is done on transmission and\n"
@@ -250,10 +250,10 @@
" 'K' -- Kick all users out of conference\n"
" 'l' -- Unlock conference\n"
" 'L' -- Lock conference\n"
-" 'm' -- Unmute conference\n"
-" 'M' -- Mute conference\n"
-" 'n' -- Unmute entire conference (except admin)\n"
-" 'N' -- Mute entire conference (except admin)\n"
+" 'm' -- Unmute one user\n"
+" 'M' -- Mute one user\n"
+" 'n' -- Unmute all users in the conference\n"
+" 'N' -- Mute all non-admin users in the conference\n"
" 'r' -- Reset one user's volume settings\n"
" 'R' -- Reset all users volume settings\n"
" 's' -- Lower entire conference speaking volume\n"
@@ -703,7 +703,7 @@
user->chan->name,
user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
- user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : "",
+ user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : user->adminflags & ADMINFLAG_SELFMUTED ? "(Muted)" : "",
istalking(user->talking), hr, min, sec);
else
ast_cli(fd, "%d!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n",
@@ -713,7 +713,7 @@
user->chan->name,
user->userflags & CONFFLAG_ADMIN ? "1" : "",
user->userflags & CONFFLAG_MONITOR ? "1" : "",
- user->adminflags & ADMINFLAG_MUTED ? "1" : "",
+ user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED) ? "1" : "",
user->talking, hr, min, sec);
}
@@ -964,7 +964,7 @@
user->chan = chan;
user->userflags = confflags;
- user->adminflags = (confflags & CONFFLAG_STARTMUTED) ? ADMINFLAG_MUTED : 0;
+ user->adminflags = (confflags & CONFFLAG_STARTMUTED) ? ADMINFLAG_SELFMUTED : 0;
user->talking = -1;
conf->users++;
/* Update table */
@@ -1376,7 +1376,7 @@
user->zapchannel = !retryzap;
goto zapretry;
}
- if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & ADMINFLAG_MUTED))
+ if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)))
f = ast_read_noaudio(c);
else
f = ast_read(c);
@@ -1480,13 +1480,16 @@
menu_active = 0;
/* for admin, change both admin and use flags */
- if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) {
+ if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))
user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
- if (!ast_streamfile(chan, "conf-unmuted", chan->language))
+ else
+ user->adminflags |= (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
+
+ if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))) {
+ if (!ast_streamfile(chan, "conf-muted", chan->language))
ast_waitstream(chan, "");
} else {
- user->adminflags |= (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
- if (!ast_streamfile(chan, "conf-muted", chan->language))
+ if (!ast_streamfile(chan, "conf-unmuted", chan->language))
ast_waitstream(chan, "");
}
break;
@@ -1555,7 +1558,7 @@
user->adminflags ^= ADMINFLAG_SELFMUTED;
/* they can't override the admin mute state */
- if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) {
+ if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))) {
if (!ast_streamfile(chan, "conf-muted", chan->language))
ast_waitstream(chan, "");
} else {
@@ -1615,7 +1618,7 @@
fr.offset = AST_FRIENDLY_OFFSET;
if (!user->listen.actual &&
((confflags & CONFFLAG_MONITOR) ||
- (user->adminflags & ADMINFLAG_MUTED) ||
+ (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) ||
(!user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
)) {
int index;
@@ -2297,13 +2300,13 @@
break;
case 109: /* m: Unmute */
if (user) {
- user->adminflags &= ~ADMINFLAG_MUTED;
+ user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
} else
ast_log(LOG_NOTICE, "Specified User not found!\n");
break;
case 110: /* n: Unmute all users */
AST_LIST_TRAVERSE(&cnf->userlist, user, list)
- user->adminflags &= ~ADMINFLAG_MUTED;
+ user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
break;
case 107: /* k: Kick user */
if (user)
@@ -2424,7 +2427,7 @@
if (mute)
user->adminflags |= ADMINFLAG_MUTED; /* request user muting */
else
- user->adminflags &= ~ADMINFLAG_MUTED; /* request user unmuting */
+ user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED); /* request user unmuting */
AST_LIST_UNLOCK(&confs);
Modified: team/oej/siptransfer/cdr/cdr_radius.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/cdr/cdr_radius.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/cdr/cdr_radius.c (original)
+++ team/oej/siptransfer/cdr/cdr_radius.c Wed Jun 14 09:15:54 2006
@@ -47,6 +47,7 @@
#include "asterisk/module.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
+#include "asterisk/options.h"
/*! ISO 8601 standard format */
#define DATE_FORMAT "%Y-%m-%d %T %z"
@@ -216,7 +217,8 @@
VALUE_PAIR *send = NULL;
if (build_radius_record(&send, cdr)) {
- ast_log(LOG_WARNING, "Unable to create RADIUS record. CDR not recorded!\n");
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Unable to create RADIUS record. CDR not recorded!\n");
return result;
}
Modified: team/oej/siptransfer/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channel.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channel.c (original)
+++ team/oej/siptransfer/channel.c Wed Jun 14 09:15:54 2006
@@ -1012,6 +1012,9 @@
while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
ast_var_delete(vardata);
+
+ /* Destroy the jitterbuffer */
+ ast_jb_destroy(chan);
ast_string_field_free_all(chan);
free(chan);
@@ -2548,7 +2551,12 @@
timeout = 0; /* trick to force exit from the while() */
break;
- case AST_CONTROL_PROGRESS: /* Ignore */
+ /* Ignore these */
+ case AST_CONTROL_PROGRESS:
+ case AST_CONTROL_PROCEEDING:
+ case AST_CONTROL_HOLD:
+ case AST_CONTROL_UNHOLD:
+ case AST_CONTROL_VIDUPDATE:
case -1: /* Ignore -- just stopping indications */
break;
@@ -3299,6 +3307,9 @@
int watch_c0_dtmf;
int watch_c1_dtmf;
void *pvt0, *pvt1;
+ /* Indicates whether a frame was queued into a jitterbuffer */
+ int frame_put_in_jb = 0;
+ int jb_in_use;
int to;
cs[0] = c0;
@@ -3310,6 +3321,9 @@
watch_c0_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_0;
watch_c1_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_1;
+ /* Check the need of a jitterbuffer for each channel */
+ jb_in_use = ast_jb_do_usecheck(c0, c1);
+
for (;;) {
struct ast_channel *who, *other;
@@ -3328,9 +3342,15 @@
}
} else
to = -1;
+ /* Calculate the appropriate max sleep interval - in general, this is the time,
+ left to the closest jb delivery moment */
+ if (jb_in_use)
+ to = ast_jb_get_when_to_wakeup(c0, c1, to);
who = ast_waitfor_n(cs, 2, &to);
if (!who) {
- ast_log(LOG_DEBUG, "Nobody there, continuing...\n");
+ /* No frame received within the specified timeout - check if we have to deliver now */
+ if (jb_in_use)
+ ast_jb_get_and_deliver(c0, c1);
if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) {
if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE)
c0->_softhangup = 0;
@@ -3350,6 +3370,9 @@
}
other = (who == c0) ? c1 : c0; /* the 'other' channel */
+ /* Try add the frame info the who's bridged channel jitterbuff */
+ if (jb_in_use)
+ frame_put_in_jb = !ast_jb_put(other, f);
if ((f->frametype == AST_FRAME_CONTROL) && !(config->flags & AST_BRIDGE_IGNORE_SIGS)) {
int bridge_exit = 0;
@@ -3386,8 +3409,13 @@
ast_log(LOG_DEBUG, "Got DTMF on channel (%s)\n", who->name);
break;
}
- /* other frames go to the other side */
- ast_write(other, f);
+ /* Write immediately frames, not passed through jb */
+ if (!frame_put_in_jb)
+ ast_write(other, f);
+
+ /* Check if we have to deliver now */
+ if (jb_in_use)
+ ast_jb_get_and_deliver(c0, c1);
}
/* XXX do we want to pass on also frames not matched above ? */
ast_frfree(f);
Modified: team/oej/siptransfer/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_alsa.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_alsa.c (original)
+++ team/oej/siptransfer/channels/chan_alsa.c Wed Jun 14 09:15:54 2006
@@ -60,6 +60,7 @@
#include "asterisk/causes.h"
#include "asterisk/endian.h"
#include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
#include "busy.h"
#include "ringtone.h"
@@ -69,6 +70,16 @@
#ifdef ALSA_MONITOR
#include "alsa-monitor.h"
#endif
+
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+ .flags = 0,
+ .max_size = -1,
+ .resync_threshold = -1,
+ .impl = ""
+};
+static struct ast_jb_conf global_jbconf;
#define DEBUG 0
/* Which device to use */
@@ -812,6 +823,8 @@
tmp = NULL;
}
}
+ if (tmp)
+ ast_jb_configure(tmp, &global_jbconf);
}
return tmp;
}
@@ -1051,9 +1064,18 @@
int x;
struct ast_config *cfg;
struct ast_variable *v;
+
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
if ((cfg = ast_config_load(config))) {
v = ast_variable_browse(cfg, "general");
while(v) {
+ /* handle jb conf */
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
+ v = v->next;
+ continue;
+ }
if (!strcasecmp(v->name, "autoanswer"))
autoanswer = ast_true(v->value);
else if (!strcasecmp(v->name, "silencesuppression"))
Modified: team/oej/siptransfer/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_h323.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_h323.c (original)
+++ team/oej/siptransfer/channels/chan_h323.c Wed Jun 14 09:15:54 2006
@@ -211,7 +211,7 @@
.type = "H323",
.description = tdesc,
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
- .properties = AST_CHAN_TP_WANTSJITTER,
+ .properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = oh323_request,
.send_digit = oh323_digit,
.call = oh323_call,
Modified: team/oej/siptransfer/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_iax2.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_iax2.c (original)
+++ team/oej/siptransfer/channels/chan_iax2.c Wed Jun 14 09:15:54 2006
@@ -1543,6 +1543,7 @@
the IAX thread with the iaxsl lock held. */
struct iax_frame *fr = data;
fr->retrans = -1;
+ fr->af.has_timing_info = 0;
if (iaxs[fr->callno] && !ast_test_flag(iaxs[fr->callno], IAX_ALREADYGONE))
iax2_queue_frame(fr->callno, &fr->af);
/* Free our iax frame */
Modified: team/oej/siptransfer/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_jingle.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_jingle.c (original)
+++ team/oej/siptransfer/channels/chan_jingle.c Wed Jun 14 09:15:54 2006
@@ -191,6 +191,7 @@
.indicate = jingle_indicate,
.fixup = jingle_fixup,
.send_html = jingle_sendhtml,
+ .properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER
};
static struct sockaddr_in bindaddr = { 0, }; /*!< The address we bind to */
Modified: team/oej/siptransfer/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_mgcp.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_mgcp.c (original)
+++ team/oej/siptransfer/channels/chan_mgcp.c Wed Jun 14 09:15:54 2006
@@ -503,7 +503,7 @@
.type = "MGCP",
.description = tdesc,
.capabilities = AST_FORMAT_ULAW,
- .properties = AST_CHAN_TP_WANTSJITTER,
+ .properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = mgcp_request,
.devicestate = mgcp_devicestate,
.call = mgcp_call,
Modified: team/oej/siptransfer/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_oss.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_oss.c (original)
+++ team/oej/siptransfer/channels/chan_oss.c Wed Jun 14 09:15:54 2006
@@ -75,12 +75,23 @@
#include "asterisk/causes.h"
#include "asterisk/endian.h"
#include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
/* ringtones we use */
#include "busy.h"
#include "ringtone.h"
#include "ring10.h"
#include "answer.h"
+
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+ .flags = 0,
+ .max_size = -1,
+ .resync_threshold = -1,
+ .impl = ""
+};
+static struct ast_jb_conf global_jbconf;
/*
* Basic mode of operation:
@@ -140,6 +151,33 @@
; unless you know what you are doing.
; queuesize = 10 ; frames in device driver
; frags = 8 ; argument to SETFRAGMENT
+
+ ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+ ; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an
+ ; OSS channel. Defaults to "no". An enabled jitterbuffer will
+ ; be used only if the sending side can create and the receiving
+ ; side can not accept jitter. The ZAP channel can't accept jitter,
+ ; thus an enabled jitterbuffer on the receive ZAP side will always
+ ; be used if the sending side can create jitter or if ZAP jb is
+ ; forced.
+
+ ; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a ZAP
+ ; channel. Defaults to "no".
+
+ ; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
+
+ ; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
+ ; resynchronized. Useful to improve the quality of the voice, with
+ ; big jumps in/broken timestamps, usualy sent from exotic devices
+ ; and programs. Defaults to 1000.
+
+ ; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
+ ; channel. Two implementation are currenlty available - "fixed"
+ ; (with size always equals to jbmax-size) and "adaptive" (with
+ ; variable size, actually the new jb of IAX2). Defaults to fixed.
+
+ ; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
+ ;-----------------------------------------------------------------------------------
[card1]
; device = /dev/dsp1 ; alternate device
@@ -981,6 +1019,9 @@
/* XXX what about usecnt ? */
}
}
+ if (c)
+ ast_jb_configure(c, &global_jbconf);
+
return c;
}
@@ -1407,6 +1448,10 @@
for (v = ast_variable_browse(cfg, ctg);v; v=v->next) {
M_START(v->name, v->value);
+ /* handle jb conf */
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
+ continue;
+
M_BOOL("autoanswer", o->autoanswer)
M_BOOL("autohangup", o->autohangup)
M_BOOL("overridecontext", o->overridecontext)
@@ -1472,6 +1517,9 @@
int i;
struct ast_config *cfg;
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
/* load config file */
cfg = ast_config_load(config);
if (cfg != NULL) {
Modified: team/oej/siptransfer/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_sip.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_sip.c (original)
+++ team/oej/siptransfer/channels/chan_sip.c Wed Jun 14 09:15:54 2006
@@ -139,6 +139,7 @@
#include "asterisk/stringfields.h"
#include "asterisk/monitor.h"
#include "asterisk/localtime.h"
+#include "asterisk/abstract_jb.h"
#ifndef FALSE
#define FALSE 0
@@ -201,6 +202,16 @@
#define SIP_MAX_PACKET 4096 /*!< Also from RFC 3261 (2543), should sub headers tho */
#define INITIAL_CSEQ 101 /*!< our initial sip sequence number */
+
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+ .flags = 0,
+ .max_size = -1,
+ .resync_threshold = -1,
+ .impl = ""
+};
+static struct ast_jb_conf global_jbconf;
static const char tdesc[] = "Session Initiation Protocol (SIP)";
static const char config[] = "sip.conf";
@@ -849,6 +860,7 @@
struct ast_variable *chanvars; /*!< Channel variables to set for inbound call */
struct sip_pvt *next; /*!< Next dialog in chain */
struct sip_invite_param *options; /*!< Options for INVITE */
+ struct ast_jb_conf jbconf;
} *iflist = NULL;
#define FLAG_RESPONSE (1 << 0)
@@ -1255,7 +1267,7 @@
.type = "SIP",
.description = "Session Initiation Protocol (SIP)",
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
- .properties = AST_CHAN_TP_WANTSJITTER,
+ .properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = sip_request_call,
.devicestate = sip_devicestate,
.call = sip_call,
@@ -1454,11 +1466,16 @@
* apply it to their address to see if we need to substitute our
* externip or can get away with our internal bindaddr
*/
- struct sockaddr_in theirs;
+ struct sockaddr_in theirs, ours;
+
+ /* Get our local information */
+ ast_ouraddrfor(them, us);
theirs.sin_addr = *them;
+ ours.sin_addr = *us;
if (localaddr && externip.sin_addr.s_addr &&
- ast_apply_ha(localaddr, &theirs)) {
+ ast_apply_ha(localaddr, &theirs) &&
+ !ast_apply_ha(localaddr, &ours)) {
if (externexpire && time(NULL) >= externexpire) {
struct ast_hostent ahp;
struct hostent *hp;
@@ -1478,8 +1495,6 @@
}
} else if (bindaddr.sin_addr.s_addr)
*us = bindaddr.sin_addr;
- else
- return ast_ouraddrfor(them, us);
return 0;
}
@@ -1586,8 +1601,8 @@
pkt->retransid = -1;
if (ast_test_flag(pkt, FLAG_FATAL)) {
- while(pkt->owner->owner && ast_mutex_trylock(&pkt->owner->owner->lock)) {
- ast_mutex_unlock(&pkt->owner->lock);
+ while(pkt->owner->owner && ast_channel_trylock(pkt->owner->owner)) {
+ ast_mutex_unlock(&pkt->owner->lock); /* SIP_PVT, not channel */
usleep(1);
ast_mutex_lock(&pkt->owner->lock);
}
@@ -2353,7 +2368,7 @@
/* XXX fails on possible deadlock */
if (!ast_mutex_trylock(&p->owner->lock)) {
ast_log(LOG_NOTICE, "Auto-congesting %s\n", p->owner->name);
- append_history(p, "Congestion", "Auto");
+ append_history(p, "Cong", "Auto-congesting (timer)");
ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
ast_mutex_unlock(&p->owner->lock);
}
@@ -3355,6 +3370,11 @@
append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);
if (option_debug > 2)
ast_log(LOG_DEBUG, "Created owner %s\n", tmp->name);
+
+ /* Configure the new channel jb */
+ if (tmp && i && i->rtp)
+ ast_jb_configure(tmp, &i->jbconf);
+
return tmp;
}
@@ -3688,6 +3708,9 @@
(ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
p->noncodeccapability |= AST_RTP_DTMF;
ast_string_field_set(p, context, default_context);
+
+ /* Assign default jb conf to the new sip_pvt */
+ memcpy(&p->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
/* Add to active dialog list */
ast_mutex_lock(&iflock);
@@ -7260,7 +7283,7 @@
sip_pvt_ptr->theirtag, sip_pvt_ptr->tag);
/* deadlock avoidance... */
- while (sip_pvt_ptr->owner && ast_mutex_trylock(&sip_pvt_ptr->owner->lock)) {
+ while (sip_pvt_ptr->owner && ast_channel_trylock(sip_pvt_ptr->owner)) {
ast_mutex_unlock(&sip_pvt_ptr->lock);
usleep(1);
ast_mutex_lock(&sip_pvt_ptr->lock);
@@ -12324,7 +12347,8 @@
return -1;
}
- if (sipdebug && option_debug > 3)
+
+ if (current.chan2 && sipdebug && option_debug > 3)
ast_log(LOG_DEBUG, "Got SIP transfer, applying to bridged peer '%s'\n", current.chan2->name);
/* Stop music on hold on this channel */
@@ -14114,7 +14138,6 @@
for (; v; v = v->next) {
if (handle_common_options(&peerflags[0], &mask[0], v))
continue;
-
if (realtime && !strcasecmp(v->name, "regseconds")) {
ast_get_time_t(v->value, ®seconds, 0, NULL);
} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
@@ -14410,11 +14433,18 @@
global_relaxdtmf = FALSE;
global_callevents = FALSE;
global_t1min = DEFAULT_T1MIN;
+
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
ast_clear_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT);
/* Read the [general] config section of sip.conf (or from realtime config) */
for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
if (handle_common_options(&global_flags[0], &dummy[0], v))
+ continue;
+ /* handle jb conf */
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
continue;
/* Create the interface list */
Modified: team/oej/siptransfer/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_skinny.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_skinny.c (original)
+++ team/oej/siptransfer/channels/chan_skinny.c Wed Jun 14 09:15:54 2006
@@ -69,6 +69,7 @@
#include "asterisk/utils.h"
#include "asterisk/dsp.h"
#include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
/*************************************
* Skinny/Asterisk Protocol Settings *
@@ -116,6 +117,15 @@
#define htoles(x) __bswap_16(x)
#endif
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+ .flags = 0,
+ .max_size = -1,
+ .resync_threshold = -1,
+ .impl = ""
+};
+static struct ast_jb_conf global_jbconf;
/*********************
* Protocol Messages *
@@ -816,6 +826,8 @@
int nat;
int outgoing;
int alreadygone;
+ struct ast_jb_conf jbconf;
+
struct skinny_subchannel *next;
};
@@ -909,7 +921,7 @@
.type = "Skinny",
.description = tdesc,
.capabilities = AST_FORMAT_ULAW,
- .properties = AST_CHAN_TP_WANTSJITTER,
+ .properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = skinny_request,
.call = skinny_call,
.hangup = skinny_hangup,
@@ -1603,6 +1615,10 @@
callnums++;
sub->cxmode = SKINNY_CX_INACTIVE;
sub->nat = nat;
+
+ /* Assign default jb conf to the new skinny_subchannel */
+ memcpy(&sub->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
+
sub->next = l->sub;
l->sub = sub;
} else {
@@ -2292,6 +2308,10 @@
tmp = NULL;
}
}
+
+ /* Configure the new channel jb */
+ if (tmp && sub && sub->rtp)
+ ast_jb_configure(tmp, &sub->jbconf);
} else {
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
}
@@ -3094,10 +3114,21 @@
ast_log(LOG_NOTICE, "Unable to load config %s, Skinny disabled\n", config);
return 0;
}
+ memset(&bindaddr, 0, sizeof(bindaddr));
+
+ /* Copy the default jb config over global_jbconf */
+ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
/* load the general section */
- memset(&bindaddr, 0, sizeof(bindaddr));
v = ast_variable_browse(cfg, "general");
while(v) {
+ /* handle jb conf */
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
+ {
+ v = v->next;
+ continue;
+ }
+
/* Create the interface list */
if (!strcasecmp(v->name, "bindaddr")) {
if (!(hp = ast_gethostbyname(v->value, &ahp))) {
Modified: team/oej/siptransfer/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_zap.c?rev=34091&r1=34090&r2=34091&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_zap.c (original)
+++ team/oej/siptransfer/channels/chan_zap.c Wed Jun 14 09:15:54 2006
@@ -103,14 +103,25 @@
#include "asterisk/utils.h"
#include "asterisk/transcap.h"
#include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
#ifdef WITH_SMDI
#include "asterisk/smdi.h"
#include "asterisk/astobj.h"
#define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
#endif
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+ .flags = 0,
+ .max_size = -1,
+ .resync_threshold = -1,
+ .impl = ""
+};
+static struct ast_jb_conf global_jbconf;
+
#if !defined(ZT_SIG_EM_E1) || (defined(HAVE_LIBPRI) && !defined(ZT_SIG_HARDHDLC))
-#error "Your zaptel is too old. please update"
+#error "Your zaptel is too old. Please update"
#endif
#ifndef ZT_TONEDETECT
@@ -203,7 +214,7 @@
static char language[MAX_LANGUAGE] = "";
static char musicclass[MAX_MUSICCLASS] = "";
-static char progzone[10]= "";
+static char progzone[10] = "";
static int usedistinctiveringdetection = 0;
static int distinctiveringaftercid = 0;
@@ -311,7 +322,7 @@
static int pritimers[PRI_MAX_TIMERS];
#endif
static int pridebugfd = -1;
-static char pridebugfilename[1024]="";
+static char pridebugfilename[1024] = "";
#endif
/*! \brief Wait up to 16 seconds for first digit (FXO logic) */
@@ -323,7 +334,7 @@
/*! \brief How long to wait for an extra digit, if there is an ambiguous match */
static int matchdigittimeout = 3000;
-static int usecnt =0;
+static int usecnt = 0;
AST_MUTEX_DEFINE_STATIC(usecnt_lock);
/*! \brief Protect the interface list (of zt_pvt's) */
@@ -353,7 +364,7 @@
AST_MUTEX_DEFINE_STATIC(monlock);
/*! \brief This is the thread for the monitor which checks for input on the channels
- which are not currently in use. */
+ which are not currently in use. */
static pthread_t monitor_thread = AST_PTHREADT_NULL;
static int restart_monitor(void);
@@ -366,21 +377,24 @@
static inline int zt_get_event(int fd)
{
int j;
- if (ioctl(fd, ZT_GETEVENT, &j) == -1) return -1;
+ if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+ return -1;
return j;
}
/*! \brief Avoid the silly zt_waitevent which ignores a bunch of events */
static inline int zt_wait_event(int fd)
{
- int i,j=0;
+ int i, j = 0;
i = ZT_IOMUX_SIGEVENT;
- if (ioctl(fd, ZT_IOMUX, &i) == -1) return -1;
- if (ioctl(fd, ZT_GETEVENT, &j) == -1) return -1;
+ if (ioctl(fd, ZT_IOMUX, &i) == -1)
+ return -1;
+ if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+ return -1;
return j;
}
-/*! Chunk size to read -- we use 20ms chunks to make things happy. */
+/*! Chunk size to read -- we use 20ms chunks to make things happy. */
#define READ_SIZE 160
#define MASK_AVAIL (1 << 0) /*!< Channel available for PRI use */
@@ -684,6 +698,7 @@
#endif
int polarity;
int dsp_features;
+ struct ast_jb_conf jbconf;
} *iflist = NULL, *ifend = NULL;
@@ -742,7 +757,7 @@
usleep(1);
ast_mutex_lock(&pvt->lock);
}
- } while(res);
+ } while (res);
/* Then break the poll */
pthread_kill(pri->master, SIGURG);
return 0;
@@ -895,7 +910,7 @@
int bs;
int x;
isnum = 1;
- for (x=0;x<strlen(fn);x++) {
+ for (x = 0; x < strlen(fn); x++) {
if (!isdigit(fn[x])) {
isnum = 0;
break;
@@ -930,7 +945,7 @@
static void zt_close(int fd)
{
- if(fd > 0)
+ if (fd > 0)
close(fd);
}
@@ -963,7 +978,7 @@
} else
ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d\n", x);
if (ioctl(p->subs[x].zfd, ZT_CHANNO, &p->subs[x].chan) == 1) {
- ast_log(LOG_WARNING,"Unable to get channel number for pseudo channel on FD %d\n",p->subs[x].zfd);
+ ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d\n", p->subs[x].zfd);
zt_close(p->subs[x].zfd);
p->subs[x].zfd = -1;
return -1;
@@ -1042,25 +1057,25 @@
}
static char *events[] = {
- "No event",
- "On hook",
- "Ring/Answered",
- "Wink/Flash",
- "Alarm",
- "No more alarm",
- "HDLC Abort",
- "HDLC Overrun",
- "HDLC Bad FCS",
- "Dial Complete",
- "Ringer On",
- "Ringer Off",
- "Hook Transition Complete",
- "Bits Changed",
- "Pulse Start",
- "Timer Expired",
- "Timer Ping",
- "Polarity Reversal",
- "Ring Begin",
+ "No event",
+ "On hook",
+ "Ring/Answered",
+ "Wink/Flash",
+ "Alarm",
+ "No more alarm",
+ "HDLC Abort",
+ "HDLC Overrun",
+ "HDLC Bad FCS",
+ "Dial Complete",
+ "Ringer On",
+ "Ringer Off",
+ "Hook Transition Complete",
+ "Bits Changed",
+ "Pulse Start",
+ "Timer Expired",
+ "Timer Ping",
+ "Polarity Reversal",
+ "Ring Begin",
};
static struct {
@@ -1079,7 +1094,7 @@
static char *alarm2str(int alarm)
{
int x;
- for (x=0;x<sizeof(alarms) / sizeof(alarms[0]); x++) {
[... 2157 lines stripped ...]
More information about the asterisk-commits
mailing list