Playtone manipulation

I was playing with the dial plan in order to construct such a scheme:
Calls come into Asterisk through E1 channel without DID, Asterisk has to answer the call as soon as one of the timeslots gets used. It shall answer the call and give a playtone to the other side while waiting for the digits from the client side. After the first digit is dialed, playtone must be stopped, but the collection of digits must continue untill digits reach max length or a timeout occurs.

I have setup the following dialplan:

exten => s,1,Answer
exten => s,2,Playtones(dial)
exten => s,3,Set(TIMEOUT(digit)=5)
exten => s,4,WaitExten

exten => _XXX,1,Dial(SIP/${EXTEN})

It is working, as I get the playtone and I can dial the extensions. However, the problem is that I need to stop playtone after the first digit gets dialed. I have tried to play with StopPlaytones function, but without success. I am sure I am missing something simple here.

I would be very thankful if someone could hint how shall I build such a dialplan, so that playtone would be stopped after the first digit is dialed. Furthermore, Im interested how shall I stop playtone lets say after the second digit, in case the first digit was “0”.

P.S. One of the ways would be to record the tone and then play it with BackGround function and in that case it works exactly as I want, but I would much prefer a “proper” solution to the question.
P.P.S. There is only one topic on the forums that asks almost the same questions, but the example given in there is not working for me… Playtone continues to play after all the digits… :frowning: (

easy. put the exten => xxx in a different context, then send the caller to DISA()… specify no password adn that context. do show application disa at the cli for more info.