Re: DTMF v4

On 17 December 2012 04:28, Harald Alvestrand <harald@alvestrand.no> wrote:
>> According to the current spec, if insertDTMF is called on the same object
>> while an existing task for this object to generate DTMF is still running,
>> the previous task is canceled. Is there a "tonechange" event indicating that
>> the previous sequence has been canceled? The same question also applies to
>> the case insertDTMF is called with an empty string to cancel the tones being
>> sent.
>
> Text change. See if you like the new one.

I have a different view on this.  If there is a sequence playing out,
the task should not be cancelled, the pending tones should be replaced
with the new tone string.  Since we can't "recall" a tone, this allows
the tone duration and spacing to be respected.  It also enables code
like:

    sender.insertDTMF('');
    sender.ontonechange = function(e) {
        var next = tones.shift();
        e.target.insertDTMF(next.tone, next.duration);
    };

Without proper spacing, the tones would all run into each other, as
fast as the event loop can spit them out.

But that assumes that we fire the empty string tonechange event when
an empty string is provided.  That is what the pseudocode says, but I
can imagine some zealous programmer deciding to prevent this.

Received on Monday, 17 December 2012 16:32:24 UTC