Skip to content

Commit

Permalink
[call_center] fix skill overflow on refreshing agents via MI
Browse files Browse the repository at this point in the history
Completes 6617ecc

(cherry picked from commit d4db200)
  • Loading branch information
bogdan-iancu committed May 5, 2023
1 parent d38c9df commit 8c56c6b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions modules/call_center/cc_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,18 +639,27 @@ int add_cc_agent( struct cc_data *data, str *id, str *location,
if (skills && skills->len) {
p = skills->s;
while (p) {
if (agent->no_skills==MAX_SKILLS_PER_AGENT) {
LM_WARN("too many skills (%d) for the agent <%.*s>, "
"discarding <%.*s>\n",
agent->no_skills, agent->id.len, agent->id.s,
(int)(skills->s+skills->len-p), p);
break;
}
skill.s = p;
p = q_memchr(skill.s, ',', skills->s+skills->len-skill.s);
skill.len = p?(p-skill.s):(skills->s+skills->len-skill.s);
trim(&skill);
if (skill.len) {
skill_id = get_skill_id(data,&skill);
if (skill_id==0) {
LM_ERR("cannot get skill id\n");
goto error1;
LM_WARN("unknown skill <%.*s> for the agent <%.*s>,"
"discarding\n",
skill.len, skill.s, agent->id.len, agent->id.s);
} else {
n = agent->no_skills++;
agent->skills[n] = skill_id;
}
n = agent->no_skills++;
agent->skills[n] = skill_id;
}
if(p)
p++;
Expand Down

0 comments on commit 8c56c6b

Please sign in to comment.