Callcenter-announce-waiting.lua — различия между версиями
Материал из Webitel CallManager Wiki
(Новая страница: «Скрипт озвучивания расчетное время ожидание абонента в очереди Кампании. <source lang="lua"> …») |
|||
Строка 10: | Строка 10: | ||
mseconds = argv[3] | mseconds = argv[3] | ||
if mseconds==nil then return end | if mseconds==nil then return end | ||
+ | avg_minute = argv[4] | ||
+ | if avg_minute==nil then return end | ||
while (true) do | while (true) do | ||
Строка 20: | Строка 22: | ||
if string.find(line,caller_uuid,1,true)~=nil then | if string.find(line,caller_uuid,1,true)~=nil then | ||
exists=true | exists=true | ||
− | if ( | + | waitingTime = avg_minute * pos; |
− | + | PlayFile = "file_string://webitel/queue-holdtime.wav"; | |
+ | if (waitingTime <= 1) then | ||
+ | PlayFile = PlayFile.."!webitel/queue-less-than.wav!time/minutes-i.wav"; | ||
else | else | ||
− | + | PlayFile = PlayFile.."!digits/"..waitingTime..".wav!time/minutes.wav"; | |
− | + | end | |
− | + | api:executeString("uuid_broadcast "..caller_uuid.." "..PlayFile.." aleg"); | |
end | end | ||
pos=pos+1 | pos=pos+1 | ||
Строка 32: | Строка 36: | ||
if exists==false then return end | if exists==false then return end | ||
end | end | ||
− | |||
</source> | </source> | ||
[[Category:SDK]] | [[Category:SDK]] | ||
[[Category:Lua]] | [[Category:Lua]] |
Текущая версия на 11:29, 19 августа 2013
Скрипт озвучивания расчетное время ожидание абонента в очереди Кампании.
api = freeswitch.API()
caller_uuid = argv[1]
if caller_uuid==nil then return end
queue_name = argv[2]
if queue_name==nil then return end
mseconds = argv[3]
if mseconds==nil then return end
avg_minute = argv[4]
if avg_minute==nil then return end
while (true) do
freeswitch.msleep(mseconds)
members = api:executeString("callcenter_config queue list members "..queue_name)
pos=1
exists=false
for line in members:gmatch("[^\r\n]+") do
if (string.find(line,"Trying")~=nil or string.find(line,"Waiting")~=nil) then
if string.find(line,caller_uuid,1,true)~=nil then
exists=true
waitingTime = avg_minute * pos;
PlayFile = "file_string://webitel/queue-holdtime.wav";
if (waitingTime <= 1) then
PlayFile = PlayFile.."!webitel/queue-less-than.wav!time/minutes-i.wav";
else
PlayFile = PlayFile.."!digits/"..waitingTime..".wav!time/minutes.wav";
end
api:executeString("uuid_broadcast "..caller_uuid.." "..PlayFile.." aleg");
end
pos=pos+1
end
end
if exists==false then return end
end