I did it that way because I tried thru the api, but got the same results Luis Jimenez -----Original Message----- From: Anthony Minessale <anthony.minessale@gmail.com> Sender: freeswitch-users-bounces@lists.freeswitch.org Date: Mon, 19 Sep 2011 10:24:32 To: FreeSWITCH Users Help<freeswitch-users@lists.freeswitch.org> Reply-To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Subject: Re: [Freeswitch-users] uuid_broadcast not working are you running a lua script on the session and then trying to connect to event socket on the same server just to send it a command you can already do with a freeswitch.API object ? On Sun, Sep 18, 2011 at 2:48 PM, Luis Jimenez <ljjimenez@gmail.com> wrote:
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();
----------------------------------------------------------------------------------
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org