Skip to content

Commit 4ea41be

Browse files
committed
Hardened determining call direction for ActiveCall (see details)
Checking call direction now transforms "Incoming" or "Outgoing" text to lowercase before comparison, hardening against future unexpected changes.
1 parent 93593d4 commit 4ea41be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/_internal/method_channel/twilio_voice_method_channel.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,12 @@ class MethodChannelTwilioVoice extends TwilioVoicePlatform {
403403

404404
ActiveCall createCallFromState(String state, {CallDirection? callDirection, bool initiated = false}) {
405405
List<String> tokens = state.split('|');
406+
final direction = callDirection ?? ("incoming" == tokens[3].toLowerCase() ? CallDirection.incoming : CallDirection.outgoing);
406407
return ActiveCall(
407408
from: tokens[1],
408409
to: tokens[2],
409410
initiated: initiated ? DateTime.now() : null,
410-
callDirection: callDirection ?? ("Incoming" == tokens[3] ? CallDirection.incoming : CallDirection.outgoing),
411+
callDirection: direction,
411412
customParams: parseCustomParams(tokens),
412413
);
413414
}

0 commit comments

Comments
 (0)