Skip to content
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

Correction in sending DTMF via SIP INFO #871

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

luan-evangelista
Copy link

Problem:

When using the sendDTMF function, sending multiple DTMFs failed because the position was not being correctly reset after sending each tone, which resulted in tones being ignored or not sent properly.

Previous behavior:

In the previous state, the logic was not adequate to correctly handle the sending of multiple tones, causing interruptions in the sequential sending of DTMFs. The specific problem was that the code used incorrect logic for manipulating the position index, which caused errors when DTMFs were queued.

Solution:

The implemented correction restructures the management of the position variable and ensures that DTMFs are sent correctly, one at a time, respecting the configured duration and interToneGap values.

Additionally, new logic resets position to ensure that all tones in the queue are sent correctly, resolving the issue of tones being omitted or ignored during the send sequence.

Tests:

After the correction, DTMF sending was validated and all tones were sent as expected without interruptions.

Comment on lines 1058 to 1065
if (this._tones)
{
// Tones are already queued, just add to the queue.
this._tones += tones;

return;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must remain as it it, because there may already be tones being sent by other previous calls to this method.

What we want to do is:

  • remove the variable position. It's local to this function and breaks things when there are already tones being sent.
  • substitute code above
  const tone = this._tones[position];
  position += 1;

by

// Retrieve the next tone.
const tone = this._tones[0];
 
// Remove the tone from this._tones.
this._tones.substring(1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants