Add several busy detection related defines to menuselect.

Allow better busy detect debugging (with BUSYDETECT_DEBUG).

Remove very old BUSYDETECT and BUSY_DETECT_MARTIN defines.

(closes issue #11107)
Patches:
      busydetect_enhancement.patch uploaded by agx (license 298)
      busydetect-r94975.diff uploaded by sergee (license 138)

Additional changes/cleanup by me.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98998 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Jason Parker 18 years ago
parent 3d022ccfec
commit 8dc5e09ccb

@ -275,9 +275,7 @@ endif
# XXX MALLOC_DEBUG is probably unused, Makefile.moddir_rules adds the
# value directly to ASTCFLAGS
# XXX BUSYDETECT is probably useless, the only similar reference is to
# #ifdef BUSYDETECT in main/dsp.c
ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
ASTCFLAGS+=$(MALLOC_DEBUG)$(OPTIONS)
MOD_SUBDIRS:=channels pbx apps codecs formats cdr funcs tests main res $(LOCAL_MOD_SUBDIRS)
OTHER_SUBDIRS:=utils agi

@ -48,4 +48,15 @@
</member>
<member name="THREAD_CRASH" displayname="Crash on mutex errors">
</member>
<member name="BUSYDETECT_TONEONLY" displayname="Enable additional comparision of only the tone duration not the silence part">
<conflict>BUSYDETECT_COMPARE_TONE_AND_SILENCE</conflict>
<defaultenabled>no</defaultenabled>
</member>
<member name="BUSYDETECT_COMPARE_TONE_AND_SILENCE" displayname="Assume that tone and silence have the same duration">
<conflict>BUSYDETECT_TONEONLY</conflict>
<defaultenabled>no</defaultenabled>
</member>
<member name="BUSYDETECT_DEBUG" displayname="Enable additional busy detection debugging">
<defaultenabled>no</defaultenabled>
</member>
</category>

@ -11829,6 +11829,19 @@ static char *zap_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a
ast_cli(a->fd, "Propagated Conference: %d\n", tmp->propconfno);
ast_cli(a->fd, "Real in conference: %d\n", tmp->inconference);
ast_cli(a->fd, "DSP: %s\n", tmp->dsp ? "yes" : "no");
ast_cli(a->fd, "Busy Detection: %s\n", tmp->busydetect ? "yes" : "no");
if (tmp->busydetect) {
#if defined(BUSYDETECT_TONEONLY)
ast_cli(a->fd, " Busy Detector Helper: BUSYDETECT_TONEONLY\n");
#elif defined(BUSYDETECT_COMPARE_TONE_AND_SILENCE)
ast_cli(a->fd, " Busy Detector Helper: BUSYDETECT_COMPARE_TONE_AND_SILENCE\n");
#endif
#ifdef BUSYDETECT_DEBUG
ast_cli(a->fd, " Busy Detector Debug: Enabled\n");
#endif
ast_cli(a->fd, " Busy Count: %d\n", tmp->busycount);
ast_cli(a->fd, " Busy Pattern: %d,%d\n", tmp->busy_tonelength, tmp->busy_quietlength);
}
ast_cli(a->fd, "TDD: %s\n", tmp->tdd ? "yes" : "no");
ast_cli(a->fd, "Relax DTMF: %s\n", tmp->dtmfrelax ? "yes" : "no");
ast_cli(a->fd, "Dialing/CallwaitCAS: %d/%d\n", tmp->dialing, tmp->callwaitcas);

@ -599,10 +599,14 @@ pickupgroup=1
;
;busypattern=500,500
;
; NOTE: In the Asterisk Makefile you'll find further options to tweak the busy
; NOTE: In make menuselect, you'll find further options to tweak the busy
; detector. If your country has a busy tone with the same length tone and
; silence (as many countries do), consider defining the
; -DBUSYDETECT_COMPARE_TONE_AND_SILENCE option.
; silence (as many countries do), consider enabling the
; BUSYDETECT_COMPARE_TONE_AND_SILENCE option.
;
; To further detect which hangup tone your telco provider is sending, it is
; useful to use the ztmonitor utility to record the audio that main/dsp.c
; is receiving after the caller hangs up.
;
; Use a polarity reversal to mark when a outgoing call is answered by the
; remote party.

@ -52,6 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/ulaw.h"
#include "asterisk/alaw.h"
#include "asterisk/utils.h"
#include "asterisk/options.h"
/*! Number of goertzels for progress detect */
enum gsamp_size {
@ -162,8 +163,8 @@ enum gsamp_thresh {
#define BELL_MF_TWIST 4.0 /* 6dB */
#define BELL_MF_RELATIVE_PEAK 12.6 /* 11dB */
#if !defined(BUSYDETECT_MARTIN) && !defined(BUSYDETECT) && !defined(BUSYDETECT_TONEONLY) && !defined(BUSYDETECT_COMPARE_TONE_AND_SILENCE)
#define BUSYDETECT_MARTIN
#if defined(BUSYDETECT_TONEONLY) && defined(BUSYDETECT_COMPARE_TONE_AND_SILENCE)
#error You cant use BUSYDETECT_TONEONLY together with BUSYDETECT_COMPARE_TONE_AND_SILENCE
#endif
typedef struct {
@ -902,7 +903,6 @@ static int __ast_dsp_silence(struct ast_dsp *dsp, short *s, int len, int *totals
return res;
}
#ifdef BUSYDETECT_MARTIN
int ast_dsp_busydetect(struct ast_dsp *dsp)
{
int res = 0, x;
@ -948,9 +948,6 @@ int ast_dsp_busydetect(struct ast_dsp *dsp)
if ((hittone >= dsp->busycount - 1) && (avgtone >= BUSY_MIN && avgtone <= BUSY_MAX)) {
#endif
#ifdef BUSYDETECT_COMPARE_TONE_AND_SILENCE
#ifdef BUSYDETECT_TONEONLY
#error You cant use BUSYDETECT_TONEONLY together with BUSYDETECT_COMPARE_TONE_AND_SILENCE
#endif
if (avgtone > avgsilence) {
if (avgtone - avgtone*BUSY_PERCENT/100 <= avgsilence)
res = 1;
@ -965,9 +962,9 @@ int ast_dsp_busydetect(struct ast_dsp *dsp)
/* If we know the expected busy tone length, check we are in the range */
if (res && (dsp->busy_tonelength > 0)) {
if (abs(avgtone - dsp->busy_tonelength) > (dsp->busy_tonelength*BUSY_PAT_PERCENT/100)) {
#if 0
ast_log(LOG_NOTICE, "busy detector: avgtone of %d not close enough to desired %d\n",
avgtone, dsp->busy_tonelength);
#ifdef BUSYDETECT_DEBUG
ast_debug(5, "busy detector: avgtone of %d not close enough to desired %d\n",
avgtone, dsp->busy_tonelength);
#endif
res = 0;
}
@ -976,67 +973,23 @@ int ast_dsp_busydetect(struct ast_dsp *dsp)
/* If we know the expected busy tone silent-period length, check we are in the range */
if (res && (dsp->busy_quietlength > 0)) {
if (abs(avgsilence - dsp->busy_quietlength) > (dsp->busy_quietlength*BUSY_PAT_PERCENT/100)) {
#if 0
ast_log(LOG_NOTICE, "busy detector: avgsilence of %d not close enough to desired %d\n",
avgsilence, dsp->busy_quietlength);
#ifdef BUSYDETECT_DEBUG
ast_debug(5, "busy detector: avgsilence of %d not close enough to desired %d\n",
avgsilence, dsp->busy_quietlength);
#endif
res = 0;
}
}
#endif
#ifndef BUSYDETECT_TONEONLY
#if !defined(BUSYDETECT_TONEONLY) && defined(BUSYDETECT_DEBUG)
if (res) {
ast_debug(1, "ast_dsp_busydetect detected busy, avgtone: %d, avgsilence %d\n", avgtone, avgsilence);
ast_debug(5, "ast_dsp_busydetect detected busy, avgtone: %d, avgsilence %d\n", avgtone, avgsilence);
} else {
ast_debug(5, "busy detector: FAILED with avgtone: %d, avgsilence %d\n", avgtone, avgsilence);
}
#endif
return res;
}
#endif
#ifdef BUSYDETECT
int ast_dsp_busydetect(struct ast_dsp *dsp)
{
int x;
int res = 0;
int max, min;
#if 0
if (dsp->busy_hits > 5);
return 0;
#endif
if (dsp->busymaybe) {
#if 0
printf("Maybe busy!\n");
#endif
dsp->busymaybe = 0;
min = 9999;
max = 0;
for (x = DSP_HISTORY - dsp->busycount; x < DSP_HISTORY; x++) {
#if 0
printf("Silence: %d, Noise: %d\n", dsp->historicsilence[x], dsp->historicnoise[x]);
#endif
if (dsp->historicsilence[x] < min)
min = dsp->historicsilence[x];
if (dsp->historicnoise[x] < min)
min = dsp->historicnoise[x];
if (dsp->historicsilence[x] > max)
max = dsp->historicsilence[x];
if (dsp->historicnoise[x] > max)
max = dsp->historicnoise[x];
}
if ((max - min < BUSY_THRESHOLD) && (max < BUSY_MAX) && (min > BUSY_MIN)) {
#if 0
printf("Busy!\n");
#endif
res = 1;
}
#if 0
printf("Min: %d, max: %d\n", min, max);
#endif
}
return res;
}
#endif
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
{

Loading…
Cancel
Save