[Freeswitch-users] Method of checking if media is being played at a session

Michael Lutz mytemike72 at gmail.com
Thu Feb 2 12:04:49 MSK 2012


Hi Hynek,

Hmm, ok I get that, but I wonder if it is realy async? because in my
tests I can send a uuid_broadcast to the api, code continues, but play
don't start!, I can place for example 5 plays inside the 'play queue',
but they won't start untill I do a getDigits(), Then all my plays will
start, but are still blocking inside the 'getDigits()' even if I set
the timeout to 10 miliseconds (   getDigits(1, "", 10) ) allthough
this of course would be a nasty workaround anyway. And then still it
will wait for all the plays to finish before code continues (so not
after the 10 miliseconds), this is the first moment I can execute my
pop() to get the play/stop events, and then they all will arive at
once...

In what way do you actually start the playbacks, or is this a bug?

Regards,
Michael Lutz.

2012/2/1 Hynek Cihlar <hynek.cihlar at gmail.com>:
> I do it a little different, I wait for the EXECUTE event of the playback
> application and search for the correlation id. The reason for the
> correlation ID is to be able to react even in cases there are multiple
> unbridged calls and some IVR logic going on on both of them.
>
> Hynek
>
>
>
>
> On Mon, Jan 30, 2012 at 10:54 PM, Michael Lutz <mytemike72 at gmail.com> wrote:
>>
>> Hi Hynek (or anyone else ;-)
>>
>> Thank you for your response. I see you also use the ESL to invoke the
>> playback? Is there a particulair for that other than I am using the
>> UUID_BROADCAST using the api?
>> I am trying to make it work through the ESL but it seems the initial
>> events are not received directly after the the broadcast, but it takes
>> a while. I will paste some example code of what I have done/am trying
>> to do.
>>
>> Any help apreciated!
>>
>> In this example I have created a couple of functions (explained in
>> code) and try t odo an async playback of an audio file, wait for the
>> ESL to confirm the PLAYBACK_START and then call another function which
>> waits for all PLAYBACK_STOP's (sum of plays) to return. Then I do
>> session:hangup. But it never gets the ESL event.
>>
>> In theory this should work. But in some way the events do not come in
>> right away. This code is testable. (only specify a valid filename in
>> the streamFile)
>>
>> Code: http://pastebin.com/ri0L7wmx
>>
>> Regards,
>> Michael Lutz.
>>
>>
>> 2012/1/30 Hynek Cihlar <hynek.cihlar at gmail.com>:
>> > Although I do it using ESL it may be helpful for your case. When issuing
>> > the
>> > broadcast request I create a 'correlation ID' variable with a generated
>> > unique ID (can be any suitable string) for each file to be broadcast.
>> > The ID
>> > is passed back to the ESL app after each particular file stops playing
>> > back.
>> >
>> > In the ESl language I issue the command "execute
>> > playback file_string://myfile.mp3{CorrelationID=myuniqueID}" and then
>> > wait
>> > for an event with the correct correlation ID.
>> >
>> > Hynek
>> >
>> >
>> >
>> > On Mon, Jan 30, 2012 at 5:40 PM, Michael Lutz <mytemike72 at gmail.com>
>> > wrote:
>> >>
>> >> Hi All,
>> >>
>> >> I am dealing with a little problem...
>> >>
>> >> To play asynchronous audio in my Lua script I use the api function
>> >> "uuid_broadcast {uuid} {fileName} aleg". This all works well and audio
>> >> is being buffered if I call my function multiple times.
>> >> When I want to abort all plays and flush the buffer I use "uuid_break
>> >> {uuid} all". This all works excellent!
>> >>
>> >> My problem is I at certain points need to know if audio is being
>> >> played (or awaits in the buffer) and need to pause execution untill
>> >> all audio is beging played (or flushed).
>> >>
>> >> Is there a way of doing this in either Lua or apiFunctions? or a
>> >> channel variable perhaps? I have looked and tryed but cannot seem to
>> >> find a way doing this.
>> >>
>> >>
>> >> Any hints (or solution ;-) appreciated!
>> >>
>> >>
>> >> Regards,
>> >> Michael Lutz
>> >>
>> >>
>> >> _________________________________________________________________________
>> >> Professional FreeSWITCH Consulting Services:
>> >> consulting at freeswitch.org
>> >> http://www.freeswitchsolutions.com
>> >>
>> >> 
>> >> 
>> >>
>> >> Official FreeSWITCH Sites
>> >> http://www.freeswitch.org
>> >> http://wiki.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://wiki.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://wiki.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://wiki.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
>



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