Страница 1 из 1

Call center and lua scripts

СообщениеДобавлено: 22 авг 2016, 16:00
Dimon
Добрый день. Тестирую на фс воспроизведение очереди. использую скрпит

-- callcenter-announce-position.lua
-- Announce queue position to a member in a given mod_callcenter queue.
-- Arguments are, in order: caller uuid, queue_name, interval (in milliseconds).
api = freeswitch.API()
caller_uuid = argv[1]
queue_name = argv[2]
mseconds = argv[3]
if caller_uuid == nil or queue_name == nil or mseconds == nil then
return
end
while (true) do
-- Pause between announcements
freeswitch.msleep(mseconds)
members = api:executeString("callcenter_config queue list members "..centron@172.16.200.201)
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
-- Members have a position when their state is Waiting or Trying
if string.find(line, caller_uuid, 1, true) ~= nil then
-- Member still in queue, so script must continue
exists = true
api:executeString("uuid_broadcast "..caller_uuid.." ivr/ivr-you_are_number.wav aleg")
api:executeString("uuid_broadcast "..caller_uuid.." digits/"..pos..".wav aleg")
end
pos = pos+1
end
end
-- If member was not found in queue, or it's status is Aborted - terminate script
if exists == false then
return
end
end

<extension name="start_call_center">
<condition field="${caller_id_name}" expression="^([^#]+#)(.*)$" break="never" >
<action application="set" data="caller_id_name=$2" />
</condition>
<condition field="destination_number" expression="^(4449)$">
<action application="answer"/>
<action application="set" data="hangup_after_bridge=true" />
<action application="sleep" data="1000"/>
<action application="set" data="result=${luarun(callcenter-announce-position.lua ${uuid} centron@172.16.200.201 10000)}"/>
<action application="callcenter" data="centron@172.16.200.201"/>


</condition>

но выдает ошибку

[ERR] mod_lua.cpp:203 /usr/local/freeswitch/scripts/callcenter-announce-position.lua:14: ')' expected near '@'


Не подскажите где моя ошибка. На форумах облазил но ничего не нашел по этому поводу..

Re: Call center and lua scripts

СообщениеДобавлено: 22 авг 2016, 22:27
gland
Пользуйтесь редакторами с подсветкой синтаксиса во избежание подобных траблов.

Re: Call center and lua scripts

СообщениеДобавлено: 26 авг 2016, 09:50
Samael28
Dimon писал(а):members = api:executeString("callcenter_config queue list members "..centron@172.16.200.201)

Не особо вдаваясь в подробности. Вот тут ошибка. lua в том синтаксисе, что вы привели, ожидает в centron@172.16.200.201 переменную. Некошерное имя, вы не находите?