mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
dsp.c: Fix and improve potentially inaccurate log message.
If ast_dsp_process is called with a codec besides slin, ulaw, or alaw, a warning is logged that in-band DTMF is not supported, but this message is not always appropriate or correct, because ast_dsp_process is much more generic than just DTMF detection. This logs a more generic message in those cases, and also improves codec-mismatch logging throughout dsp.c by ensuring incompatible codecs are printed out. Resolves: #595
This commit is contained in:
committed by
asterisk-org-access-app[bot]
parent
29a273618d
commit
526a6e0ce4
24
main/dsp.c
24
main/dsp.c
@@ -413,7 +413,7 @@ struct ast_dsp {
|
|||||||
int totalnoise;
|
int totalnoise;
|
||||||
int features;
|
int features;
|
||||||
int ringtimeout;
|
int ringtimeout;
|
||||||
int busymaybe;
|
int busymaybe; /* Boolean, could be a bitfield */
|
||||||
int busycount;
|
int busycount;
|
||||||
struct ast_dsp_busy_pattern busy_cadence;
|
struct ast_dsp_busy_pattern busy_cadence;
|
||||||
int historicnoise[DSP_HISTORY];
|
int historicnoise[DSP_HISTORY];
|
||||||
@@ -428,8 +428,8 @@ struct ast_dsp {
|
|||||||
int digitmode;
|
int digitmode;
|
||||||
int faxmode;
|
int faxmode;
|
||||||
int freqmode;
|
int freqmode;
|
||||||
int dtmf_began;
|
int dtmf_began; /* Boolean, could be a bitfield */
|
||||||
int display_inband_dtmf_warning;
|
int display_inband_dtmf_warning; /* Boolean, could be a bitfield */
|
||||||
float genergy;
|
float genergy;
|
||||||
int mute_fragments;
|
int mute_fragments;
|
||||||
unsigned int sample_rate;
|
unsigned int sample_rate;
|
||||||
@@ -1223,7 +1223,8 @@ int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!ast_format_cache_is_slinear(inf->subclass.format)) {
|
if (!ast_format_cache_is_slinear(inf->subclass.format)) {
|
||||||
ast_log(LOG_WARNING, "Can only check call progress in signed-linear frames\n");
|
ast_log(LOG_WARNING, "Can only check call progress in signed-linear frames, %s not supported\n",
|
||||||
|
ast_format_get_name(inf->subclass.format));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return __ast_dsp_call_progress(dsp, inf->data.ptr, inf->datalen / 2);
|
return __ast_dsp_call_progress(dsp, inf->data.ptr, inf->datalen / 2);
|
||||||
@@ -1466,7 +1467,8 @@ static int ast_dsp_silence_noise_with_energy(struct ast_dsp *dsp, struct ast_fra
|
|||||||
s[x] = AST_ALAW(odata[x]);
|
s[x] = AST_ALAW(odata[x]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Can only calculate silence on signed-linear, alaw or ulaw frames :(\n");
|
ast_log(LOG_WARNING, "Can only calculate silence on signed-linear, alaw or ulaw frames, %s not supported\n",
|
||||||
|
ast_format_get_name(f->subclass.format));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1529,9 +1531,17 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
|
|||||||
shortdata[x] = AST_ALAW(odata[x]);
|
shortdata[x] = AST_ALAW(odata[x]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*Display warning only once. Otherwise you would get hundreds of warnings every second */
|
/* Display warning only once. Otherwise you would get hundreds of warnings every second */
|
||||||
if (dsp->display_inband_dtmf_warning) {
|
if (dsp->display_inband_dtmf_warning) {
|
||||||
ast_log(LOG_WARNING, "Inband DTMF is not supported on codec %s. Use RFC2833\n", ast_format_get_name(af->subclass.format));
|
/* If DTMF is enabled for the DSP, try to be helpful and warn about that specifically,
|
||||||
|
* otherwise emit a more generic message that covers all other cases. */
|
||||||
|
if ((dsp->features & DSP_FEATURE_DIGIT_DETECT) && (dsp->digitmode & DSP_DIGITMODE_DTMF)) {
|
||||||
|
ast_log(LOG_WARNING, "Inband DTMF is not supported on codec %s. Use RFC2833\n",
|
||||||
|
ast_format_get_name(af->subclass.format));
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Can only do DSP on signed-linear, alaw or ulaw frames (%s not supported)\n",
|
||||||
|
ast_format_get_name(af->subclass.format));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dsp->display_inband_dtmf_warning = 0;
|
dsp->display_inband_dtmf_warning = 0;
|
||||||
return af;
|
return af;
|
||||||
|
Reference in New Issue
Block a user