microsoftgraph / microsoft-graph-comms-samples

Microsoft Graph Communications Samples
MIT License
206 stars 224 forks source link

Can we play the prompt to customer and record all conversations between customer, bot and agent at the same time in MS Teams? #679

Open bijaykush opened 9 months ago

bijaykush commented 9 months ago

When customer makes a call to Teams phone number, we want the call to be answered by MS teams Bot and play the prompt to customer. Secondly, we want to make invite to some MS Teams participant. At the same time, we want to record all the audio between customer, bot and participant.

As per MS documentation, play prompt API works with service hosted media bot only(like IVR Bot), not with Application hosted media(like Teams Recording Bot) which does the real time audio streams recording.

In my use case, I need both Play prompt APIs (Service hosted Media) and Teams Recording Bot to record the conversation in real time (Application hosted media).

Can anyone please suggest me a solution for this? Any help or feedback would be appreciated.

InDieTasten commented 9 months ago

While I haven't worked with this scenario specifically, I don't see why you couldn't register two bots?

  1. Service hosted bot that does prompts, invites participants, and generally manages the business flow for your phoning system
  2. Application hosted bot for recording everything in the call, including prompts and all other participants

In that scenario, bot 1 could invite bot 2 as soon as the call starts, or could even have control flow like asking the caller for consent to being recorded and inviting the second bot only, when the caller agrees, in case that's something relevant to your legislation.

bijaykush commented 9 months ago

Hi @InDieTasten Thank you for looking into the scenario.

I am trying to invite the bot 2 from bot 1 as you are suggesting. While inviting, I am using https://learn.microsoft.com/en-us/graph/api/participant-invite?view=graph-rest-1.0&tabs=http#example-4-invite-one-pstn-participant-to-an-existing-call to invite resource account of bot 2. As per this API, we can invite resource account of bot by assigning a phone number. To start the recording, we need to assign compliance recording policy to any resource account, but not sure how to assign the policy to a resource account. I have tested this by assigning policy to a MS Teams user and inviting, it worked fine. But in our business flow, there will be no real user with recorded policy. We just want to invite the bot 2 and start recording.

Can you suggest any approach to implement this or do you know any other process? Can you please explain in detail?

InDieTasten commented 9 months ago

@bijaykush I wouldn't create a compliance recording policy in this case, unless you have a compliance reason for the recording. Are the recordings mandatory for you to comply with specific conditions?

A policy assignment has multiple parts to it. You need an instance of a recording application, the policy itself and then also the policy assignment to the target, which could then be the identity of the first application. Again, I haven't set this up myself.

One way that would definitely work though would be to call the second via it's api and providing it with the meeting/call invite link. With the correct permissions, the bot 2 could just join the meeting/call using that URI and start recording. The recording application would show up as additional participant in teams however, but there also wouldn't be an audio notification or banner display for all participants about the recording taking place now.

So depends on your use case.

bijaykush commented 9 months ago

@InDieTasten I don't need compliance recording as per my business requirements. But to record the call/meeting, either we can go with policy recording or meeting join URL with Teams Recording Bot (Bot 2). And in our case it is call, not meeting. so we will not have join URL. So I was looking to use user policy based recording.

Please let me know if we can generate join URL for call conference (i.e. Customer + IVR Bot) which we can send to Teams Recording Bot API as join URL?

bijaykush commented 9 months ago

Hi @InDieTasten , Any feedback on above case? This is very critical for our business case. Any help would be appreciated,

InDieTasten commented 9 months ago

@bijaykush I'm am currently very busy, so sorry for the delay. I am doing this in my spare time here.

You should be able to invite a second bot to a call as well, though it might turn into a group call, rather than a one to one call. However, while I'm very knowledgable in regards to application-hosted media bots, I do have to admit that I have limited information about the IVR bot sample. I could look further into your use case, though that would have to happen through some kind of monetary exchange. If you are interested in that kind of consulting service, you can check my profile in GitHub.