hold method
Hold
Implementation
bool hold([Map<String, dynamic>? options, Function? done]) {
logger.debug('hold()');
options = options ?? <String, dynamic>{};
if (_status != C.statusWaitingForAck && _status != C.statusConfirmed) {
return false;
}
if (_localHold == true) {
return false;
}
if (!_isReadyToReOffer()) {
return false;
}
_localHold = true;
_onhold('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': 'Hold 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;
}