Skip to content

Commit c7a3f4a

Browse files
bennyboerBenjamin Eder
andauthored
Let the user override the call options by extending SIPUAHelper (#170)
Co-authored-by: Benjamin Eder <[email protected]>
1 parent 1b6395c commit c7a3f4a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/src/sip_ua_helper.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class SIPUAHelper extends EventManager {
7070

7171
Future<bool> call(String target, [bool voiceonly = false]) async {
7272
if (_ua != null && _ua.isConnected()) {
73-
_ua.call(target, _options(voiceonly));
73+
_ua.call(target, buildCallOptions(voiceonly));
7474
return true;
7575
} else {
7676
logger.error(
@@ -157,7 +157,7 @@ class SIPUAHelper extends EventManager {
157157
if (session.direction == 'incoming') {
158158
// Set event handlers.
159159
session
160-
.addAllEventHandlers(_options()['eventHandlers'] as EventManager);
160+
.addAllEventHandlers(buildCallOptions()['eventHandlers'] as EventManager);
161161
}
162162
_calls[event.id] =
163163
Call(event.id, session, CallStateEnum.CALL_INITIATION);
@@ -181,6 +181,9 @@ class SIPUAHelper extends EventManager {
181181
}
182182
}
183183

184+
/// Build the call options.
185+
/// You may override this method in a custom SIPUAHelper class in order to
186+
/// modify the options to your needs.
184187
Map<String, Object> buildCallOptions([bool voiceonly = false]) =>
185188
_options(voiceonly);
186189

@@ -260,7 +263,7 @@ class SIPUAHelper extends EventManager {
260263
//Always accept.
261264
refer.accept((RTCSession session) {
262265
logger.debug('session initialized.');
263-
}, _options(true));
266+
}, buildCallOptions(true));
264267
});
265268

266269
Map<String, Object> _defaultOptions = <String, dynamic>{

0 commit comments

Comments
 (0)