[Freeswitch-users] uuid_broadcast not working

Anthony Minessale anthony.minessale at gmail.com
Mon Sep 19 19:24:32 MSD 2011


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 at 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 at 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 at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list