Azure通信服务 – 应用关闭时的呼入电话

huangapple go评论52阅读模式
英文:

Azure Communication Services - incoming call when app is closed

问题

我正在使用ACS(Azure通信服务)在两台设备之间进行视频/音频通话,接收设备基于Android。

有3种情况 -

  1. 接收设备中的应用程序处于打开且在前台运行状态
  2. 接收设备中的应用程序处于打开但在后台运行状态
  3. 接收设备中的应用程序已关闭

我已将ACS连接到EventGrid,然后连接到一个使用Azure推送通知的Azure函数,可以通过自定义详细信息将来电推送通知发送到设备。

情况1和情况2现在工作得非常好 - 接收到推送通知,我使用它将应用程序置于前台(如果尚未在前台),并激活来电行为。

对于情况3 - 我打开应用程序,然后创建呼叫代理和呼叫客户端,并使用addOnCallsUpdatedListeneraddOnIncomingCallListener添加监听器,但它们似乎不会触发,可能是因为这发生在呼叫已启动之后。

我猜测一个解决方法可能是改变从A到B的呼叫行为,改为开始一个呼叫并使用推送通知让B加入呼叫,但在我做出这个改变之前,我想知道是否有更好的建议。

英文:

I'm using ACS (Azure Communication Services) to run a video/audio call between two devices, the receiving device is Android based.

There are 3 scenarios -

  1. The App in the receiving device is open and in the foreground
  2. The App in the receiving device is open and in the background
  3. The App is closed in the Receiving Device

I wired ACS to EventGrid and from there to an Azure function that uses Azure push notifications and I can get an incomingCall push notification to the device with custom detail.

Scenarios 1 and 2 work very well now - the push notification is received and I use that to bring the app to foreground (if not already) and activate the incoming call behaviour

With scenario 3 - I open the app, which then creates the Call Agent and Call Client and add listeners using both addOnCallsUpdatedListener and addOnIncomingCallListener, but they don't seem to get fired, presumably because this happens AFTER the call had been started.

I'm guessing one workaround would be to change the bahviour from calling from A->B to starting a call and using push notification to get B to join the call, but before I make this change I wanted to know if there are better ideas

答案1

得分: 0

答案是将 ACS 直接连接到通知中心,然后可以向应用程序发送特定结构的通知。
当应用程序收到通知时,实例化 callAgent 和调用 callAgent.handlePushNotification(pushNotificationInfo),其中 pushNotificationInfo 是随 ACS 推送通知一起传递的 Map<String,String>。该函数然后调用 callAgent 的 incomingCallListener。

文档可以在这里找到。

英文:

The answer is to wire ACS directly to Notification Hub which can then deliver a specifically structued notification to the app.
When the app received the notification, instantiate the callAgent and call

callAgent.handlePushNotification(pushNotificationInfo);

where pushNotificationInfo is the Map<String,String> delivered with the push notification from ACS. the function then invokes the callAgent incomingCallListener

Documentation can be found here

huangapple
  • 本文由 发表于 2023年5月26日 14:24:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76338124.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定