[Freeswitch-users] uuid_broadcast not working
Luis Jimenez
ljjimenez at gmail.com
Sun Sep 18 23:48:28 MSD 2011
Hello, list
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?
THanks in advance, here my script:
----------------------------------------------------------------------------------------------
require 'socket'
local host = "127.0.0.1"
local port = 8021
function set_hold(uuid)
local conn = socket.connect(host, port)
if (conn) then
local cmd = "bgapi uuid_broadcast " .. uuid .. "
/opt/freeswitch/sounds/es/dm/dm-promo-recharge-hold.G729 aleg";
freeswitch.consoleLog("info", "CMD: " .. cmd .. "\n")
conn:send(string.format("auth
ClueCon\r\n\r\n%s\r\n\r\nexit\r\n\r\n", cmd))
line, err = conn:receive()
while (not err) do
if (line ~= nil) then freeswitch.consoleLog("info", "SCKT: " ..
line .. "\n") end
line, err = conn:receive()
end
conn:close()
else
debug.notice("Error posting to server: " .. host .. ":" .. port)
end
end
function sleep(n)
os.execute("sleep " .. tonumber(n))
end
session:answer()
session:sleep(500);
uuid = session:get_uuid();
freeswitch.consoleLog("info", "UUID: " .. uuid .. "\n");
api = freeswitch.API();
set_hold(uuid);
freeswitch.consoleLog("info", " - - - RETURNED - - -\n");
for i=1,50 do
if not session:ready() then break end
sleep(1);
end
if session:ready() then api:executeString("uuid_break" .. uuid); end
freeswitch.consoleLog("info", " - - - FINNISH COUNTING - - -\n");
session:hangup();
----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110918/55d9e003/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list