ari
ari copied to clipboard
MatchLenOrTerminator Not waiting for all the DTMF
I want to receive a list of digits from the client, but the Play method returns immediately when the client clicks on the first digit.
This is my code:
func chooseLesson(ctx context.Context, h *ari.ChannelHandle, user *User) { res, _ := play.Play(ctx, h, play.URI(msgPath(msg)), play.MatchLenOrTerminator(10, "#")).Result() lessonId := res.DTMF // <<< Only first digit here }
where is my mistake?
I don't see a problem in your code... Is the caller perhaps expiring the inter-digit timer (default: 3s)? Are you, perhaps, encountering an error and not seeing it?
Thanks for your response.
It happens instantly, not because of the timer.
As you can see in the picture, err is nil, and status is Cancelled
What it means? Why is it cancelled?
There aren't really that many things it could be: https://github.com/CyCoreSystems/ari/blob/master/ext/play/session.go#L186-L219
Context cancellation, overall timeout, or inter-digit timeout. Since you're not getting an Invalid
result, it's not that.