Hello Stefan
Thank you very much for your response. We have changed the skript.
Unfortunately the call allocation does not work properly yet. As you can see in the examples below, the lower priority agent is called first, then the agent with the highest skill. The call strategy works, but the skill levels are not taken into account. Do you have another idea?
Greetings
function init(queue)
– ast_verbose("**** QUEUE " … queue.name)
end
function cleanup()
– ast_verbose("**** Cleanup ")
end
function enter_queue(entry,vars)
– ast_verbose("**** Enter queue")
for key,value in pairs(vars) do
_, , skill_id = string.find(key, "^*MDC_SKILL%-(%d+)$")
if skill_id ~= nil then
– ast_verbose("Found skill " … skill_id)
ast_queue_log(entry.queuename,entry.uniqueid,“NONE”,“INFO”,“REQSKILL” … “|” … key … “|”… value)
end
end
end
function calc_metric(member,entry,vars)
-- lookup the skills table for this agent
skillset = agent_skills[member.membername]
score=0
-- traverse required skills
for key,value in pairs(vars) do
_, _, skill_id = string.find(key, "^_*MDC_SKILL%-(%d+)$")
if skill_id ~= nil then
requiredlevel = tonumber(value)
-- we can skip skills with a level of zero
if requiredlevel > 0 then
if skillset == nil then
-- we require a skill but the agent does not have ANY skills,
-- so skip this agent
-- ast_verbose("Agent " .. member.membername .." has no skills")
return -1
end
-- lookup required skill
level = tonumber(skillset[key])
if level == nil then
-- Agent does not have the required skill
-- so skip this agent
-- ast_verbose("Agent " .. member.membername .." misses skill " .. key)
return -1
end
if level<requiredlevel then
-- Agents skill level is to low
-- so skip this agent
-- ast_verbose("Agent " .. member.membername .." skill " .. key .." level to low: " .. level .."<" ..requiredlevel)
return -1
end
-- sum up score (if using score )
score = score + level
end
end
end
ast_verbose(“Agent " … member.membername …” has score " … score)
– example for score calculation: negate score because lower value wins
-- zero means: consider this agent but use standard asterisk strategy for calling
end
– Executing [ext@sub_main-139:4] Set(“SIP/mdc_trunk_conf-2-00000e60”, “__PICKUPMARK=139”) in new stack
– Executing [ext@sub_main-139:5] Queue(“SIP/mdc_trunk_conf-2-00000e60”, “IVR_Dextra,C,100”) in new stack
– Started music on hold, class ‘Wartemusik_Auto’, on SIP/mdc_trunk_conf-2-00000e60
— Agent Local/106@mdc_multidial-106 has score 2
— Agent Local/105@mdc_multidial-105 has score 2
— Agent Local/102@mdc_multidial-102 has score 2
— Agent Local/101@mdc_multidial-101 has score 1
— Agent Local/100@mdc_multidial-100 has score 8
– Called Local/101@mdc_multidial-101
– Started music on hold, class ‘Wartemusik_Auto’, on SIP/mdc_trunk_conf-2-00000e63
— Agent Local/106@mdc_multidial-106 has score 2
— Agent Local/105@mdc_multidial-105 has score 2
— Agent Local/102@mdc_multidial-102 has score 2
— Agent Local/101@mdc_multidial-101 has score 1
— Agent Local/100@mdc_multidial-100 has score 8
– Executing [100@mdc_multidial-100:1] Wait(“Local/100@mdc_multidial-100-00001236;2”, “0.1”) in new stack
– Called Local/100@mdc_multidial-100