4.1 C
New York
Friday, November 22, 2024

Azure communications calling sdk (android & ios) incoming name difficulty with push notification/voip notification


I’m making an attempt to implement audio name in my react native app utilizing azure communication calling sdk. When app is within the foreground AND the IncomingCallListener is setup BEFORE a name is initiated it really works high quality. However when a name is initiated first after which the IncomingCallListener is setup within the receiver machine, the incoming name is rarely acquired. I discovered from https://be taught.microsoft.com/en-us/azure/communication-services/how-tos/calling-sdk/push-notifications?pivots=platform-android that i’m speculated to deal with this example by registering for push notifications. So i setup incoming name push notification (voip for iOS) in .internet server.
When incoming name is initiated, i get an occasion webhook from Azure occasion grid. However azure calling sdk expects the payload of this notification in a really particular format which isn’t uncovered contained in the sdk code.

So until i do know what the format is i cant repair this incoming name difficulty. Can anybody assist me perceive what the payload format must be?
NB: I additionally tried utilizing azure notification hub mixed with azure notification with a purpose to obtain incoming name push payload straight from azure. I can see within the notification hub metrics that notifications all the time fail with this error message FCMv1 Authorization Errors
Right here is my code to deal with the incoming name information payload.

public void setUpIncomingCall(Map map, String acsToken, String displayName, Context context) {
        attempt{
            if (callAgent == null) {
                CallAgentOptions callAgentOptions = new CallAgentOptions();
                callAgentOptions.setDisplayName(displayName);


                callClient.createCallAgent(context, new CommunicationTokenCredential(acsToken), callAgentOptions).thenAccept(callAgent1 -> {
                    callAgent = callAgent1;

                    Log.e("incomingCall","created name agent");

                    incomingCallListener = new IncomingCallListener() {
                        @Override
                        public void onIncomingCall(IncomingCall incomingCall) {
                            Log.e("setUpIncomingCall", "Incoming name acquired");
                            currentIncomingCall = incomingCall;
                        }
                    };
                    callAgent.addOnIncomingCallListener(incomingCallListener);

                    PushNotificationInfo pushNotificationInfo = PushNotificationInfo.fromMap(map);

                    if (pushNotificationInfo != null) {
                        callAgent.handlePushNotification(pushNotificationInfo).thenAccept(aVoid -> {
                            Log.e("handleCallPush", "Push payload mapping success");
                        }).exceptionally(throwable -> {
                            throwable.printStackTrace();
                            Log.e("handleCallPush", "Did not handleCallPush", throwable);
                            return null;
                        });
                    } else {
                        Log.e("incomingCall","incomingCall error pushNotificationInfo null");
                    }



                }).exceptionally(throwable -> {
                    Log.e("incomingCall", "setUpIncomingCall error", throwable);
                    return null;
                });
            }
            else {
                Log.e("incomingCall","present name agent");
                incomingCallListener = new IncomingCallListener() {
                    @Override
                    public void onIncomingCall(IncomingCall incomingCall) {
                        Log.e("setUpIncomingCall", "Incoming name acquired");
                        currentIncomingCall = incomingCall;
                    }
                };
                callAgent.addOnIncomingCallListener(incomingCallListener);

                PushNotificationInfo pushNotificationInfo = PushNotificationInfo.fromMap(map);

                if (pushNotificationInfo != null) {
                    callAgent.handlePushNotification(pushNotificationInfo).thenAccept(aVoid -> {
                        Log.e("handleCallPush", "Push payload mapping success");
                    }).exceptionally(throwable -> {
                        throwable.printStackTrace();
                        Log.e("handleCallPush", "Did not handleCallPush", throwable);
                        return null;
                    });
                } else {
                    Log.e("incomingCall","incomingCall error pushNotificationInfo null");
                }
            }
        } catch (Exception exception) {
            exception.printStackTrace();
            Log.e("setUpIncomingCall", "setUpIncomingCall error", exception);
        }

    }

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles