Hello, list<br><br>I have this lua script, i try to put music to the aleg while do another task, but it is not working (not audio at all), any advice on what am doing wrong?<br><br>THanks in advance, here my script:<br><br>
----------------------------------------------------------------------------------------------<br><br>require 'socket'<br>local host = "127.0.0.1"<br>local port = 8021<br><br>function set_hold(uuid)<br> local conn = socket.connect(host, port)<br>
<br> if (conn) then<br> local cmd = "bgapi uuid_broadcast " .. uuid .. " /opt/freeswitch/sounds/es/dm/dm-promo-recharge-hold.G729 aleg";<br> freeswitch.consoleLog("info", "CMD: " .. cmd .. "\n")<br>
conn:send(string.format("auth ClueCon\r\n\r\n%s\r\n\r\nexit\r\n\r\n", cmd))<br> line, err = conn:receive()<br> while (not err) do<br> if (line ~= nil) then freeswitch.consoleLog("info", "SCKT: " .. line .. "\n") end<br>
line, err = conn:receive()<br> end<br> conn:close()<br> else<br> debug.notice("Error posting to server: " .. host .. ":" .. port)<br> end<br>end<br><br>function sleep(n)<br>
os.execute("sleep " .. tonumber(n))<br>end<br><br>session:answer()<br>session:sleep(500);<br>uuid = session:get_uuid();<br>freeswitch.consoleLog("info", "UUID: " .. uuid .. "\n");<br>
<br>api = freeswitch.API();<br><br>set_hold(uuid);<br>freeswitch.consoleLog("info", " - - - RETURNED - - -\n");<br><br><br>for i=1,50 do<br> if not session:ready() then break end<br> sleep(1);<br>
end<br><br>if session:ready() then api:executeString("uuid_break" .. uuid); end<br>freeswitch.consoleLog("info", " - - - FINNISH COUNTING - - -\n");<br><br>session:hangup();<br><br>----------------------------------------------------------------------------------<br>
<br>