Closed Ant-Pinto closed 1 year ago
I think _request.cancel(cancel_reason)
needs to add nullable support.
void cancel(String reason) {
to
void cancel(String? reason) {
As you said, status_code does not seem to have a preset value when sending cancel before connecting, but it seems that the sender of CANCEL does not need to set status_code, so here you only need to make request.cancel(String? reason);
support nullable.
It would be great if you could try this modification and give me the result, we will be able to fix this bug.
Thanks for checking it out @cloudwebrtc!
I went in and modified invite_client in my pub-cache and it didn't seem to fix it, I was still getting the same error, tried all the various ways of restart/ flutter cleaning, so i went digging a bit.
It looks like there's another cancel function inside sip_message, found at https://github.com/flutter-webrtc/dart-sip-ua/blob/5758d2f65bf4ce823bab2fe4ecc38070c7003a8c/lib/src/sip_message.dart#L313
Adding the nullable support to that function, as well as the invite_client.dart function you provided at https://github.com/flutter-webrtc/dart-sip-ua/blob/5758d2f65bf4ce823bab2fe4ecc38070c7003a8c/lib/src/transactions/invite_client.dart#L115
fixes the error. It had to be both functions during my testing, just one or the other wouldn't resolve the issue.
You are right, these two functions are related and should need to be modified at the same time.
hi, i have same problem is this fixed?
Same Issue. Hangup is not working for incoming (not yet answered) calls.
@cloudwebrtc can you please create a new release version with this fix?
Describe the bug When you initiate a call, if you hang it up before you actually connect to the other party in real time or connect to their voicemail, an error is thrown at rtc_session.dart line ~710
_TypeError (type 'Null' is not a subtype of type 'String' of 'reason')
The issue seems to be that cancel_reason is not actually set when the logic reaches that else if. Looking further up, you can see that the option
status_code
is not being set in the manual hangup callactiveCall!.hangup();
which is causing the code to reach that else if without ever settingstatus_code
.Solution / Workaround? You're able to pass data through options in the hangup function, so you just have passed the expected Map through to the hangup function.
Ex:
However, I'm not sure where we should be getting the actual status_code from. As a temporary solution, I'm setting it to 200 manually when hanging up before a connection happens, but I was hoping to learn the proper status_code value we should be setting, or if maybe there should just be a default value set in the package?
To Reproduce
Expected behavior The call should end on the client, and the destination should stop ringing.
System Infomation() Flutter SDK Version: 2.5.3 Target OS and Version: iOS 12+ & Android Sdk min21 target30+ Host OS and Version: macOS 12.0.1 Apple Silicon