[asterisk-commits] qwell: trunk r98998 - in /trunk: ./ build_tools/ channels/ configs/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 17 14:51:27 CST 2008
Author: qwell
Date: Thu Jan 17 14:51:26 2008
New Revision: 98998
URL: http://svn.digium.com/view/asterisk?view=rev&rev=98998
Log:
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.
Modified:
trunk/Makefile
trunk/build_tools/cflags.xml
trunk/channels/chan_zap.c
trunk/configs/zapata.conf.sample
trunk/main/dsp.c
Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/Makefile?view=diff&rev=98998&r1=98997&r2=98998
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Thu Jan 17 14:51:26 2008
@@ -275,9 +275,7 @@
# 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
Modified: trunk/build_tools/cflags.xml
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/cflags.xml?view=diff&rev=98998&r1=98997&r2=98998
==============================================================================
--- trunk/build_tools/cflags.xml (original)
+++ trunk/build_tools/cflags.xml Thu Jan 17 14:51:26 2008
@@ -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>
Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=98998&r1=98997&r2=98998
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Thu Jan 17 14:51:26 2008
@@ -11829,6 +11829,19 @@
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);
Modified: trunk/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/zapata.conf.sample?view=diff&rev=98998&r1=98997&r2=98998
==============================================================================
--- trunk/configs/zapata.conf.sample (original)
+++ trunk/configs/zapata.conf.sample Thu Jan 17 14:51:26 2008
@@ -599,10 +599,14 @@
;
;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.
Modified: trunk/main/dsp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/dsp.c?view=diff&rev=98998&r1=98997&r2=98998
==============================================================================
--- trunk/main/dsp.c (original)
+++ trunk/main/dsp.c Thu Jan 17 14:51:26 2008
@@ -52,6 +52,7 @@
#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 @@
#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 @@
return res;
}
-#ifdef BUSYDETECT_MARTIN
int ast_dsp_busydetect(struct ast_dsp *dsp)
{
int res = 0, x;
@@ -948,9 +948,6 @@
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 @@
/* 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 @@
/* 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)
{
More information about the asterisk-commits
mailing list