BelledonneCommunications / linphone-windows10

Linphone.org mirror for linphone-windows10 (git://git.linphone.org/linphone-windows10.git)
GNU General Public License v2.0
15 stars 27 forks source link

Can't distinguish between established calls and missed calls #29

Open Reza-Noei opened 2 years ago

Reza-Noei commented 2 years ago

Hi, I'm using a database to storing call detail records. In CallControllerListener interface (which is implemented by App.xaml.cs) there are some methods which are called right after specific events. e.g. CallIncoming, NewCallStarted, CallEnded, ...

I want to know whether this call is established or its being declined either by caller or callee. I tried to check several points in InCall.xaml.cs but there is nothing clear to me. Only difference was in call state transition (OutgoingEarlyMedia -> Error means callee refused, OutgoingEarlyMedia -> Connected means call established). but its not a good smell. And I can't predict exceptions. Please add new events or something more clear to catch. thanks.

Another thing i got from my test cases was duplication on triggering CallStateChanged event (InCall.xaml.cs). as you can see in below logs each event raised about 4 times instead of 1. I don't know if it leads us into a serious condition or not.

LinphoneManager.Instance.CallStateChangedEvent += CallStateChanged;


2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingInit. 2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingInit. 2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingInit. 2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingInit. 2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingProgress. 2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingProgress. 2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingProgress. 2022-07-04 17:41:52 [INF] InCall Call state changed to OutgoingProgress. 2022-07-04 17:41:52 [INF] InCall Call state changed to Released. 2022-07-04 17:41:52 [INF] InCall Call state changed to Released. 2022-07-04 17:41:52 [INF] InCall Call state changed to Released. 2022-07-04 17:41:52 [INF] InCall Call state changed to Released. 2022-07-04 17:41:52 [INF] InCall Call state changed to Connected. 2022-07-04 17:41:52 [INF] InCall Call state changed to Connected. 2022-07-04 17:41:52 [INF] InCall Call state changed to Connected. 2022-07-04 17:41:52 [INF] InCall Call state changed to Connected. 2022-07-04 17:41:52 [INF] InCall Call state changed to StreamsRunning. 2022-07-04 17:41:52 [INF] InCall Call state changed to StreamsRunning. 2022-07-04 17:41:52 [INF] InCall Call state changed to StreamsRunning. 2022-07-04 17:41:52 [INF] InCall Call state changed to StreamsRunning. 2022-07-04 17:41:52 [INF] Dialer Browser path: /CallRespondingAgents/Dashboard. 2022-07-04 17:41:54 [INF] InCall Call state changed to End. 2022-07-04 17:41:54 [INF] InCall Call state changed to End. 2022-07-04 17:41:54 [INF] InCall Call state changed to End. 2022-07-04 17:41:54 [INF] InCall Call state changed to End. 2022-07-04 17:41:54 [INF] App A command call has been ended. 2022-07-04 17:41:54 [INF] InCall Call state changed to Released. 2022-07-04 17:41:54 [INF] InCall Call state changed to Released. 2022-07-04 17:41:54 [INF] InCall Call state changed to Released. 2022-07-04 17:41:54 [INF] InCall Call state changed to Released.

soroshsabz commented 2 years ago

Why StreamsRunning does not equal with long time establish call?

Did you see CallState.StreamsRunning?

Reza-Noei commented 2 years ago

CallState.Connected solved my problem but I've got another problem. in the below line at InCall.xaml.cs is called on each call (incoming/outgoing):

LinphoneManager.Instance.CallStateChangedEvent += CallStateChanged;

And registers CallStateChanged method as a handler for this event. LinphoneManager.Instance is a singleton object and after the second call we will have double, triple, ... CallStateChanged calls on every single call state change. It may leads us into memory leakage problems and performance issues.

soroshsabz commented 2 years ago

You must unregister it in OnNavigatingFrom to prevent multiple registration and memory leaks

This is bug in this repo, and must be fix it.

soroshsabz commented 2 years ago

I try to resolve it in BSVN fork

soroshsabz commented 2 years ago

I create https://github.com/BSVN/linphone-windows10/issues/12 for resolving this issue

soroshsabz commented 2 years ago

@julonexus Did you want to I make a PR for this repo too?

soroshsabz commented 2 years ago

@julonexus Why you comment ? https://github.com/BelledonneCommunications/linphone-windows10/blob/074768c0e0bea42473c375654b9a6232ceae2030/Linphone/Views/InCall.xaml.cs#L235

soroshsabz commented 2 years ago

@julonexus ?