-
Notifications
You must be signed in to change notification settings - Fork 82
Prompt() with options #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If I were you, though, I would just implement my own MatchFunc ( |
I did that in my last "EDIT" of my first post. I redefined What should MatchFunc return if I don't want Prompt() to terminate (thus terminating the audio)? Thanks |
This indicates a match is not yet found, so Prompt should not yet terminate. |
play.Incomplete is 0, right? If so, this is why I was asking the following question in my first post: Why is the playback of "sound:mysound" interrupted if MatchFunc returns 0 or play.Incomplete? I'm repasting the code here for clarity:
|
Hmm... yeah, that's definitely how it is supposed to work: For a sanity check, can you play a sequence of multiple files, use |
Hi,
I don't know if this is the right place for general usage questions. First time using this library.
I've tried the example here with play() and it works OK:
https://github.com/CyCoreSystems/ari/blob/main/_examples/play/main.go
Now I'd like to replace Play() with Prompt(), but I'd also like to limit the "interrupt DTMF keys" to a subset of AllDTMF as seen here:
https://github.com/CyCoreSystems/ari/blob/main/ext/play/play.go
say, "01234#".
In other words, if there's a match, playback should be immediately interrupted and I should be able to know which digit was pressed.
I think I need to define an Options struct as seen here:
https://github.com/CyCoreSystems/ari/blob/main/ext/play/options.go
and then pass it to Prompt() as 3rd parameter.
Then I should be able to get the pressed digit in play.Result.DTMF.
Sorry for the rookie question, but a quick example on how to set the options, pass them to Prompt() and read the pressed DTMF would be very useful.
Regards
[EDIT]
I tried this snippet:
I think I need to use MatchDiscrete() for a custom list of digits, right?
[EDIT]
I tried this:
If I press any one of those digits during audio playback, all's well.
However, if I hit '9' which isn't in the list the audio playback is interrupted (when it shouldn't according to
ari/ext/play/options.go
Line 390 in a3f6a36
and I get 0 / nil for res.MatchResult.
[EDIT]
Either I'm misusing/misunderstanding the code or there's a bug:
The match function returns 0 if I press a digit that does not match "list" (eg. "9"). I'm expecting the audio playback to continue when this happens. Instead, the playback is interrupted.
Why is the playback of "sound:mysound" interrupted if MatchFunc returns 0 or play.Incomplete?
The text was updated successfully, but these errors were encountered: