summaryrefslogtreecommitdiff
path: root/main/frame.c
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2007-01-01 19:48:31 +0000
committerOlle Johansson <oej@edvina.net>2007-01-01 19:48:31 +0000
commit9074555e37710be78028b554579a039036bd9d4e (patch)
treec4fc64acd23903d8cd5171a035b57bfe5d6d0730 /main/frame.c
parentf83b845f08c23ec4755d0bf857498b5bd5f67dff (diff)
- Add error handling to ast_parse_allow_disallow
- Use this in chan_sip configuration parsing git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/frame.c')
-rw-r--r--main/frame.c10
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)