ari icon indicating copy to clipboard operation
ari copied to clipboard

MatchLenOrTerminator Not waiting for all the DTMF

Open avraham1 opened this issue 2 years ago • 3 comments

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?

avraham1 avatar Nov 09 '22 21:11 avraham1

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?

Ulexus avatar Nov 09 '22 21:11 Ulexus

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?

image

avraham1 avatar Nov 10 '22 18:11 avraham1

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.

Ulexus avatar Nov 10 '22 18:11 Ulexus