File tree Expand file tree Collapse file tree 2 files changed +25
-15
lines changed Expand file tree Collapse file tree 2 files changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -3281,19 +3281,20 @@ class RTCSession extends EventManager implements Owner {
3281
3281
3282
3282
// I'm the refresher.
3283
3283
if (_sessionTimers.refresher) {
3284
- _sessionTimers.timer = setTimeout (() {
3285
- if (_state == RtcSessionState .terminated) {
3286
- return ;
3287
- }
3288
-
3289
- logger.d ('runSessionTimer() | sending session refresh request' );
3290
-
3291
- if (_sessionTimers.refreshMethod == SipMethod .UPDATE ) {
3292
- _sendUpdate ();
3293
- } else {
3294
- _sendReinvite ();
3295
- }
3296
- }, expires! * 500 ); // Half the given interval (as the RFC states).
3284
+ final int delayMs = expires! * 500 ;
3285
+ _sessionTimers.timer = Timer .periodic (
3286
+ Duration (milliseconds: delayMs),
3287
+ (_) {
3288
+ if (_state == RtcSessionState .terminated) return ;
3289
+ logger.d (
3290
+ 'runSessionTimer() | sending session refresh request with expires=$expires , delayMs=$delayMs ' );
3291
+ if (_sessionTimers.refreshMethod == SipMethod .UPDATE ) {
3292
+ _sendUpdate ();
3293
+ } else {
3294
+ _sendReinvite ();
3295
+ }
3296
+ },
3297
+ );
3297
3298
}
3298
3299
// I'm not the refresher.
3299
3300
else {
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ class SIPUAHelper extends EventManager {
182
182
_settings.session_timers = uaSettings.sessionTimers;
183
183
_settings.ice_gathering_timeout = uaSettings.iceGatheringTimeout;
184
184
_settings.session_timers_refresh_method =
185
- uaSettings.sessionTimersRefreshMethod ;
185
+ uaSettings.sessionTimersRefreshMethodEnum ;
186
186
_settings.instance_id = uaSettings.instanceId;
187
187
_settings.registrar_server = uaSettings.registrarServer;
188
188
_settings.contact_uri = uaSettings.contact_uri != null
@@ -921,5 +921,14 @@ class UaSettings {
921
921
/// Controls which kind of messages are to be sent to keep a SIP session
922
922
/// alive.
923
923
/// Defaults to "UPDATE"
924
- DartSIP_C .SipMethod sessionTimersRefreshMethod = DartSIP_C .SipMethod .UPDATE ;
924
+ String sessionTimersRefreshMethod = 'UPDATE' ;
925
+ DartSIP_C .SipMethod get sessionTimersRefreshMethodEnum {
926
+ switch (sessionTimersRefreshMethod.toUpperCase ()) {
927
+ case 'INVITE' :
928
+ return DartSIP_C .SipMethod .INVITE ;
929
+ case 'UPDATE' :
930
+ default :
931
+ return DartSIP_C .SipMethod .UPDATE ;
932
+ }
933
+ }
925
934
}
You can’t perform that action at this time.
0 commit comments