[Freeswitch-users] mod_lua play file into conference
Josh M. Patten
jpatten at co.brazos.tx.us
Tue May 10 10:34:43 MSD 2011
It seems the way this could be accomplished is to allow asynchronous execution capabilities in lua. However I don't think this exists.
Is there a better way to "execute and forget" the conference app so the script can move on to the next bit of code?
________________________________
From: freeswitch-users-bounces at lists.freeswitch.org [freeswitch-users-bounces at lists.freeswitch.org] on behalf of Josh M. Patten [jpatten at co.brazos.tx.us]
Sent: Tuesday, May 10, 2011 1:21 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] mod_lua play file into conference
Only problem is session:streamFile doesn't make it into conference.
The only way I've found to do this so far is to conference_set_auto_outcall a loopback extension to a non-user extension that simply streams a file in a context:
session:execute("conference_set_auto_outcall","loopback/3041/custom/")
but if I want to mute the conference so only the originator is heard (a standard "overhead" style page) using:
session:execute("set", "conference_auto_outcall_flags=mute") then this is never heard because this loopback "participant" is muted as well.
________________________________
From: freeswitch-users-bounces at lists.freeswitch.org [freeswitch-users-bounces at lists.freeswitch.org] on behalf of Tom C [mel0torme at gmail.com]
Sent: Tuesday, May 10, 2011 12:08 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] mod_lua play file into conference
I was thinking about this a few days ago. Slightly different scenario: I want to stream audio into a conference every ten minutes or so.
My ideas was to do it by connecting another extension to the conference. This extra extension would (theoretically) run a Lua script to stream the audio, and then sleep, and every few seconds it would look to see if it was the only extension still connected to the conference.
In your case, if you're doing the "mad boss" and inviting all the participants to the conference, it should be easy to add one more extension to the list of invites. Just have the extension's script wait 10 seconds or so before streaming the audio, and then it can just hang up.
Something like this:
streamwelcomefile.lua
<code>
if ( session:ready() ) then
session:answer();
session:sleep(10000) -- wait for 10 seconds for other people to join conference.
session:streamFile("ivr/8000/ivr-welcome.wav");
session:streamFile("ivr/8000/ivr-thank_you_for_calling.wav");
session:hangup("NORMAL_CLEARING");
end
</code>
And the dialplan might look like this:
<code>
<extension name="StreamWelcome">
<condition field="destination_number" expression="^000111$">
<action application="lua" data="streamwelcomefile.lua" />
</condition>
</extension>
</code>
Disclaimer: I haven't actually tested this in a conference. Good luck! :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110510/eeb104be/attachment.html
More information about the FreeSWITCH-users
mailing list