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

Søren Lund 71 Reputation points
2021-02-24T21:04:01.75+00:00

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

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,773 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,906 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Nikitha-MSFT 541 Reputation points
    2021-03-22T10:30:09.463+00:00

    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 :)

    1 person found this answer helpful.
    0 comments No comments

  2. Colin Stone 46 Reputation points
    2021-03-31T08:31:38.987+00:00

    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.

    1 person found this answer helpful.

  3. Søren Lund 71 Reputation points
    2021-05-05T12:29:13.967+00:00

    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

    1 person found this answer helpful.
    0 comments No comments

  4. Colin Stone 46 Reputation points
    2021-03-22T14:10:54.657+00:00

    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

    0 comments No comments

  5. meisterheister 1 Reputation point
    2021-03-23T10:19:42.98+00:00

    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  
      }  
    
    0 comments No comments