question

SrenLund-3432 avatar image
13 Votes"
SrenLund-3432 asked saldana-msft edited

Trying to call PSTN phone from bot using POST request fails with "Call source identity invalid."

Hello there

I'm trying to initiate a call to a PSTN phone using this example from the communications part of the MS Graph API.
using this example: Create peer-to-peer PSTN call with application hosted media . But I always get a: "Call source identity invalid."
I have made a detailed explanation in this Github Repo

Trying other types of identity, we have been able to establish a call, only to have et quickly declined with a:
Rejected call as reverse number lookup for global user failed.. DiagCode: 403#10144

More info could be found here on an issue comment

Best regards
Søren Lund

office-teams-app-devmicrosoft-graph-teamworkmicrosoft-graph-sdk
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SrenLund-3432,

Thanks for reaching out. We are looking into this, will update soon.

4 Votes 4 ·

Hi @sikumars-msft ,
Don't hesitate to reach out, if you need me to try something in my end ! :)

0 Votes 0 ·

Hello @SrenLund-3432,

Sorry for the delayed response.

I had tried to replicate above scenario and found that this issue is more related to Teams Workload. From AAD side, authentication was successful. Even the permissions seem to be correctly configured. It is failing at Microsoft.Skype.Calling Workload.

I am trying to get some expertise from Teams engineering team on this, meanwhile I would request you to refer this similar Microsoft QnA thread and see if that helps you. Thanks.

1 Vote 1 ·
Show more comments

just faced this issue and was fixed as follows:

check if the ApplicationId in teams app instance has the same ApplicationId from your bot registered in Bot Services:

Using teams powershell module: Get-CSOnlineApplicationInstance

If needed, you update it using Set-CsOnlineApplicationInstance -ApplicationId

Also, make sure that the applicationInstance.Id in the request body is the applicationInstance.objectId from teams application instance.

Regards, Deivid

1 Vote 1 ·

Hi Deivid,

Thanks for the reply. I was just inquiring if you have a moment to direct me to the sections to check. For example under portal.azure.com Under Bot services-><Bot>->Configuration I see the Microsoft App id which is the same app id i use in my c# project. Is this what you are referring to. Also the tenant id matches. My bot is definitely communicating and working team->team but not to PSTN.

Additionally if i use the MS Team app on my desktop and make a PSTN call it works so I know the setup seems fine my using the MS Teams app. However dialing the same mobile number via the bot fails. I am sure it is a setting somewhere. Additionally what licenses do you have assigned to your bot? I am just trying to get everything as close as possible to someone who has got the system working.

Thanks, Colin.

1 Vote 1 ·

Now may also be a good time to mention the end goal. Which is to create a bot that can make a group call to a user within the organisation, and add a recipient by PSTN (public user outside the organisation). That way I can have a 3rd party program initiate a call between a teams user and PSTN landline. The bot can then either remove itself from the call or stay and do bot stuff for the teams user :)

0 Votes 0 ·
NikithaMSFT-0176 avatar image
1 Vote"
NikithaMSFT-0176 answered

Copying answer from comments for better understanding.

Now may also be a good time to mention the end goal. Which is to create a bot that can make a group call to a user within the organisation, and add a recipient by PSTN (public user outside the organisation). That way I can have a 3rd party program initiate a call between a teams user and PSTN landline. The bot can then either remove itself from the call or stay and do bot stuff for the teams user :)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ColinStone-4300 avatar image
0 Votes"
ColinStone-4300 answered

Just commenting - as i am having the same problem as Soren. The idea is to have teams implement click to dial and replace the traditional computer telephony integration (CTI). Ideally you would want the bot to sit silently and initiate a call between the caller and recipient. But of course the caller needs to be on the call first. The bot then dials via PSTN the recipient.

At the moment I am aware it is not possible to do direct calling from caller to recipient from other forum posts but i have setup a bot with a number and tried to create a group call against the documentation or adding a participant to a call and I either get "addParticipants failed for participant <mobile number> Underlying reason: Call does not contain the metadata required for making this PSTN dial out.. DiagCode: 403#10151, yet i have followed the information on the Microsoft graph site for creating a call. The number i am dialing should be any phone number and definitely outside the organization tenant.

I have tried so many different ways, I think as we move and integrate more with traditional phone lines a working bot version in your examples would really help. I have also raised a potential bug which is a real problem for integrating CTI over and above this. initiate-then-decline-a-call-using-microsoft-graph.html


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

meisterheister avatar image
0 Votes"
meisterheister answered meisterheister edited

Hey everyone, issue still seem to persist since I still get "Call source identity invalid.". In our case we are using Direct Routing scenario to receive and create calls via PSTN. There are already Application Instance accounts in use for Teams Call Queues which forward to external numbers thanks to Virtual Phone System license.
To assign a phone number to the bot I partly followed the instructions here linked at the create PSTN call examples but had to slightly change the Powershell commands from "Set-CsOnlineVoiceApplicationInstance" to "Set-CsOnlineApplicationInstance" since I need to assign the number via "-OnpremPhoneNumber" (for Direct Routing scenario) parameter and need to "Grant-CsOnlineVoiceRoutingPolicy" afterwards to allow routing via Session Border Controller (SBC).
Peer-to-Peer calls are working well as also shown in the create call examples the difference is for sure one is an identity type "applicationInstance" and the other "application", see the different source settings below.


Peer-to-Peer Source setting

   "source": {
     "@odata.type": "#microsoft.graph.participantInfo",
     "identity": {
       "@odata.type": "#microsoft.graph.identitySet",
       "application": {
         "@odata.type": "#microsoft.graph.identity",
         "displayName": "calling bot",
         "id": "XXXXX-XXXXX-XXXXX-XXXX-XXXXX"
       }
     },
     "region": null,
     "languageId": null
   }

PSTN Source setting

   "source": {
     "@odata.type": "#microsoft.graph.participantInfo",
     "identity": {
       "@odata.type": "#microsoft.graph.identitySet",
       "applicationInstance": {
         "@odata.type": "#microsoft.graph.identity",
         "displayName": "calling bot",
         "id": "XXXXX-XXXXX-XXXXX-XXXX-XXXXX"
       },
     },
     "countryCode": null,
     "endpointType": null,
     "region": null,
     "languageId": null
   }


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ColinStone-4300 avatar image
1 Vote"
ColinStone-4300 answered ColinStone-4300 commented

Thanks @meisterheister, I read your message and tried both approaches just to be sure however, still not able to dial.

I took your comments and checked but still nothing. Here is what I have done

  1. For the record i have my bot working. It can initiate a call to a teams client using the GUID of the internal teams user.

  2. I have modified the code to be exactly the code in example 7 of application-post-calls substituting only the CallbackUri, the bot id in the source->additional data section and the phone number to be my mobile. I set the tenantid to the call object which seems to be a miss in the documentation.

  3. Under the Microsoft 365 Admin center I can see my bot email address and that bot has Microsoft 365 Standard, 365 Business Voice, International and Domestic Calling plans and 365 Phone system virtual user selected.

  4. Under the teams admin center->Org-wide settings->Resource accounts I have my bot account and have a physical number assigned to it from Microsoft. The resource account type is Auto Attendent. The phone number type is Online.

  5. Under the teams admin center->voice->phone numbers I have a number type of service and status assigned and that is assigned to my bot.

  6. Under Azure Active Directory->App registrations->my bot->api permissions I have all Calls... permissions for Application type defined, permitted and granted.

  7. A check under the azure portal->my bot->channels-> has Microsoft Teams calling enabled.

Now when I run the code executing example 7 and all i get is an exception saying

Code: 9999
Message: Unkown internal Server Error.
Scenario Id: 5271eeda-539e-45f8-b4cb-fdf915e5c326
Inner error:
AdditionalData:
date: 2021-03-31T08:26:36
request-id: c26cd3e6-eb7e-4acb-a875-b2f9883d29fc
client-request-id: cf0d0242-546e-434a-a365-6b9086e19a7e

the bot fully works with an internal teams user i.e. example 1 in the above link but example 7 fails.

Any help would be greatly appreciated.

Thanks.


· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ColinStone-4300 have you got any solution for this issue. I am also facing same issue while try to initiate PSTN call from bot

0 Votes 0 ·

Hi there, sorry for the late reply. Still nothing on this.

I have also replied to an earlier post asking for a little more detail from people who have it working.

I suspect it is a setting somewhere so I am hoping someone who has it working has the steps they went through to make it work. Microsoft's documentation has examples of how to make the calls to PSTN but these are not working for me.

Thanks,

Colin.

1 Vote 1 ·

Thanks for your reply @ColinStone-4300,
Please share the solution of this problem if you are able to resolve it.

0 Votes 0 ·

Hi @ColinStone-4300 ,

are there any news to this topic? Do you get a soultion for calling a PSTN number from your bot?
Regards
Gerd

0 Votes 0 ·

Hi Gerd,

No luck but i haven't tried for a while. I had integration with PSTN as a requirement for a client and they couldn't get basic teams integration working with PSTN so they ripped out the solution and went with another IP provider. So I am not surprised i couldn't get it working.

It is entirely frustrating but i haven't tried in a while. We ended up going with a zoom integration for the time being. Super simple to implement but of course would really like to get Teams integrated.

Colin.

0 Votes 0 ·
SrenLund-3432 avatar image
1 Vote"
SrenLund-3432 answered

Hello @sikumars-msft

Any chance there is any development on this ? :) I have just tried to make a request against the api. But the result is still the same.

/Søren

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.