Every RawPacket is converted to DtmfRawPacket with isEnd boolean flag inside.
The amount of DtmfRawPackets depends on DTMF tone duration, for example
amount of 1000 - 5 packets with toEnd == false, and 3 packets with toEnd == true
amount of 2000 - 10 packets with toEnd == false, and 3 packets with toEnd == true
Then DtmfRawPackets go to synchronized block in addTonePacket
Processing thread of DTMFDispatcher gets current packet in synchronized block, let's say a packet1.
When it leaves synchronized block to process the packet1, another packet2 comes to addTonePacket with for example toEnd = true
At the end of processing packet1 we set toEnd to false, but packet2 is not yet processed, so we will process it wrongly, with toEnd = false, instead of toEnd = true.
This change is created to fix incorrect interpretations of DTMF tones.
When I send a single digit DTMF tone with a duration, for example, 1000 sendTones
this tone is caught by DtmfTransformEngine as multiple RawPackets
Every RawPacket is converted to DtmfRawPacket with isEnd boolean flag inside.
The amount of DtmfRawPackets depends on DTMF tone duration, for example amount of 1000 - 5 packets with toEnd == false, and 3 packets with toEnd == true amount of 2000 - 10 packets with toEnd == false, and 3 packets with toEnd == true
Then DtmfRawPackets go to synchronized block in addTonePacket
Processing thread of DTMFDispatcher gets current packet in synchronized block, let's say a packet1. When it leaves synchronized block to process the packet1, another packet2 comes to addTonePacket with for example toEnd = true At the end of processing packet1 we set toEnd to false, but packet2 is not yet processed, so we will process it wrongly, with toEnd = false, instead of toEnd = true.