diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-06-03 22:29:37 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-06-03 22:29:37 +0000 |
commit | 7483e1d2b67cc9ae864c38fd0d9862fee2bfd736 (patch) | |
tree | bae74137495d130052bc00597769814b028eb4da /channels | |
parent | c7a5a96fc6f08ecffa692407f14218c7bb5d74b3 (diff) |
simplify logic in a small block of code
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 0b657f68a..cd9479a20 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10034,15 +10034,11 @@ static int function_sippeer(struct ast_channel *chan, char *cmd, char *data, cha } else if (!strcasecmp(colname, "codecs")) { ast_getformatname_multiple(buf, len -1, peer->capability); } else if (!strncasecmp(colname, "codec[", 6)) { - char *codecnum, *ptr; + char *codecnum; int index = 0, codec = 0; - codecnum = strchr(colname, '['); - *codecnum = '\0'; - codecnum++; - if ((ptr = strchr(codecnum, ']'))) - *ptr = '\0'; - + codecnum = colname + 6; /* move past the '[' */ + codecnum = strsep(&codecnum, "]"); /* trim trailing ']' if any */ index = atoi(codecnum); if((codec = ast_codec_pref_index(&peer->prefs, index))) { ast_copy_string(buf, ast_getformatname(codec), len); |