Compare commits

...

3 Commits

Author SHA1 Message Date
Naveen Albert
a6b15bfb68 app_dial: Allow fractional seconds for dial timeouts.
Even though Dial() internally uses milliseconds for its dial timeouts,
this capability has been mostly obscured from users as the argument is
only parsed as an integer, thus forcing the use of whole seconds for
timeouts.

Parse it as a decimal instead so that timeouts can now truly have
millisecond precision.

Resolves: #1487

UserNote: The answer and progress dial timeouts now have millisecond
precision, instead of having to be whole numbers.
2025-10-02 16:02:48 +00:00
Naveen Albert
e57f10bbe5 dsp.c: Make minor fixes to debug log messages.
Commit dc8e3eeaaf improved the debug log
messages in dsp.c. This makes two minor corrections to it:

* Properly guard an added log statement in a conditional.
* Don't add one to the hit count if there was no hit (however, we do
  still want to do this for the case where this is one).

Resolves: #1496
2025-10-02 14:44:45 +00:00
Naveen Albert
037bf58c78 config_options.c: Improve misleading warning.
When running "config show help <module>", if no XML documentation exists
for the specified module, "Module <module> not found." is returned,
which is misleading if the module is loaded but simply has no XML
documentation for its config. Improve the message to clarify that the
module may simply have no config documentation.

Resolves: #1489
2025-10-02 14:43:06 +00:00
3 changed files with 14 additions and 10 deletions

View File

@@ -97,6 +97,7 @@
<para>If a second argument is specified, this controls the number of seconds we attempt to dial the specified devices
without receiving early media or ringing. If neither progress, ringing, nor voice frames have been received when this
timeout expires, the call will be treated as a CHANUNAVAIL. This can be used to skip destinations that may not be responsive.</para>
<para>The timeouts need not be whole numbers; both arguments accept fractional seconds.</para>
</parameter>
<parameter name="options" required="false">
<optionlist>
@@ -2934,22 +2935,23 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
to_answer = -1;
to_progress = -1;
} else {
double tmp;
char *anstimeout = strsep(&args.timeout, "^");
if (!ast_strlen_zero(anstimeout)) {
to_answer = atoi(anstimeout);
if (to_answer > 0) {
to_answer *= 1000;
if (sscanf(anstimeout, "%30lf", &tmp) == 1 && tmp > 0) {
to_answer = tmp * 1000;
ast_debug(3, "Dial timeout set to %d ms\n", to_answer);
} else {
ast_log(LOG_WARNING, "Invalid answer timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
ast_log(LOG_WARNING, "Invalid answer timeout specified: '%s'. Setting timeout to infinite\n", anstimeout);
to_answer = -1;
}
} else {
to_answer = -1;
}
if (!ast_strlen_zero(args.timeout)) {
to_progress = atoi(args.timeout);
if (to_progress > 0) {
to_progress *= 1000;
if (sscanf(args.timeout, "%30lf", &tmp) == 1 && tmp > 0) {
to_progress = tmp * 1000;
ast_debug(3, "Dial progress timeout set to %d ms\n", to_progress);
} else {
ast_log(LOG_WARNING, "Invalid progress timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
to_progress = -1;

View File

@@ -1239,7 +1239,7 @@ static void cli_show_module_types(struct ast_cli_args *a)
ast_assert(a->argc == 4);
if (!(item = ao2_find(xmldocs, a->argv[3], OBJ_KEY))) {
ast_cli(a->fd, "Module %s not found.\n", a->argv[3]);
ast_cli(a->fd, "Module %s not found or has no config XML documentation.\n", a->argv[3]);
return;
}

View File

@@ -624,7 +624,7 @@ static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp
ast_debug(9, "%d Hz tone Hit! [%d/%d] Ew=%.4E, Et=%.4E, s/n=%10.2f\n", s->freq, s->hit_count + 1, s->hits_required, tone_energy, s->energy, tone_energy / (s->energy - tone_energy));
hit = 1;
} else {
ast_debug(10, "%d Hz tone [%d/%d] Ew=%.4E, Et=%.4E, s/n=%10.2f\n", s->freq, s->hit_count + 1, s->hits_required, tone_energy, s->energy, tone_energy / (s->energy - tone_energy));
ast_debug(10, "%d Hz tone [%d/%d] Ew=%.4E, Et=%.4E, s/n=%10.2f\n", s->freq, s->hit_count, s->hits_required, tone_energy, s->energy, tone_energy / (s->energy - tone_energy));
hit = 0;
}
@@ -635,7 +635,9 @@ static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp
if (hit == s->last_hit) {
if (!hit) {
/* Two successive misses. Tone ended */
ast_debug(9, "Partial detect expired after %d/%d hits\n", s->hit_count, s->hits_required);
if (s->hit_count) {
ast_debug(9, "Partial detect expired after %d/%d hits\n", s->hit_count, s->hits_required);
}
s->hit_count = 0;
} else if (!s->hit_count) {
s->hit_count++;