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);
;
;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.
#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 {
#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 {
return res;
}
-#ifdef BUSYDETECT_MARTIN
int ast_dsp_busydetect(struct ast_dsp *dsp)
{
int res = 0, x;
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;
/* 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;
}
/* 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)
{