diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-01 19:48:31 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-01 19:48:31 +0000 |
commit | 953339bb1776c4aa6d52a7aae9ffaff281f47d10 (patch) | |
tree | c4fc64acd23903d8cd5171a035b57bfe5d6d0730 /main | |
parent | 98cbdc7b3c2b1c3e0184d30f7b3c48e703c06e6e (diff) |
- Add error handling to ast_parse_allow_disallow
- Use this in chan_sip configuration parsing
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49093 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/frame.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/main/frame.c b/main/frame.c index a6fd97ac9..ba796d174 100644 --- a/main/frame.c +++ b/main/frame.c @@ -1143,8 +1143,9 @@ int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best) 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; @@ -1156,11 +1157,15 @@ void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char 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; } @@ -1187,6 +1192,7 @@ void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char } } } + return errors; } static int g723_len(unsigned char buf) |