mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-15 08:44:14 +00:00
simplify logic in a small block of code
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user