[Freeswitch-users] Re - FreeSWITCH Lua CUSTOM events interrupting session:streamFile playback - is this possible?
Abaci B
abaci64 at gmail.com
Wed Oct 28 03:24:16 MSK 2015
problem is that I only want to interrupt users playing a specific file,
that's why I was thinking of an even so that I can include the filename in
an event header and in the callback check if the header matches the file
currently being played and break, uuid_break would interrupt even users
listening to another file, I can probably loop through all calls with
uuid_getvar to check if the file is currently being played but would prefer
a more elegant solution
On Tue, Oct 27, 2015 at 7:43 PM, Anthony Minessale <
anthony.minessale at gmail.com> wrote:
> uuid_break <uuid> [all]
>
> if all is there it stops them all, otherwise the currently playing file
> will.
>
>
> On Tue, Oct 27, 2015 at 2:27 PM, Abaci B <abaci64 at gmail.com> wrote:
>
>> I bumped in to a similar Issue where I have a large number of callers
>> listening to a file and in some cases I would like to interrupt everyone
>> listening to a specific file.
>> I tried deleting the file but the file is still being played back, I
>> guess it's either playing from cache or it's buffered, is there a way to
>> not buffer or cache the file?
>> I tried sending an even but the setInputCallback doesn't get triggered
>> from non DTMF on the channel, question is if there is a way to create an
>> event that will trigger the callback function (in lua) or if there is a way
>> to have the callback function listen to custom events, I'm ok if it needs
>> some patching of the code if someone can give me a clue.
>>
>>
>> On Mon, Dec 8, 2014 at 6:00 PM, Andrew Keil <andrew.keil at visytel.com>
>> wrote:
>>
>>> To FreeSWITCH users,
>>>
>>>
>>>
>>> After progressing with Lua inside FreeSWITCH I have a question that I
>>> cannot source an answer for within the current FreeSWITCH documentation.
>>>
>>>
>>>
>>> I have a requirement for an external application to process an event
>>> (via the event socket layer) then return the results back to the
>>> application while an audio file is played back in a loop to the caller.
>>>
>>>
>>>
>>> From the current documentation this method allows for the event to be
>>> sent then the return event is “consumed” using a polling approach. However
>>> the caller is listening to silence.
>>>
>>>
>>>
>>> function poll()
>>>
>>> -- create event and listener
>>>
>>> local event = freeswitch.Event("CUSTOM", "ping::running?")
>>>
>>> local con = freeswitch.EventConsumer("CUSTOM", "ping::running!")
>>>
>>>
>>>
>>> -- add text ad libitum
>>>
>>> event:addHeader("hi", "there")
>>>
>>> -- fire event
>>>
>>> event:fire()
>>>
>>> -- and wait for reply but not very long
>>>
>>> local retevent = con:pop(1, 5000)
>>>
>>> if retevent then
>>>
>>> print("reply received")
>>>
>>> freeswitch.consoleLog("DEBUG",
>>> string.format("reply received: %s\n",retevent:getHeader("Result")))
>>>
>>> return true
>>>
>>> end
>>>
>>> print("no reply")
>>>
>>> freeswitch.consoleLog("DEBUG", "no reply\n")
>>>
>>> return false
>>>
>>> end
>>>
>>>
>>>
>>> *Some questions:*
>>>
>>> 1) Is there a way to playback audio (eg. session:streamFile(…))
>>> while this takes place, since currently session:streamFile(…) seems to be a
>>> blocking function (ie. Finishes when the audio file is played back
>>> completely)?
>>>
>>> 2) Is there a way to use session:setInputCallback(…) to handle an
>>> external CUSTOM event being returned (since this would then be able to
>>> interrupt the session:streamFile(…) just like it does for DTMF or speech
>>> recognition)?
>>>
>>>
>>>
>>> If you have a preferred approach to solving this then I am open to your
>>> suggestions.
>>>
>>>
>>>
>>> I appreciate any assistance that you can give.
>>>
>>>
>>>
>>> Kind Regards,
>>>
>>>
>>>
>>> Andrew Keil
>>>
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> 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
>>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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 ♬ @anthmfs ♬ @FreeSWITCH ♬
>
> ☞ http://freeswitch.org/ ☞ http://cluecon.com/ ☞
> http://twitter.com/FreeSWITCH
> ☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
> <http://freeswitch.org/g+>*
>
> ClueCon Weekly Development Call
> ☎ sip:888 at conference.freeswitch.org ☎ +19193869900
>
> https://www.youtube.com/watch?v=9XXgW34t40s
> https://www.youtube.com/watch?v=NLaDpGQuZDA
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20151027/361f9ef9/attachment.html
Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users
mailing list