user->amaflags = format;
}
} else if (!strcasecmp(v->name, "allow")) {
- ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, 1);
+ int error = ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, TRUE);
+ if (error)
+ ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value);
} else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, 0);
+ int error = ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, FALSE);
+ if (error)
+ ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value);
} else if (!strcasecmp(v->name, "autoframing")) {
user->autoframing = ast_true(v->value);
} else if (!strcasecmp(v->name, "callingpres")) {
} else if (!strcasecmp(v->name, "pickupgroup")) {
peer->pickupgroup = ast_get_group(v->value);
} else if (!strcasecmp(v->name, "allow")) {
- ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, 1);
+ int error = ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, TRUE);
+ if (error)
+ ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value);
} else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, 0);
+ int error = ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, FALSE);
+ if (error)
+ ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value);
} else if (!strcasecmp(v->name, "autoframing")) {
peer->autoframing = ast_true(v->value);
} else if (!strcasecmp(v->name, "rtptimeout")) {
externrefresh = 10;
}
} else if (!strcasecmp(v->name, "allow")) {
- ast_parse_allow_disallow(&default_prefs, &global_capability, v->value, 1);
+ int error = ast_parse_allow_disallow(&default_prefs, &global_capability, v->value, TRUE);
+ if (error)
+ ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value);
} else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(&default_prefs, &global_capability, v->value, 0);
+ int error = ast_parse_allow_disallow(&default_prefs, &global_capability, v->value, FALSE);
+ if (error)
+ ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value);
} else if (!strcasecmp(v->name, "autoframing")) {
global_autoframing = ast_true(v->value);
} else if (!strcasecmp(v->name, "allowexternaldomains")) {
return find_best ? ast_best_codec(formats) : 0;
}
-void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing)
+int ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing)
{
+ int errors = 0;
char *parse = NULL, *this = NULL, *psize = NULL;
int format = 0, framems = 0;
if (option_debug)
ast_log(LOG_DEBUG,"Packetization for codec: %s is %s\n", this, psize);
framems = atoi(psize);
- if (framems < 0)
+ if (framems < 0) {
framems = 0;
+ errors++;
+ ast_log(LOG_WARNING, "Bad packetization value for codec %s\n", this);
+ }
}
if (!(format = ast_getformatbyname(this))) {
ast_log(LOG_WARNING, "Cannot %s unknown format '%s'\n", allowing ? "allow" : "disallow", this);
+ errors++;
continue;
}
}
}
}
+ return errors;
}
static int g723_len(unsigned char buf)