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
Hi @sikumars-msft ,
Don't hesitate to reach out, if you need me to try something in my end ! :)
Hello @Søren Lund ,
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.
Hi @sikumars-msft
Thank you for the update.
First, I notice that I have used a wrong tag in my post. I've tried to correct it but it won't update to Microsoft-graph-teams

The post you mention, I've seen that before. And one of the comments by @JamesTran-MSFT suggest to post on stack overflow with appropriate tags . And I did that back then with this post . It didn't receive that much attention :P
So really looking forward to hearing from the Teams engineering team. I am so invested in this now :D
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 :)
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
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.
Sign in to comment
5 answers
Sort by: Most helpful
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 :)
Sign in to comment
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
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.
Hi @Colin Stone have you got any solution for this issue. I am also facing same issue while try to initiate PSTN call from bot
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.
Thanks for your reply @Colin Stone ,
Please share the solution of this problem if you are able to resolve it.
Hi @Colin Stone ,
are there any news to this topic? Do you get a soultion for calling a PSTN number from your bot?
Regards
Gerd
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.
Sign in to comment
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
Sign in to comment
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
Sign in to comment
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
PSTN Source setting
Sign in to comment
Activity