Uuid_broadcast during LUA loop doesn't play audio

Hello all,

I have a LUA script running on a channel like this:

-- Script A
for i=1,10 do
     --Waste time
    os.execute("sleep 10");
end

While this script is running, I have a luarun script executing

-- Script B
api = freeswitch.API()
for i=1,10 do
api:executeString('uuid_broadcast <uuid of call running scriptA> say::en\\snumber\\spronounced\\s" .. i);
end

The broadcasts have no impact on the channel until after the for loop ends in script A, then all the queued broadcasts play sequentially. The same behavior occurs with uuid_displace, and with bgapi execution.

Why is the LUA thread blocking immediate executing of uuid_broadcast? How can I stop that behavior for the audio to play immediately?

you can’t use os.execute sleep, you’ll be blocking the session thread. do session:sleep(10000);

/b

1 Like