diff --git a/channels/chan_dect.c b/channels/chan_dect.c index 737074ef5..0343c3538 100644 --- a/channels/chan_dect.c +++ b/channels/chan_dect.c @@ -452,7 +452,7 @@ static int dect_db_parse_codec_list(struct dect_pt *pt, const char *key, cl = pt->codec_list; } - tmp = strchr(val, '_'); + tmp = strchr(key, '_'); if (tmp == NULL) return -1; strncpy(num, tmp + 1, sizeof(num)); @@ -469,6 +469,9 @@ static int dect_db_parse_codec_list(struct dect_pt *pt, const char *key, cl->entry[i].cplane = dect_parse_num(val); else return -1; + + if (i + 1 > cl->num) + cl->num = i + 1; return 0; }