[asterisk-commits] branch rizzo/base r10862 - in /team/rizzo/base:
./ apps/ channels/ channels/m...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Feb 23 06:49:08 MST 2006
Author: rizzo
Date: Thu Feb 23 07:48:40 2006
New Revision: 10862
URL: http://svn.digium.com/view/asterisk?rev=10862&view=rev
Log:
Update my local, changes:
- merge with changes in -trunk;
- replace the hardwired '8000' with a SAMPLE_RATE constant,
and do the same for derived values;
- add a few notes to CODING-GUIDELINES;
Modified:
team/rizzo/base/Makefile
team/rizzo/base/UPGRADE.txt
team/rizzo/base/app.c
team/rizzo/base/apps/app_amd.c
team/rizzo/base/apps/app_dial2.c
team/rizzo/base/apps/app_meetme.c
team/rizzo/base/apps/app_skel.c
team/rizzo/base/apps/app_sms.c
team/rizzo/base/apps/app_voicemail.c
team/rizzo/base/callerid.c
team/rizzo/base/channel.c
team/rizzo/base/channels/chan_iax2.c
team/rizzo/base/channels/chan_local.c
team/rizzo/base/channels/chan_misdn.c
team/rizzo/base/channels/chan_oss.c
team/rizzo/base/channels/chan_sip.c
team/rizzo/base/channels/chan_zap.c
team/rizzo/base/channels/misdn/isdn_lib.c
team/rizzo/base/channels/misdn/isdn_msg_parser.c
team/rizzo/base/channels/misdn_config.c
team/rizzo/base/cli.c
team/rizzo/base/configs/amd.conf.sample
team/rizzo/base/configs/iax.conf.sample
team/rizzo/base/doc/CODING-GUIDELINES
team/rizzo/base/doc/enum.txt
team/rizzo/base/file.c
team/rizzo/base/formats/format_g723.c
team/rizzo/base/formats/format_g726.c
team/rizzo/base/formats/format_g729.c
team/rizzo/base/formats/format_gsm.c
team/rizzo/base/formats/format_h263.c
team/rizzo/base/formats/format_h264.c
team/rizzo/base/formats/format_ilbc.c
team/rizzo/base/formats/format_ogg_vorbis.c
team/rizzo/base/formats/format_pcm.c
team/rizzo/base/formats/format_sln.c
team/rizzo/base/formats/format_vox.c
team/rizzo/base/formats/format_wav.c
team/rizzo/base/formats/format_wav_gsm.c
team/rizzo/base/frame.c
team/rizzo/base/funcs/func_cut.c
team/rizzo/base/funcs/func_enum.c
team/rizzo/base/include/asterisk.h
team/rizzo/base/include/asterisk/app.h
team/rizzo/base/include/asterisk/channel.h
team/rizzo/base/include/asterisk/file.h
team/rizzo/base/include/asterisk/linkedlists.h
team/rizzo/base/include/asterisk/plc.h
team/rizzo/base/include/asterisk/sha1.h
team/rizzo/base/include/asterisk/translate.h
team/rizzo/base/logger.c
team/rizzo/base/pbx.c
team/rizzo/base/pbx/pbx_dundi.c
team/rizzo/base/res/res_features.c
team/rizzo/base/res/res_osp.c
team/rizzo/base/say.c
team/rizzo/base/sched.c
Modified: team/rizzo/base/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/Makefile?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/Makefile (original)
+++ team/rizzo/base/Makefile Thu Feb 23 07:48:40 2006
@@ -163,6 +163,9 @@
ASTCFLAGS=
+# Define this to use files larger than 2GB (useful for sound files longer than 37 hours and logfiles)
+ASTCFLAGS+=-D_FILE_OFFSET_BITS=64
+
# Pentium Pro Optimize
#PROC=i686
@@ -247,6 +250,12 @@
ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
ASTCFLAGS+=$(OPTIMIZE)
ASTCFLAGS+= -Werror -Wunused -Wl,--export-dynamic
+
+# XXX hack to silence the compiler
+ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
+ASTCFLAGS+= -Wno-pointer-sign
+endif
+
ASTOBJ=-o asterisk
ifeq ($(findstring BSD,$(OSARCH)),BSD)
Modified: team/rizzo/base/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/UPGRADE.txt?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/UPGRADE.txt (original)
+++ team/rizzo/base/UPGRADE.txt Thu Feb 23 07:48:40 2006
@@ -47,10 +47,8 @@
modules.conf file then you will need to explicitly load the modules that
contain the functions you want to use.
-* The ENUMLOOKUP() function no longer supplies a default zone for searching; instead,
- it uses the default zone(s) defined in enum.conf. In addition, when the 'c'
- option (for counting the number of records is specified), but the lookup fails
- to match any records, the returned value will now be "0" instead of blank.
+* The ENUMLOOKUP() function with the 'c' option (for counting the number of records),
+ but the lookup fails to match any records, the returned value will now be "0" instead of blank.
The SIP channel:
Modified: team/rizzo/base/app.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/app.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/app.c (original)
+++ team/rizzo/base/app.c Thu Feb 23 07:48:40 2006
@@ -542,6 +542,7 @@
static int global_silence_threshold = 128;
static int global_maxsilence = 0;
+/* XXX much of this is duplicated in ast_play_and_prepend() */
int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path)
{
int d;
@@ -594,7 +595,7 @@
while((fmt = strsep(&stringp, "|"))) {
if (fmtcnt > MAX_OTHER_FORMATS - 1) {
- ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app_voicemail.c\n");
+ ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
break;
}
sfmt[fmtcnt++] = ast_strdupa(fmt);
@@ -824,7 +825,7 @@
while((fmt = strsep(&stringp, "|"))) {
if (fmtcnt > MAX_OTHER_FORMATS - 1) {
- ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app_voicemail.c\n");
+ ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
break;
}
sfmt[fmtcnt++] = ast_strdupa(fmt);
@@ -852,6 +853,7 @@
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
+ ast_dsp_free(sildet);
return -1;
}
}
@@ -956,6 +958,7 @@
} else {
ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", prependfile, sfmt[x]);
}
+ ast_dsp_free(sildet);
*duration = end - start;
#if 0
if (outmsg > 1) {
Modified: team/rizzo/base/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_amd.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/apps/app_amd.c (original)
+++ team/rizzo/base/apps/app_amd.c Thu Feb 23 07:48:40 2006
@@ -60,7 +60,7 @@
"This application sets the following channel variable upon completion:\n"
" AMDSTATUS - This is the status of the answering machine detection.\n"
" Possible values are:\n"
-" MACHINE | PERSON | NOTSURE | HANGUP\n"
+" MACHINE | HUMAN | NOTSURE | HANGUP\n"
" AMDCAUSE - Indicates the cause that led to the conclusion.\n"
" Possible values are:\n"
" TOOLONG-<%d total_time>\n"
@@ -247,7 +247,7 @@
ast_verbose(VERBOSE_PREFIX_3 "AMD: HUMAN: silenceDuration:%d afterGreetingSilence:%d\n",
silenceDuration, afterGreetingSilence );
ast_frfree(f);
- strcpy(amdStatus , "PERSON" );
+ strcpy(amdStatus , "HUMAN" );
sprintf(amdCause , "HUMAN-%d-%d", silenceDuration, afterGreetingSilence );
break;
}
Modified: team/rizzo/base/apps/app_dial2.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_dial2.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/apps/app_dial2.c (original)
+++ team/rizzo/base/apps/app_dial2.c Thu Feb 23 07:48:40 2006
@@ -1260,7 +1260,8 @@
tc = tmp->chan = ast_request(tech, chan->nativeformats, numsubst, &cause);
if (!tc) {
/* If we can't, just go on to the next call */
- ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d - %s)\n", tech, cause, ast_cause2str(cause));
+ ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d - %s)\n",
+ tech, cause, ast_cause2str(cause));
handle_cause(cause, &num);
if (!rest) /* last one, so exit the loop ? */
chan->hangupcause = cause;
Modified: team/rizzo/base/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_meetme.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/apps/app_meetme.c (original)
+++ team/rizzo/base/apps/app_meetme.c Thu Feb 23 07:48:40 2006
@@ -1552,7 +1552,7 @@
if (!user->listen.actual &&
((confflags & CONFFLAG_MONITOR) ||
(user->adminflags & ADMINFLAG_MUTED) ||
- (user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
+ (!user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
)) {
int index;
for (index=0;index<AST_FRAME_BITS;index++)
Modified: team/rizzo/base/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_skel.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/apps/app_skel.c (original)
+++ team/rizzo/base/apps/app_skel.c Thu Feb 23 07:48:40 2006
@@ -50,15 +50,23 @@
static char *descrip = "This application is a template to build other applications from.\n"
" It shows you the basic structure to create your own Asterisk applications.\n";
-#define OPTION_A (1 << 0) /* Option A */
-#define OPTION_B (1 << 1) /* Option B(n) */
-#define OPTION_C (1 << 2) /* Option C(str) */
-#define OPTION_NULL (1 << 3) /* Dummy Termination */
+enum {
+ OPTION_A = (1 << 0),
+ OPTION_B = (1 << 1),
+ OPTION_C = (1 << 2),
+} option_flags;
-AST_DECLARE_OPTIONS(app_opts,{
- ['a'] = { OPTION_A },
- ['b'] = { OPTION_B, 1 },
- ['c'] = { OPTION_C, 2 }
+enum {
+ OPTION_ARG_B = 0,
+ OPTION_ARG_C = 1,
+ /* This *must* be the last value in this enum! */
+ OPTION_ARG_ARRAY_SIZE = 2,
+} option_args;
+
+AST_APP_OPTIONS(app_opts,{
+ AST_APP_OPTION('a', OPTION_A),
+ AST_APP_OPTION_ARG('b', OPTION_B, OPTION_ARG_B),
+ AST_APP_OPTION_ARG('c', OPTION_C, OPTION_ARG_C),
});
LOCAL_USER_DECL;
@@ -68,15 +76,14 @@
int res = 0;
struct ast_flags flags;
struct localuser *u;
- char *options = NULL;
- char *dummy = NULL;
- char *args;
- int argc = 0;
- char *opts[2];
- char *argv[2];
+ char *parse, *opts[OPTION_ARG_ARRAY_SIZE];
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(dummy);
+ AST_APP_ARG(options);
+ );
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "%s requires an argument (dummy|[options])\n",app);
+ ast_log(LOG_WARNING, "%s requires an argument (dummy|[options])\n", app);
return -1;
}
@@ -85,28 +92,27 @@
/* Do our thing here */
/* We need to make a copy of the input string if we are going to modify it! */
- if (!(args = ast_strdupa(data))) {
+ if (!(parse = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
-
- if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
- dummy = argv[0];
- options = argv[1];
- ast_parseoptions(app_opts, &flags, opts, options);
- }
- if (!ast_strlen_zero(dummy))
- ast_log(LOG_NOTICE, "Dummy value is : %s\n", dummy);
+ AST_STANDARD_APP_ARGS(args, parse);
+
+ if (args.argc == 2)
+ ast_app_parse_options(app_opts, &flags, opts, args.options);
+
+ if (!ast_strlen_zero(args.dummy))
+ ast_log(LOG_NOTICE, "Dummy value is : %s\n", args.dummy);
if (ast_test_flag(&flags, OPTION_A))
ast_log(LOG_NOTICE, "Option A is set\n");
if (ast_test_flag(&flags, OPTION_B))
- ast_log(LOG_NOTICE,"Option B is set with : %s\n", opts[0] ? opts[0] : "<unspecified>");
+ ast_log(LOG_NOTICE, "Option B is set with : %s\n", opts[OPTION_ARG_B] ? opts[OPTION_ARG_B] : "<unspecified>");
if (ast_test_flag(&flags, OPTION_C))
- ast_log(LOG_NOTICE,"Option C is set with : %s\n", opts[1] ? opts[1] : "<unspecified>");
+ ast_log(LOG_NOTICE, "Option C is set with : %s\n", opts[OPTION_ARG_C] ? opts[OPTION_ARG_C] : "<unspecified>");
LOCAL_USER_REMOVE(u);
Modified: team/rizzo/base/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_sms.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/apps/app_sms.c (original)
+++ team/rizzo/base/apps/app_sms.c Thu Feb 23 07:48:40 2006
@@ -713,7 +713,7 @@
{ /* parse message (UTF-8) */
unsigned char o = 0;
while (*p && o < SMSLEN)
- h->ud[o++] = utf8decode((unsigned char **)&p);
+ h->ud[o++] = utf8decode(&p);
h->udl = o;
if (*p)
ast_log (LOG_WARNING, "UD too long in %s\n", fn);
Modified: team/rizzo/base/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_voicemail.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/apps/app_voicemail.c (original)
+++ team/rizzo/base/apps/app_voicemail.c Thu Feb 23 07:48:40 2006
@@ -4929,7 +4929,7 @@
struct ast_vm_user *res_vmu, const char *context, const char *prefix,
int skipuser, int maxlogins, int silent)
{
- int useadsi, valid=0, logretries=0;
+ int useadsi=0, valid=0, logretries=0;
char password[AST_MAX_EXTENSION]="", *passptr;
struct ast_vm_user vmus, *vmu = NULL;
@@ -5892,7 +5892,6 @@
}
zones = NULL;
zonesl = NULL;
- AST_LIST_HEAD_INIT(&users);
memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd));
if (cfg) {
Modified: team/rizzo/base/callerid.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/callerid.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/callerid.c (original)
+++ team/rizzo/base/callerid.c Thu Feb 23 07:48:40 2006
@@ -62,20 +62,23 @@
unsigned short crc;
};
-
-float cid_dr[4], cid_di[4];
-float clidsb = 8000.0 / 1200.0;
-float sasdr, sasdi;
-float casdr1, casdi1, casdr2, casdi2;
-
#define CALLERID_SPACE 2200.0 /*!< 2200 hz for "0" */
#define CALLERID_MARK 1200.0 /*!< 1200 hz for "1" */
#define SAS_FREQ 440.0
#define CAS_FREQ1 2130.0
#define CAS_FREQ2 2750.0
+float cid_dr[4], cid_di[4];
+/* clidsb is used in the PUT_* macros */
+float clidsb = (double)(SAMPLE_RATE) / 1200.0; /* XXX what is 1200, the signalling rate ? */
+float sasdr, sasdi;
+float casdr1, casdi1, casdr2, casdi2;
+
#define AST_CALLERID_UNKNOWN "<unknown>"
+/*
+ * generate a tone pair of given length and amplitude 2048
+ */
static inline void gen_tones(unsigned char *buf, int len, int codec, float ddr1, float ddi1, float ddr2, float ddi2, float *cr1, float *ci1, float *cr2, float *ci2)
{
int x;
@@ -98,6 +101,9 @@
}
}
+/*
+ * generate a single tone of given length and amplitude 8192
+ */
static inline void gen_tone(unsigned char *buf, int len, int codec, float ddr1, float ddi1, float *cr1, float *ci1)
{
int x;
@@ -116,16 +122,18 @@
/*! \brief Initialize stuff for inverse FFT */
void callerid_init(void)
{
- cid_dr[0] = cos(CALLERID_SPACE * 2.0 * M_PI / 8000.0);
- cid_di[0] = sin(CALLERID_SPACE * 2.0 * M_PI / 8000.0);
- cid_dr[1] = cos(CALLERID_MARK * 2.0 * M_PI / 8000.0);
- cid_di[1] = sin(CALLERID_MARK * 2.0 * M_PI / 8000.0);
- sasdr = cos(SAS_FREQ * 2.0 * M_PI / 8000.0);
- sasdi = sin(SAS_FREQ * 2.0 * M_PI / 8000.0);
- casdr1 = cos(CAS_FREQ1 * 2.0 * M_PI / 8000.0);
- casdi1 = sin(CAS_FREQ1 * 2.0 * M_PI / 8000.0);
- casdr2 = cos(CAS_FREQ2 * 2.0 * M_PI / 8000.0);
- casdi2 = sin(CAS_FREQ2 * 2.0 * M_PI / 8000.0);
+ double c = (2.0 * M_PI / (double)(SAMPLE_RATE)); /* arg multiplier */
+
+ cid_dr[0] = cos(CALLERID_SPACE * c);
+ cid_di[0] = sin(CALLERID_SPACE * c);
+ cid_dr[1] = cos(CALLERID_MARK * c);
+ cid_di[1] = sin(CALLERID_MARK * c);
+ sasdr = cos(SAS_FREQ * c);
+ sasdi = sin(SAS_FREQ * c);
+ casdr1 = cos(CAS_FREQ1 * c);
+ casdi1 = sin(CAS_FREQ1 * c);
+ casdr2 = cos(CAS_FREQ2 * c);
+ casdi2 = sin(CAS_FREQ2 * c);
}
struct callerid_state *callerid_new(int cid_signalling)
Modified: team/rizzo/base/channel.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channel.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channel.c (original)
+++ team/rizzo/base/channel.c Thu Feb 23 07:48:40 2006
@@ -109,8 +109,7 @@
/*! the list of registered channel types */
static AST_LIST_HEAD_NOLOCK_STATIC(backends, chanlist);
-#ifdef BACKTRACE
-/* XXX print_trace support */
+#ifdef BACKTRACE /* XXX print_trace support */
int backtrace(void **, int);
char ** backtrace_symbols(void *const *, int);
@@ -120,21 +119,19 @@
void print_trace (void);
void print_trace (void)
{
- void *array[50];
- size_t size;
- char **strings;
- size_t i;
-
- size = backtrace (array, 30);
- strings = backtrace_symbols (array, size);
-
- ast_log(LOG_WARNING, "Obtained %d stack frames.\n", size);
-
- for (i = 0; i < size; i++)
- ast_log(LOG_WARNING, "%s\n", strings[i]);
-
-}
-/* XXX end execinfo support */
+ void *array[50];
+ size_t size;
+ char **strings;
+ size_t i;
+
+ size = backtrace (array, 30);
+ strings = backtrace_symbols (array, size);
+
+ ast_log(LOG_WARNING, "Obtained %d stack frames.\n", size);
+
+ for (i = 0; i < size; i++)
+ ast_log(LOG_WARNING, "%s\n", strings[i]);
+}
#endif /* BACKTRACE */
/*! the list of channels we have. Note that the lock for this list is used for
@@ -767,7 +764,7 @@
if (!ast_mutex_trylock(&chan->lock)) {
chan->_softhangup |= AST_SOFTHANGUP_DEV;
ast_mutex_unlock(&chan->lock);
- }
+ } /* XXX what if we fail ? */
return ast_queue_frame(chan, &f);
}
Modified: team/rizzo/base/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_iax2.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_iax2.c (original)
+++ team/rizzo/base/channels/chan_iax2.c Thu Feb 23 07:48:40 2006
@@ -2242,11 +2242,12 @@
/* 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)
+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;
@@ -2269,7 +2270,7 @@
/* Attempt to recover wrapped timestamps */
unwrap_timestamp(fr);
-
+
if (updatehistory) {
#ifndef NEWJB
@@ -2367,8 +2368,10 @@
}
if ( (!ast_test_flag(iaxs[fr->callno], IAX_USEJITTERBUF)) ) {
+ if (tsout)
+ *tsout = fr->ts;
__do_deliver(fr);
- return 0;
+ return -1;
}
/* if the user hasn't requested we force the use of the jitterbuffer, and we're bridged to
@@ -2390,8 +2393,10 @@
iaxs[fr->callno]->jbid = -1;
/* deliver this frame now */
+ if (tsout)
+ *tsout = fr->ts;
__do_deliver(fr);
- return 0;
+ return -1;
}
@@ -2401,7 +2406,7 @@
ret = jb_put(iaxs[fr->callno]->jb, fr, type, len, fr->ts,
calc_rxstamp(iaxs[fr->callno],fr->ts));
if (ret == JB_DROP) {
- iax2_frame_free(fr);
+ needfree++;
} else if (ret == JB_SCHED) {
update_jbsched(iaxs[fr->callno]);
}
@@ -2470,13 +2475,15 @@
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++;
- /* Free our iax frame */
- iax2_frame_free(fr);
+ needfree++;
}
} else {
if (option_debug && iaxdebug)
@@ -2484,6 +2491,13 @@
fr->retrans = ast_sched_add(sched, delay, do_deliver, fr);
}
#endif
+ if (tsout)
+ *tsout = fr->ts;
+ if (needfree) {
+ /* Free our iax frame */
+ iax2_frame_free(fr);
+ return -1;
+ }
return 0;
}
@@ -6368,15 +6382,13 @@
} else {
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 1);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 1, &fr.ts);
}
}
#else
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 1);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 1, &fr.ts);
}
#endif
if (iaxs[fr.callno]->last < fr.ts) {
@@ -7561,15 +7573,13 @@
} else {
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 0);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 0, &fr.ts);
}
}
#else
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 0);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 0, &fr.ts);
}
#endif
Modified: team/rizzo/base/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_local.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_local.c (original)
+++ team/rizzo/base/channels/chan_local.c Thu Feb 23 07:48:40 2006
@@ -511,8 +511,7 @@
p->owner = tmp;
p->chan = tmp2;
ast_mutex_lock(&usecnt_lock);
- usecnt++;
- usecnt++;
+ usecnt += 2; /* we allocate 2 new channels */
ast_mutex_unlock(&usecnt_lock);
ast_update_use_count();
ast_copy_string(tmp->context, p->context, sizeof(tmp->context));
Modified: team/rizzo/base/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_misdn.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_misdn.c (original)
+++ team/rizzo/base/channels/chan_misdn.c Thu Feb 23 07:48:40 2006
@@ -69,7 +69,7 @@
#define release_unlock ast_mutex_unlock(&release_lock_mutex)
-char global_tracefile[BUFFERSIZE];
+char global_tracefile[BUFFERSIZE+1];
struct misdn_jb{
@@ -83,6 +83,10 @@
int bytes_wrote;
ast_mutex_t mutexjb;
};
+
+void export_ies(struct ast_channel *chan, struct misdn_bchannel *bc);
+void import_ies(struct ast_channel *chan, struct misdn_bchannel *bc);
+
/* allocates the jb-structure and initialise the elements*/
struct misdn_jb *misdn_jb_init(int size, int upper_threshold);
@@ -242,14 +246,13 @@
#define MISDN_ASTERISK_TECH_PVT(ast) ast->tech_pvt
#define MISDN_ASTERISK_PVT(ast) 1
-#define MISDN_ASTERISK_TYPE(ast) ast->tech->type
#include <asterisk/strings.h>
/* #define MISDN_DEBUG 1 */
static char *desc = "Channel driver for mISDN Support (Bri/Pri)";
-static char *misdn_type = "mISDN";
+static const char misdn_type[] = "mISDN";
static int tracing = 0 ;
@@ -882,9 +885,7 @@
tmp=get_chan_by_ast_name(channame);
if (tmp && tmp->bc) {
- int l = sizeof(tmp->bc->display);
- strncpy(tmp->bc->display, msg, l);
- tmp->bc->display[l-1] = 0;
+ ast_copy_string(tmp->bc->display, msg, sizeof(tmp->bc->display));
misdn_lib_send_event(tmp->bc, EVENT_INFORMATION);
} else {
ast_cli(fd,"No such channel %s\n",channame);
@@ -1197,13 +1198,13 @@
chan_misdn_log(1,port,"read_config: Getting Config\n");
- char lang[BUFFERSIZE];
+ char lang[BUFFERSIZE+1];
misdn_cfg_get( port, MISDN_CFG_LANGUAGE, lang, BUFFERSIZE);
ast_string_field_set(ast, language, lang);
- char localmusicclass[BUFFERSIZE];
+ char localmusicclass[BUFFERSIZE+1];
misdn_cfg_get( port, MISDN_CFG_MUSICCLASS, localmusicclass, BUFFERSIZE);
ast_string_field_set(ast, musicclass, localmusicclass);
@@ -1229,7 +1230,7 @@
misdn_cfg_get( bc->port, MISDN_CFG_CONTEXT, ch->context, sizeof(ch->context));
- strncpy(ast->context,ch->context,sizeof(ast->context)-1);
+ ast_copy_string (ast->context,ch->context,sizeof(ast->context));
{
int ec, ectr;
@@ -1278,7 +1279,7 @@
{
- char callerid[BUFFERSIZE];
+ char callerid[BUFFERSIZE+1];
misdn_cfg_get( port, MISDN_CFG_CALLERID, callerid, BUFFERSIZE);
if ( ! ast_strlen_zero(callerid) ) {
chan_misdn_log(1, port, " --> * Setting Cid to %s\n", callerid);
@@ -1338,7 +1339,7 @@
} else { /** ORIGINATOR MISDN **/
- char prefix[BUFFERSIZE]="";
+ char prefix[BUFFERSIZE+1]="";
switch( bc->onumplan ) {
case NUMPLAN_INTERNATIONAL:
misdn_cfg_get( bc->port, MISDN_CFG_INTERNATPREFIX, prefix, BUFFERSIZE);
@@ -1369,13 +1370,11 @@
if (!ast_strlen_zero(bc->dad)) {
- strncpy(bc->orig_dad,bc->dad, sizeof(bc->orig_dad));
- bc->orig_dad[sizeof(bc->orig_dad)-1] = 0;
+ ast_copy_string(bc->orig_dad,bc->dad, sizeof(bc->orig_dad));
}
if ( ast_strlen_zero(bc->dad) && !ast_strlen_zero(bc->keypad)) {
- strncpy(bc->dad,bc->keypad, sizeof(bc->dad));
- bc->dad[sizeof(bc->dad)-1] = 0;
+ ast_copy_string(bc->dad,bc->keypad, sizeof(bc->dad));
}
prefix[0] = 0;
@@ -1418,10 +1417,9 @@
if ( !ast->cid.cid_num) {
ast->cid.cid_num=strdup(bc->oad);
}
-
+
pbx_builtin_setvar_helper(ch->ast,"REDIRECTING_NUMBER",bc->rad);
}
-
return 0;
}
@@ -1529,7 +1527,10 @@
/* update screening and presentation */
update_config(ch,ORG_AST);
-
+
+ /* fill in some ies from channel vary*/
+ import_ies(ast, newbc);
+
/* Finally The Options Override Everything */
if (opts)
misdn_set_opt_exec(ast,opts);
@@ -1915,14 +1916,16 @@
chan_misdn_log(1, bc->port, " --> cause %d\n",bc->cause);
chan_misdn_log(1, bc->port, " --> out_cause %d\n",bc->out_cause);
+ bc->out_cause=-1;
misdn_lib_send_event(bc,EVENT_RELEASE);
break;
default:
/* Alerting or Disconect */
- if (bc->nt)
+ if (bc->nt) {
+ bc->out_cause=-1;
misdn_lib_send_event(bc, EVENT_RELEASE);
- else
+ } else
misdn_lib_send_event(bc, EVENT_DISCONNECT);
p->state=MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */
}
@@ -2228,7 +2231,7 @@
{
struct ast_channel *tmp = NULL;
- char group[BUFFERSIZE]="";
+ char group[BUFFERSIZE+1]="";
char buf[128];
char buf2[128], *ext=NULL, *port_str;
char *tokb=NULL, *p=NULL;
@@ -2238,20 +2241,12 @@
struct chan_list *cl=init_chan_list();
sprintf(buf,"%s/%s",misdn_type,(char*)data);
- strncpy(buf2,data, 128);
- buf2[127] = 0;
+ ast_copy_string(buf2,data, 128);
+
port_str=strtok_r(buf2,"/", &tokb);
ext=strtok_r(NULL,"/", &tokb);
- /*
- if (!ext) {
- ast_log(LOG_WARNING, " --> ! IND : CALL dad:%s WITH WRONG ARGS, check extension.conf\n",ext);
-
- return NULL;
- }
- */
-
if (port_str) {
if (port_str[0]=='g' && port_str[1]==':' ) {
/* We make a group call lets checkout which ports are in my group */
@@ -2279,7 +2274,7 @@
if (!ast_strlen_zero(group)) {
- char cfg_group[BUFFERSIZE];
+ char cfg_group[BUFFERSIZE+1];
struct robin_list *rr = NULL;
if (misdn_cfg_is_group_method(group, METHOD_ROUND_ROBIN)) {
@@ -2935,6 +2930,43 @@
}
}
+
+void import_ies(struct ast_channel *chan, struct misdn_bchannel *bc)
+{
+ char *tmp;
+
+ tmp=pbx_builtin_getvar_helper(chan,"PRI_MODE");
+ if (tmp) bc->mode=atoi(tmp);
+
+ tmp=pbx_builtin_getvar_helper(chan,"PRI_URATE");
+ if (tmp) bc->urate=atoi(tmp);
+
+ tmp=pbx_builtin_getvar_helper(chan,"PRI_RATE");
+ if (tmp) bc->rate=atoi(tmp);
+
+ tmp=pbx_builtin_getvar_helper(chan,"PRI_USER1");
+ if (tmp) bc->user1=atoi(tmp);
+}
+
+void export_ies(struct ast_channel *chan, struct misdn_bchannel *bc)
+{
+ char tmp[32];
+
+ sprintf(tmp,"%d",bc->mode);
+ pbx_builtin_setvar_helper(chan,"PRI_MODE",tmp);
+
+ sprintf(tmp,"%d",bc->urate);
+ pbx_builtin_setvar_helper(chan,"PRI_URATE",tmp);
+
+ sprintf(tmp,"%d",bc->rate);
+ pbx_builtin_setvar_helper(chan,"PRI_RATE",tmp);
+
+ sprintf(tmp,"%d",bc->user1);
+ pbx_builtin_setvar_helper(chan,"PRI_USER1",tmp);
+}
+
+
+
/************************************************************/
/* Receive Events from isdn_lib here */
/************************************************************/
@@ -3143,11 +3175,13 @@
ch->l3id=bc->l3_id;
ch->addr=bc->addr;
ch->orginator = ORG_MISDN;
-
+
chan=misdn_new(ch, AST_STATE_RESERVED,bc->dad, bc->oad, AST_FORMAT_ALAW, bc->port, bc->channel);
- ch->ast = chan;
-
+ ch->ast = chan;
+
read_config(ch, ORG_MISDN);
+
+ export_ies(chan, bc);
ch->ast->rings=1;
ast_setstate(ch->ast, AST_STATE_RINGING);
@@ -3258,7 +3292,7 @@
tone_indicate(ch,TONE_NONE);
else
tone_indicate(ch,TONE_DIAL);
-
+
ch->state=MISDN_WAITING4DIGS;
}
@@ -3377,12 +3411,14 @@
}
stop_bc_tones(ch);
- bc->out_cause=16;
-
- //if (ch->state == MISDN_CONNECTED)
- //misdn_lib_send_event(bc,EVENT_RELEASE);
- //else
- //misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+ /*bc->out_cause=16;*/
+ bc->out_cause=-1;
+
+ /*if (ch->state == MISDN_CONNECTED)
+ misdn_lib_send_event(bc,EVENT_RELEASE);
+ else
+ misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+ */
misdn_lib_send_event(bc,EVENT_RELEASE);
@@ -3401,15 +3437,18 @@
before, so we should RELEASE_COMPLETE after that Disconnect
(looks like ALERTING State at misdn_hangup !!
*/
- return RESPONSE_OK;
+
+ /*return RESPONSE_OK;*/
break;
}
bc->out_cause=16;
- stop_bc_tones(ch);
- release_chan(bc);
+ /*stop_bc_tones(ch);
+ release_chan(bc);*/
+
+ misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
}
break;
case EVENT_RELEASE_COMPLETE:
@@ -3641,7 +3680,7 @@
{
- char tempbuf[BUFFERSIZE];
+ char tempbuf[BUFFERSIZE+1];
misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, tempbuf, BUFFERSIZE);
if (strlen(tempbuf))
tracing = 1;
@@ -3871,7 +3910,7 @@
switch(tok[0]) {
case 'd' :
- strncpy(ch->bc->display,++tok,84);
+ ast_copy_string(ch->bc->display,++tok,84);
chan_misdn_log(1, ch->bc->port, "SETOPT: Display:%s\n",ch->bc->display);
break;
@@ -3939,10 +3978,9 @@
}
{
- int l = sizeof(ch->bc->crypt_key);
- strncpy(ch->bc->crypt_key, misdn_key_vector[keyidx], l);
- ch->bc->crypt_key[l-1] = 0;
+ ast_copy_string(ch->bc->crypt_key, misdn_key_vector[keyidx], sizeof(ch->bc->crypt_key));
}
+
chan_misdn_log(0, ch->bc->port, "SETOPT: crypt with key:%s\n",misdn_key_vector[keyidx]);
break;
Modified: team/rizzo/base/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_oss.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_oss.c (original)
+++ team/rizzo/base/channels/chan_oss.c Thu Feb 23 07:48:40 2006
@@ -671,7 +671,7 @@
ast_log(LOG_WARNING, "Failed to set audio device to mono\n");
return -1;
}
- fmt = desired = 8000; /* 8000 Hz desired */
+ fmt = desired = SAMPLE_RATE; /* 8000 Hz desired */
res = ioctl(fd, SNDCTL_DSP_SPEED, &fmt);
if (res < 0) {
@@ -705,10 +705,6 @@
res = PCM_ENABLE_INPUT | PCM_ENABLE_OUTPUT;
res = ioctl(fd, SNDCTL_DSP_SETTRIGGER, &res);
/* it may fail if we are in half duplex, never mind */
- if (0) { int r2; char buf[256];
- r2 = read(fd, buf, sizeof(buf));
- ast_log(LOG_WARNING, "reopening, res %d read %d\n", res, r2);
- }
return 0;
}
Modified: team/rizzo/base/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_sip.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_sip.c (original)
+++ team/rizzo/base/channels/chan_sip.c Thu Feb 23 07:48:40 2006
@@ -10883,7 +10883,7 @@
/* Make sure we don't ignore this */
if (seqno == p->pendinginvite) {
p->pendinginvite = 0;
- __sip_ack(p, seqno, FLAG_RESPONSE, -1);
+ __sip_ack(p, seqno, FLAG_RESPONSE, 0);
if (!ast_strlen_zero(get_header(req, "Content-Type"))) {
if (process_sdp(p, req))
return -1;
Modified: team/rizzo/base/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_zap.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_zap.c (original)
+++ team/rizzo/base/channels/chan_zap.c Thu Feb 23 07:48:40 2006
@@ -9171,7 +9171,7 @@
}
break;
case PRI_EVENT_CONFIG_ERR:
- ast_log(LOG_WARNING, "PRI Error: %s\n", e->err.err);
+ ast_log(LOG_WARNING, "PRI Error on span %d: %s\n", pri->trunkgroup, e->err.err);
break;
case PRI_EVENT_RESTART_ACK:
chanpos = pri_find_principle(pri, e->restartack.channel);
@@ -9526,6 +9526,27 @@
s[len - 1] = '\0';
}
+static int handle_pri_show_spans(int fd, int argc, char *argv[])
+{
+ int span;
+ int x;
+ char status[256];
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+
+ for (span = 0; span < NUM_SPANS; span++) {
+ if (pris[span].pri) {
+ for (x = 0; x < NUM_DCHANS; x++) {
+ if (pris[span].dchannels[x]) {
+ build_status(status, sizeof(status), pris[span].dchanavail[x], pris[span].dchans[x] == pris[span].pri);
+ ast_cli(fd, "PRI span %d/%d: %s\n", span + 1, x, status);
+ }
+ }
+ }
+ }
+ return RESULT_SUCCESS;
+}
+
static int handle_pri_show_span(int fd, int argc, char *argv[])
{
int span;
@@ -9609,6 +9630,10 @@
static const char pri_show_span_help[] =
"Usage: pri show span <span>\n"
+ " Displays PRI Information on a given PRI span\n";
+
+static const char pri_show_spans_help[] =
+ "Usage: pri show spans\n"
" Displays PRI Information\n";
static struct ast_cli_entry zap_pri_cli[] = {
@@ -9618,6 +9643,8 @@
"Disables PRI debugging on a span", pri_no_debug_help, complete_span_5 },
{ { "pri", "intense", "debug", "span", NULL }, handle_pri_really_debug,
"Enables REALLY INTENSE PRI debugging", pri_really_debug_help, complete_span_5 },
+ { { "pri", "show", "spans", NULL }, handle_pri_show_spans,
+ "Displays PRI Information", pri_show_spans_help },
{ { "pri", "show", "span", NULL }, handle_pri_show_span,
"Displays PRI Information", pri_show_span_help, complete_span_4 },
{ { "pri", "show", "debug", NULL }, handle_pri_show_debug,
Modified: team/rizzo/base/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/misdn/isdn_lib.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/misdn/isdn_lib.c (original)
+++ team/rizzo/base/channels/misdn/isdn_lib.c Thu Feb 23 07:48:40 2006
@@ -491,7 +491,7 @@
bc->capability=INFO_CAPABILITY_SPEECH;
bc->law=INFO_CODEC_ALAW;
bc->mode=0;
- bc->rate=0;
+ bc->rate=0x10;
bc->user1=0;
bc->urate=0;
@@ -503,6 +503,7 @@
bc->infos_pending[0] = 0;
bc->oad[0] = 0;
bc->dad[0] = 0;
+ bc->rad[0] = 0;
bc->orig_dad[0] = 0;
bc->fac_type=FACILITY_NONE;
@@ -1659,13 +1660,13 @@
case CC_RELEASE|CONFIRM:
{
- struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
- cb_log(3, stack->port, " --> RELEASE CONFIRM, doing nothin\n");
- cb_event(EVENT_CLEANUP, bc, glob_mgr->user_data);
- empty_chan_in_stack(stack,bc->channel);
- empty_bc(bc);
- free_msg(msg);
- return 0;
+ /*struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
+ cb_log(3, stack->port, " --> RELEASE CONFIRM, doing nothin\n");
+ cb_event(EVENT_CLEANUP, bc, glob_mgr->user_data);
+ empty_chan_in_stack(stack,bc->channel);
+ empty_bc(bc);
+ free_msg(msg);
+ return 0;*/
}
break;
case CC_RELEASE|INDICATION:
@@ -2035,7 +2036,7 @@
int i=cb_event( EVENT_BCHAN_DATA, bc, glob_mgr->user_data);
if (i<0) {
- cb_log(2,stack->port,"cb_event returned <0\n");
+ cb_log(5,stack->port,"cb_event returned <0\n");
/*clean_up_bc(bc);*/
}
}
@@ -2990,11 +2991,12 @@
glob_mgr = mgr;
msg_init();
- debug_init(0 , NULL, NULL, NULL);
#if 0
int flags=0xff;
flags &= ~DBGM_MSG;
debug_init( flags , NULL, NULL, NULL);
+#else
+ debug_init(0 , NULL, NULL, NULL);
#endif
if (!portlist || (*portlist == 0) ) return 1;
Modified: team/rizzo/base/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/misdn/isdn_msg_parser.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/misdn/isdn_msg_parser.c (original)
+++ team/rizzo/base/channels/misdn/isdn_msg_parser.c Thu Feb 23 07:48:40 2006
@@ -300,6 +300,8 @@
break;
case INFO_CAPABILITY_DIGITAL_UNRESTRICTED: capability = 8;
user=-1;
+ mode=bc->mode;
+ rate=bc->rate;
break;
case INFO_CAPABILITY_DIGITAL_RESTRICTED: capability = 9;
user=-1;
@@ -798,8 +800,8 @@
release=(RELEASE_t*)((msg->data+HEADER_LEN));
-
- enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
+ if (bc->out_cause>= 0)
+ enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
#if DEBUG
printf("Building RELEASE Msg\n");
Modified: team/rizzo/base/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/misdn_config.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/channels/misdn_config.c (original)
+++ team/rizzo/base/channels/misdn_config.c Thu Feb 23 07:48:40 2006
@@ -214,7 +214,7 @@
{
int i, j;
int gn = map[MISDN_CFG_GROUPNAME];
- union misdn_cfg_pt* free_list[max_ports + 1];
+ union misdn_cfg_pt* free_list[max_ports + 2];
memset(free_list, 0, sizeof(free_list));
free_list[0] = port_cfg[0];
Modified: team/rizzo/base/cli.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/cli.c?rev=10862&r1=10861&r2=10862&view=diff
==============================================================================
--- team/rizzo/base/cli.c (original)
+++ team/rizzo/base/cli.c Thu Feb 23 07:48:40 2006
@@ -929,48 +929,75 @@
}
}
+/*
+ * We have two sets of commands: builtins are stored in a
+ * NULL-terminated array of ast_cli_entry, whereas external
+ * commands are in a list.
+ * When navigating, we need to keep two pointers and get
+ * the next one in lexicographic order. For the purpose,
+ * we use a structure.
+ */
+
+struct cli_iterator {
+ struct ast_cli_entry *builtins;
+ struct ast_cli_entry *helpers;
+};
+
+static struct ast_cli_entry *cli_next(struct cli_iterator *i)
+{
+ struct ast_cli_entry *e;
+
+ if (i->builtins == NULL && i->helpers == NULL) {
+ /* initialize */
+ i->builtins = builtins;
+ i->helpers = AST_LIST_FIRST(&helpers);
+ }
+ e = i->builtins; /* temporary */
+ if (!e->cmda[0] || (i->helpers &&
+ strcmp(i->helpers->_full_cmd, e->_full_cmd) < 0)) {
+ /* Use helpers */
+ e = i->helpers;
+ if (e)
+ i->helpers = AST_LIST_NEXT(e, list);
+ } else { /* use builtin. e is already set */
+ (i->builtins)++; /* move to next */
+ }
+ return e;
+}
+
+/*!
+ * \brief locate a cli command in the 'helpers' list (which must be locked).
+ * exact has 3 values:
+ * 0 returns if the search key is equal or longer than the entry.
+ * -1 true if the mismatch is on the last word
+ * 1 true only on complete, exact match.
+ */
static struct ast_cli_entry *find_cli(char *const cmds[], int exact)
{
- int x, y, match;
+ int y, match;
struct ast_cli_entry *e=NULL;
-
- AST_LIST_TRAVERSE(&helpers, e, list) {
[... 2639 lines stripped ...]
More information about the asterisk-commits
mailing list