Forum Discussion
Cannot initiate PSTN calls from bot
Hi everybody,
within my calling bot I try to initiate a PSTN call like https://docs.microsoft.com/en-us/graph/api/application-post-calls?view=graph-rest-1.0&tabs=http#example-8-create-peer-to-peer-pstn-call-with-application-hosted-media or invite a PSTN as new participant to an Existing call like https://docs.microsoft.com/en-us/graph/api/participant-invite?view=graph-rest-1.0&tabs=http#example-4-invite-one-pstn-participant-to-an-existing-group-call
I always get following exception:
InternalServerError
Microsoft.Graph.ServiceException: Code: 9999
Message: Unknown internal server error.
Inner error:
AdditionalData:
date: 2021-10-26T10:15:50
request-id: 58538d09-d622-4d61-854e-61606e0f6530
client-request-id: 58538d09-d622-4d61-854e-61606e0f6530
ClientRequestId: 58538d09-d622-4d61-854e-61606e0f6530
at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at RC_MsGraphLink.Controllers.GraphApi.GraphHandler.MakeCall(InvitationParticipantInfo device) in C:\Users\GeW\Documents\tfshome\GLOBAL\MAIN\RC_MsGraphLink\RC_MsGraphLink\Controllers\GraphApi\GraphHandlerCallControl.cs:line 45
My bot has assigned a PSTN number and could be called from extern. Everything also works fine if I try the scenarios with MS Teams Users.
We also followed the instrucions from https://docs.microsoft.com/en-us/graph/cloud-communications-phone-number#assign-a-phone-number-to-your-bot
There is a similar problem described here:
https://techcommunity.microsoft.com/t5/teams-developer/initiate-pstn-call-from-teams-to-public-landline/m-p/2105893#M2564
Any ideas?
Thanks for yout help.
Regards
Gerd
- We could solve the problem. We used the wrong object ID for creating the call. After using the object ID from the assigned service user, it works.
- Nivedipa-MSFTMicrosoft
We are looking into the issue.We will update you
Thanks,
Nivedipa
------------------------------------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
- relkniwBrass Contributor
Nivedipa-MSFTHi Nivedipa,
I could solve the "InternalServerError" by using following c# code:
AdditionalData = new Dictionary<string, object>()
{
{"phone", new Identity() { Id = pDevice} }
}instad of
AdditionalData = new Dictionary<string, object>()
{
{"phone", "{\"@odata.type\":\"#microsoft.graph.identity\",\"id\":\"+12345678901\"}"}
}But now I have annother problem: After sending the MakeCall Request I get an establishing Event and immediately an Terminated Event with an Error:
"value": [
{
"changeType": "Updated",
"resourceUrl": "/communications/calls/911f6100-723b-400b-9053-893f686f3131",
"resource": "/app/calls/911f6100-723b-400b-9053-893f686f3131",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"callChainId": "ef0c7f6a-974b-4700-8525-d74fe4d924c2"
},
"@odata.type": "#microsoft.graph.commsNotification"
}
],
"@odata.type": "#microsoft.graph.commsNotifications"
}{
"value": [
{
"changeType": "Deleted",
"resourceUrl": "/communications/calls/911f6100-723b-400b-9053-893f686f3131",
"resource": "/app/calls/911f6100-723b-400b-9053-893f686f3131",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 500,
"subcode": 9999,
"message": "Get Outbound routing - failed getting userId from billedUserMri: 28:d86f4970-a209-46f1-ad06-87137338eac2. DiagCode: 500#510543"
},
"callChainId": "ef0c7f6a-974b-4700-8525-d74fe4d924c2",
"terminationSender": {
"@odata.type": "#microsoft.graph.identitySet",
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+41*********",
"displayName": "4:+41*******",
"identityProvider": "None"
}
}
},
"@odata.type": "#microsoft.graph.commsNotification"
}
],
"@odata.type": "#microsoft.graph.commsNotifications"
}The service user for the bot has an "Microsoft 365 E3" and a "Microsoft 365 Phone System" license.
And I am able to make call from a PSTN number to the bot.
Any idea?
Regards
Gerd
- relkniwBrass ContributorWe could solve the problem. We used the wrong object ID for creating the call. After using the object ID from the assigned service user, it works.