Ejemplo n.º 1
0
void RTCDTMFSender::insertDTMF(const String& tones,
                               int duration,
                               int interToneGap,
                               ExceptionState& exceptionState) {
  if (!canInsertDTMF()) {
    exceptionState.throwDOMException(NotSupportedError,
                                     "The 'canInsertDTMF' attribute is false: "
                                     "this sender cannot send DTMF.");
    return;
  }

  if (duration > maxToneDurationMs || duration < minToneDurationMs) {
    exceptionState.throwDOMException(
        SyntaxError, ExceptionMessages::indexOutsideRange(
                         "duration", duration, minToneDurationMs,
                         ExceptionMessages::ExclusiveBound, maxToneDurationMs,
                         ExceptionMessages::ExclusiveBound));
    return;
  }

  if (interToneGap < minInterToneGapMs) {
    exceptionState.throwDOMException(
        SyntaxError, ExceptionMessages::indexExceedsMinimumBound(
                         "intertone gap", interToneGap, minInterToneGapMs));
    return;
  }

  m_duration = duration;
  m_interToneGap = interToneGap;

  if (!m_handler->insertDTMF(tones, m_duration, m_interToneGap))
    exceptionState.throwDOMException(
        SyntaxError, "Could not send provided tones, '" + tones + "'.");
}
Ejemplo n.º 2
0
void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interToneGap, ExceptionCode& ec)
{
    if (!canInsertDTMF()) {
        ec = NOT_SUPPORTED_ERR;
        return;
    }

    if (duration > maxToneDurationMs || duration < minToneDurationMs) {
        ec = SYNTAX_ERR;
        return;
    }

    if (interToneGap < minInterToneGapMs) {
        ec = SYNTAX_ERR;
        return;
    }

    m_duration = duration;
    m_interToneGap = interToneGap;

    if (!m_handler->insertDTMF(tones, m_duration, m_interToneGap))
        ec = SYNTAX_ERR;
}
Ejemplo n.º 3
0
void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interToneGap, ExceptionState& es)
{
    if (!canInsertDTMF()) {
        es.throwUninformativeAndGenericDOMException(NotSupportedError);
        return;
    }

    if (duration > maxToneDurationMs || duration < minToneDurationMs) {
        es.throwUninformativeAndGenericDOMException(SyntaxError);
        return;
    }

    if (interToneGap < minInterToneGapMs) {
        es.throwUninformativeAndGenericDOMException(SyntaxError);
        return;
    }

    m_duration = duration;
    m_interToneGap = interToneGap;

    if (!m_handler->insertDTMF(tones, m_duration, m_interToneGap))
        es.throwUninformativeAndGenericDOMException(SyntaxError);
}