[Freeswitch-users] ESL and application "break" (to stop file playback) - timing issues.
Peter Olsson
peter.olsson at visionutveckling.se
Mon Mar 15 02:20:03 PDT 2010
I'm not sure if this belongs in Jira, or if it's possible to do it another way - so I try the list first :)
I'm using ESL to do some IVR functions. Basically I play some sound files, wait for DTMF, and then do something, like record a message, transfer the call to a mobile phone etc. Quite basic and simple.
I've noticed one problem with this, and it's when I want to stop playback using command "break". In 99% of the time everything works as expected, but sometimes I get this problem - and the problem is that the current file doesn't stop playing. And I think I know why this is happening.
Lets say I first send playback(tone_stream://%(1500, 3500, 440.0, 0.0);loops=100) to the channel. This will play a ring-tone (swedish) and loop through it 100 times. When I want to stop this tone I send the break command, and directly after this a new playback command. Maybe 1 time in 100 tries the tone_stream doesn't stop playing. I think this is becuase how break works. From what I understand from the source it just sets the CF_BREAK flag on the channel, and then the playback application will detect this and stop the playback. However, when I send a new playback command immediately after break it will reset the CF_BREAK-flag again, to make sure it won't cause any problems for the new playback. So if the original playback (tone_stream) didn't check the flag before it was reset, it won't known that it was supposed to stop playing.
I guess I could wait 50ms before sending the new playback message, but I can really never be sure that it was handled properly.
Is there any other way around this? How about "break <uuid> all", will it make any difference in this case? Or should this just be treated as a timing bug, and filed to Jira? Any help on this would be greatly appreciated.
These are the messages I'm sending;
SendMsg <uuid>
call-command: execute
execute-app-name: playback
execute-app-arg: tone_stream://%(1500, 3500, 440.0, 0.0);loops=100
When I don't want this to play anymore I send a break;
SendMsg <uuid>
call-command: execute
execute-app-name: break
And immediately after this I want to play another file;
SendMsg <uuid>
call-command: execute
execute-app-name: playback
execute-app-arg: file/to/play.wav
Regards,
Peter Olsson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100315/8fc24263/attachment-0002.html
More information about the FreeSWITCH-users
mailing list