Handle call events
Register the call signaling listener centrally in the OpenIM Flutter SDK.
Register OnSignalingListener centrally when initializing your application's calling service:
Code example
Future<void> registerCallListener() {
return OpenIM.iMManager.signalingManager.setSignalingListener(
OnSignalingListener(
onReceiveNewInvitation: handleIncomingCall,
onInviteeAccepted: handleInviteeAccepted,
onInviteeRejected: handleInviteeRejected,
onInvitationCancelled: handleInvitationCancelled,
onInvitationTimeout: handleInvitationTimeout,
onInviteeAcceptedByOtherDevice: handleAcceptedElsewhere,
onInviteeRejectedByOtherDevice: handleRejectedElsewhere,
onHangup: handleHangup,
onRoomParticipantConnected: handleParticipantConnected,
onRoomParticipantDisconnected: handleParticipantDisconnected,
onStreamChange: handleStreamChange,
),
);
}Call events encompass the full invitation lifecycle, participant joins and leaves, and media stream state transitions. Use roomID as the primary merge key for call state, and qualify participant states by their user IDs. For custom signaling events, see Send a custom signal.
SignalingManager stores only one listener instance; a subsequent invocation replaces previously registered callbacks. Because the SDK does not provide an unregister method, stop forwarding events to old state stores when logging out or switching accounts, and re-register the complete listener instance upon the next user sign-in.
Was this page helpful?