SOLVED

Cannot initiate PSTN calls from bot

%3CLINGO-SUB%20id%3D%22lingo-sub-2885495%22%20slang%3D%22en-US%22%3ECannot%20initiate%20PSTN%20calls%20from%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2885495%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everybody%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ewithin%20my%20calling%20bot%20I%20try%20to%20initiate%20a%20PSTN%20call%20like%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fapplication-post-calls%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%23example-8-create-peer-to-peer-pstn-call-with-application-hosted-media%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fapplication-post-calls%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%23example-8-create-peer-to-peer-pstn-call-with-application-hosted-media%3C%2FA%3E%20or%20invite%20a%20PSTN%20as%20new%20participant%20to%20an%20Existing%20call%20like%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fparticipant-invite%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%23example-4-invite-one-pstn-participant-to-an-existing-group-call%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fparticipant-invite%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%23example-4-invite-one-pstn-participant-to-an-existing-group-call%3C%2FA%3E%3C%2FP%3E%3CP%3EI%20always%20get%20following%20exception%3A%3C%2FP%3E%3CP%3EInternalServerError%3CBR%20%2F%3EMicrosoft.Graph.ServiceException%3A%20Code%3A%209999%3CBR%20%2F%3EMessage%3A%20Unknown%20internal%20server%20error.%3CBR%20%2F%3EInner%20error%3A%3CBR%20%2F%3EAdditionalData%3A%3CBR%20%2F%3Edate%3A%202021-10-26T10%3A15%3A50%3CBR%20%2F%3Erequest-id%3A%2058538d09-d622-4d61-854e-61606e0f6530%3CBR%20%2F%3Eclient-request-id%3A%2058538d09-d622-4d61-854e-61606e0f6530%3CBR%20%2F%3EClientRequestId%3A%2058538d09-d622-4d61-854e-61606e0f6530%3C%2FP%3E%3CP%3Eat%20Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage%20request%2C%20HttpCompletionOption%20completionOption%2C%20CancellationToken%20cancellationToken)%3CBR%20%2F%3Eat%20Microsoft.Graph.BaseRequest.SendRequestAsync(Object%20serializableObject%2C%20CancellationToken%20cancellationToken%2C%20HttpCompletionOption%20completionOption)%3CBR%20%2F%3Eat%20Microsoft.Graph.BaseRequest.SendAsync%5BT%5D(Object%20serializableObject%2C%20CancellationToken%20cancellationToken%2C%20HttpCompletionOption%20completionOption)%3CBR%20%2F%3Eat%20RC_MsGraphLink.Controllers.GraphApi.GraphHandler.MakeCall(InvitationParticipantInfo%20device)%20in%20C%3A%5CUsers%5CGeW%5CDocuments%5Ctfshome%5CGLOBAL%5CMAIN%5CRC_MsGraphLink%5CRC_MsGraphLink%5CControllers%5CGraphApi%5CGraphHandlerCallControl.cs%3Aline%2045%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20bot%20has%20assigned%20a%20PSTN%20number%20and%20could%20be%20called%20from%20extern.%20Everything%20also%20works%20fine%20if%20I%20try%20the%20scenarios%20with%20MS%20Teams%20Users.%3C%2FP%3E%3CP%3EWe%20also%20followed%20the%20instrucions%20from%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fcloud-communications-phone-number%23assign-a-phone-number-to-your-bot%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fcloud-communications-phone-number%23assign-a-phone-number-to-your-bot%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20a%20similar%20problem%20described%20here%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fteams-developer%2Finitiate-pstn-call-from-teams-to-public-landline%2Fm-p%2F2105893%23M2564%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fteams-developer%2Finitiate-pstn-call-from-teams-to-public-landline%2Fm-p%2F2105893%23M2564%3C%2FA%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EAny%20ideas%3F%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EThanks%20for%20yout%20help.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3ERegards%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EGerd%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2885495%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMS%20Graph%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2887083%22%20slang%3D%22en-US%22%3ERe%3A%20Cannot%20initiate%20PSTN%20calls%20from%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2887083%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1155243%22%20target%3D%22_blank%22%3E%40relkniw%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20are%20looking%20into%20the%20issue.We%20will%20update%20you%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EThanks%2C%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENivedipa%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E------------------------------------------------------------------------------------------------------------------------%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EIf%20the%20response%20is%20helpful%2C%20please%20click%20%22**Mark%20as%20Best%20Response**%22%20and%20like%20it.%20You%20can%20share%20your%20feedback%20via%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FDevSupportFeedback)%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EMicrosoft%20Teams%20Developer%20Feedback%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Blink.%20Click%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FDevCommunityEscalationForm%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehere%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bto%20escalate.%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2920347%22%20slang%3D%22en-US%22%3ERe%3A%20Cannot%20initiate%20PSTN%20calls%20from%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2920347%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1183910%22%20target%3D%22_blank%22%3E%40Nivedipa-MSFT%3C%2FA%3EHi%20Nivedipa%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20could%20solve%20the%20%22InternalServerError%22%20by%20using%20following%20c%23%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdditionalData%20%3D%20new%20Dictionary%3CSTRING%3E()%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%22phone%22%2C%20new%20Identity()%20%7B%20Id%20%3D%20pDevice%7D%20%7D%3CBR%20%2F%3E%7D%3C%2FSTRING%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Einstad%20of%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdditionalData%20%3D%20new%20Dictionary%3CSTRING%3E()%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%22phone%22%2C%20%22%7B%5C%22%40odata.type%5C%22%3A%5C%22%23microsoft.graph.identity%5C%22%2C%5C%22id%5C%22%3A%5C%22%2B12345678901%5C%22%7D%22%7D%3CBR%20%2F%3E%7D%3C%2FSTRING%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20now%20I%20have%20annother%20problem%3A%20After%20sending%20the%20MakeCall%20Request%20I%20get%20an%20establishing%20Event%20and%20immediately%20an%20Terminated%20Event%20with%20an%20Error%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%22value%22%3A%20%5B%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%22changeType%22%3A%20%22Updated%22%2C%3CBR%20%2F%3E%22resourceUrl%22%3A%20%22%2Fcommunications%2Fcalls%2F911f6100-723b-400b-9053-893f686f3131%22%2C%3CBR%20%2F%3E%22resource%22%3A%20%22%2Fapp%2Fcalls%2F911f6100-723b-400b-9053-893f686f3131%22%2C%3CBR%20%2F%3E%22resourceData%22%3A%20%7B%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.call%22%2C%3CBR%20%2F%3E%22state%22%3A%20%22establishing%22%2C%3CBR%20%2F%3E%22callChainId%22%3A%20%22ef0c7f6a-974b-4700-8525-d74fe4d924c2%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.commsNotification%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%5D%2C%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.commsNotifications%22%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%3CBR%20%2F%3E%22value%22%3A%20%5B%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%22changeType%22%3A%20%22Deleted%22%2C%3CBR%20%2F%3E%22resourceUrl%22%3A%20%22%2Fcommunications%2Fcalls%2F911f6100-723b-400b-9053-893f686f3131%22%2C%3CBR%20%2F%3E%22resource%22%3A%20%22%2Fapp%2Fcalls%2F911f6100-723b-400b-9053-893f686f3131%22%2C%3CBR%20%2F%3E%22resourceData%22%3A%20%7B%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.call%22%2C%3CBR%20%2F%3E%22state%22%3A%20%22terminated%22%2C%3CBR%20%2F%3E%22resultInfo%22%3A%20%7B%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.resultInfo%22%2C%3CBR%20%2F%3E%22code%22%3A%20500%2C%3CBR%20%2F%3E%22subcode%22%3A%209999%2C%3CBR%20%2F%3E%22message%22%3A%20%22Get%20Outbound%20routing%20-%20failed%20getting%20userId%20from%20billedUserMri%3A%2028%3Ad86f4970-a209-46f1-ad06-87137338eac2.%20DiagCode%3A%20500%23510543%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22callChainId%22%3A%20%22ef0c7f6a-974b-4700-8525-d74fe4d924c2%22%2C%3CBR%20%2F%3E%22terminationSender%22%3A%20%7B%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.identitySet%22%2C%3CBR%20%2F%3E%22phone%22%3A%20%7B%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.identity%22%2C%3CBR%20%2F%3E%22id%22%3A%20%22%2B41*********%22%2C%3CBR%20%2F%3E%22displayName%22%3A%20%224%3A%2B41*******%22%2C%3CBR%20%2F%3E%22identityProvider%22%3A%20%22None%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.commsNotification%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%5D%2C%3CBR%20%2F%3E%22%40odata.type%22%3A%20%22%23microsoft.graph.commsNotifications%22%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20service%20user%20for%20the%20bot%20has%20an%20%22Microsoft%20365%20E3%22%20and%20a%20%22Microsoft%20365%20Phone%20System%22%20license.%3C%2FP%3E%3CP%3EAnd%20I%20am%20able%20to%20make%20call%20from%20a%20PSTN%20number%20to%20the%20bot.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20idea%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGerd%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2938142%22%20slang%3D%22en-US%22%3ERe%3A%20Cannot%20initiate%20PSTN%20calls%20from%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2938142%22%20slang%3D%22en-US%22%3EWe%20could%20solve%20the%20problem.%20We%20used%20the%20wrong%20object%20ID%20for%20creating%20the%20call.%20After%20using%20the%20object%20ID%20from%20the%20assigned%20service%20user%2C%20it%20works.%3C%2FLINGO-BODY%3E
Contributor

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#exam... 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-...

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-yo...

 

There is a similar problem described here:
https://techcommunity.microsoft.com/t5/teams-developer/initiate-pstn-call-from-teams-to-public-landl...

 

Any ideas?

Thanks for yout help.

Regards

Gerd

 

 

3 Replies

@relkniw 

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. 

@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

best response confirmed by relkniw (Contributor)
Solution
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.