Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] How to query current playback position?


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
avi at avimarcus.net
Guest





PostPosted: Mon Aug 23, 2021 10:10 am    Post subject: [Freeswitch-users] How to query current playback position? Reply with quote

I'm trying to create a bookmark feature for long playbacks.

I'll save the file and position (to be exact the sample position) and then when the caller comes back, they can choose to restart in the same place.


The playback tool allows me to specify the sample position (and uuid_fileman lets me seek to one)


But I don't see how to query the _current_ position.
There's no status inside uuid_fileman
There's no variables I see that are updating when doing uuid_dump.


The closest I see is that if I stop the playback, I get a PLAYBACK_STOP event with the sample position.


This seems like it could work, but that's means I need to trigger a script to stop the playback (can't continue listening) and wait for an ESL event, and hope we're getting the right one. (How to I listen for events attached only to a specific UUID?) This seems overly complicated.


I was hoping to have a uuid_fileman option or the like to query the current position.


Does that exist somewhere? 


Thanks. 
Back to top
dragos at freeswitch.org
Guest





PostPosted: Mon Aug 23, 2021 11:14 am    Post subject: [Freeswitch-users] How to query current playback position? Reply with quote

We set these channel variables in switch_ivr_play_say.c : playback_last_offset_pos, playback_seconds, playback_ms, playback_samples. 



On Mon, Aug 23, 2021 at 5:53 PM Avi Marcus <avi@avimarcus.net (avi@avimarcus.net)> wrote:

Quote:
I'm trying to create a bookmark feature for long playbacks.

I'll save the file and position (to be exact the sample position) and then when the caller comes back, they can choose to restart in the same place.


The playback tool allows me to specify the sample position (and uuid_fileman lets me seek to one)


But I don't see how to query the _current_ position.
There's no status inside uuid_fileman
There's no variables I see that are updating when doing uuid_dump.


The closest I see is that if I stop the playback, I get a PLAYBACK_STOP event with the sample position.


This seems like it could work, but that's means I need to trigger a script to stop the playback (can't continue listening) and wait for an ESL event, and hope we're getting the right one. (How to I listen for events attached only to a specific UUID?) This seems overly complicated.


I was hoping to have a uuid_fileman option or the like to query the current position.


Does that exist somewhere? 


Thanks. 

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
avi at avimarcus.net
Guest





PostPosted: Wed Aug 25, 2021 4:17 am    Post subject: [Freeswitch-users] How to query current playback position? Reply with quote

It looks like those variable are only updated upon PLAYBACK_STOP event, since the line before is:switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file);



Can we make a feature, e.g. with uuid_fileman to query that for a live playing file?


When I stop the file to get the position, it's destructive: I have to do a new playback to get back to my position, and to get all my key bindings, I need to transfer to an extension with them, and then I lose the position in the IVR.


Thanks.-Avi Marcus








On Mon, Aug 23, 2021 at 7:03 PM Dragos Oancea <dragos@freeswitch.org (dragos@freeswitch.org)> wrote:

Quote:
We set these channel variables in switch_ivr_play_say.c : playback_last_offset_pos, playback_seconds, playback_ms, playback_samples. 



On Mon, Aug 23, 2021 at 5:53 PM Avi Marcus <avi@avimarcus.net (avi@avimarcus.net)> wrote:

Quote:
I'm trying to create a bookmark feature for long playbacks.

I'll save the file and position (to be exact the sample position) and then when the caller comes back, they can choose to restart in the same place.


The playback tool allows me to specify the sample position (and uuid_fileman lets me seek to one)


But I don't see how to query the _current_ position.
There's no status inside uuid_fileman
There's no variables I see that are updating when doing uuid_dump.


The closest I see is that if I stop the playback, I get a PLAYBACK_STOP event with the sample position.


This seems like it could work, but that's means I need to trigger a script to stop the playback (can't continue listening) and wait for an ESL event, and hope we're getting the right one. (How to I listen for events attached only to a specific UUID?) This seems overly complicated.


I was hoping to have a uuid_fileman option or the like to query the current position.


Does that exist somewhere? 


Thanks. 

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
dragos at freeswitch.org
Guest





PostPosted: Wed Aug 25, 2021 5:17 am    Post subject: [Freeswitch-users] How to query current playback position? Reply with quote

how are you playing the file ?I gave this a try, I used "playback" in dialplan, then I used uuid_fileman from CLI with cmd "stop". And I get the chan vars:
variable_playback_seconds: 12
variable_playback_ms: 12288
variable_playback_samples: 98304



Yes, they are meant to work on "stop" . You get the values when it's stopped and then you seek to position.
You can seek with "playback":
<action application="playback" data="<sound-file-to-play>[@@<seek-offset>]"/>

You can use inline dialplan too I think.


If you believe it's a bug, file a github issue.
Perhaps this feature for uuid_fileman would be useful too, so you could file it as a feature request. 




On Wed, Aug 25, 2021 at 11:39 AM Avi Marcus <avi@avimarcus.net (avi@avimarcus.net)> wrote:

Quote:
It looks like those variable are only updated upon PLAYBACK_STOP event, since the line before is:switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file);



Can we make a feature, e.g. with uuid_fileman to query that for a live playing file?


When I stop the file to get the position, it's destructive: I have to do a new playback to get back to my position, and to get all my key bindings, I need to transfer to an extension with them, and then I lose the position in the IVR.


Thanks.-Avi Marcus








On Mon, Aug 23, 2021 at 7:03 PM Dragos Oancea <dragos@freeswitch.org (dragos@freeswitch.org)> wrote:

Quote:
We set these channel variables in switch_ivr_play_say.c : playback_last_offset_pos, playback_seconds, playback_ms, playback_samples. 



On Mon, Aug 23, 2021 at 5:53 PM Avi Marcus <avi@avimarcus.net (avi@avimarcus.net)> wrote:

Quote:
I'm trying to create a bookmark feature for long playbacks.

I'll save the file and position (to be exact the sample position) and then when the caller comes back, they can choose to restart in the same place.


The playback tool allows me to specify the sample position (and uuid_fileman lets me seek to one)


But I don't see how to query the _current_ position.
There's no status inside uuid_fileman
There's no variables I see that are updating when doing uuid_dump.


The closest I see is that if I stop the playback, I get a PLAYBACK_STOP event with the sample position.


This seems like it could work, but that's means I need to trigger a script to stop the playback (can't continue listening) and wait for an ESL event, and hope we're getting the right one. (How to I listen for events attached only to a specific UUID?) This seems overly complicated.


I was hoping to have a uuid_fileman option or the like to query the current position.


Does that exist somewhere? 


Thanks. 

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
avi at avimarcus.net
Guest





PostPosted: Wed Aug 25, 2021 5:46 am    Post subject: [Freeswitch-users] How to query current playback position? Reply with quote

I don't think it's a bug, just something that would be nice if it worked differently. I file a feature request:

https://github.com/signalwire/freeswitch/issues/1316



While writing that, I see I could write the entire playback control in javascript, which might mean I don't lose my IVR position. I'd still have to deal with stopping/restarting the playback.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services