Laerdal / Xamarin.AzureCommunicationCalling

Xamarin iOS and Android binding libraries for Microsofts Azure Communication Services
MIT License
36 stars 11 forks source link

Methods for accept/reject direct calls #32

Closed andersonvieiragomeslopes closed 2 years ago

andersonvieiragomeslopes commented 2 years ago

Hello.

I noticed that there are methods missing in the helper to accept calls, I believe the implementation is this:

public static Call Accept(Call call,IncomingCall incomingCall, AcceptCallOptions acceptCallOptions, Context context) throws ExecutionException, InterruptedException { return incomingCall.accept(context,acceptCallOptions).get(); }

public static void Reject(IncomingCall incomingCall) throws ExecutionException, InterruptedException { incomingCall.reject(); }

You can see here in another example of azure accepting calls, is that in the IncomingCall project class the parameter does not exist.

Android

image

iOS

image

See this, only on android we don't have this property, I'm not confident my implementation will work, just testing, if you see any alternative way to add this, maybe in Metadata.xml but I believe it should work with the helper, which he thinks?

In the official example this works like this: https://github.com/Azure-Samples/communication-services-android-quickstarts/blob/15b6e1800374429df17d34156e01e260d8f114c5/videoCallingQuickstart/app/src/main/java/com/example/videocallingquickstart/MainActivity.java#L326

tompi commented 2 years ago

Hey, can you test this: https://www.nuget.org/packages/Xamarin.AzureCommunicationCallingHelper.Android/2.3.0-beta.1.3

Just added a "get()" to your code to make it sync in the helper.

andersonvieiragomeslopes commented 2 years ago

@tompi Where? I don't understand the adjustment, can you give me an example or show me?

tompi commented 2 years ago

Sorry, I probably messed up something in the binding and wasnt testing the result...

2.3.0-beta.1.4 should have your two new methods

andersonvieiragomeslopes commented 2 years ago

@tompi amazing, now we have the direct calls inside the sdk working, but a detail, I mentioned a parameter that is not being used, then when you have time and remember you can remove the first parameter Call call in the Accept method because it is unused , I ended up not noticing this, thanks a lot for the help, it's just hard for me to understand why these things are not in the api.xml when binding the sdk, because I made a binding of the .aar locally and I didn't find the properties we have in the helper, thanks.

tompi commented 2 years ago

@andersonvieiragomeslopes ooops, i see what you mean about the call param, try the latest.

As for the reason this stuff is not automatically picked up by the binding generator, I dont know why, but I know its caused by microsoft using the retrofuture library, its all methods using the completable future from that library that is not picked up by the bindings generator...

I tried asking ms about it, and tried posting on stack overflow: https://stackoverflow.com/questions/66366829/binding-method-returning-retrofuture-completablefuture

Then I just gave up and created the helper library... :(

andersonvieiragomeslopes commented 2 years ago

@tompi Now I understand the problem. How is this helper generated? I tried to generate the library but it comes out as debug.aar and even changing the Build Variants to release the package seems to be broken and things don't work when doing the binding. Being able to test this here locally can help by giving you the methods that have already been tested and validated here on my machine, what do you think?

tompi commented 2 years ago

@andersonvieiragomeslopes I am just running "gradle build", in the AzureCommunicationCallingHelper folder, and then you should have both debug ant release builds in build/output/aar/

Then I copy the release aar to Xamarin.AzureCommunicationCallingHelper.Android/Jars/ and mod the csproj file to include the new one instead of the previous.