unhold method

bool unhold([
  1. Map<String, dynamic>? options,
  2. Function? done
])

Implementation

bool unhold([Map<String, dynamic>? options, Function? done]) {
  logger.debug('unhold()');

  options = options ?? <String, dynamic>{};

  if (_status != C.statusWaitingForAck && _status != C.statusConfirmed) {
    return false;
  }

  if (_localHold == false) {
    return false;
  }

  if (!_isReadyToReOffer()) {
    return false;
  }

  _localHold = false;
  _onunhold('local');

  EventManager handlers = EventManager();
  handlers.on(EventSucceeded(), (EventSucceeded event) {
    if (done != null) {
      done();
    }
  });
  handlers.on(EventCallFailed(), (EventCallFailed event) {
    terminate(<String, dynamic>{
      'cause': dart_sip_c.CausesType.WEBRTC_ERROR,
      'status_code': 500,
      'reason_phrase': 'Unhold Failed'
    });
  });

  if (options['useUpdate'] != null) {
    _sendUpdate(<String, dynamic>{
      'sdpOffer': true,
      'eventHandlers': handlers,
      'extraHeaders': options['extraHeaders']
    });
  } else {
    _sendReinvite(<String, dynamic>{
      'eventHandlers': handlers,
      'extraHeaders': options['extraHeaders']
    });
  }

  return true;
}