Azure-Samples / communication-services-dotnet-quickstarts

Sample code for Azure Communication Services .Net quickstarts
MIT License
76 stars 104 forks source link

OutboundCallReminder Not Allowed To Impersonate Error #166

Closed anasalhafez closed 3 months ago

anasalhafez commented 3 months ago

This issue is for a: (Create outbound call Error: Not allowed to impersonate)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

1- The azure communication service is connected to multi cognitive service. 2- The mobile number is linked to the Azure Communication Service. 3- The Ngrok is running and working fine.

Any log messages given by the failure

Not allowed to impersonate.

OS and Version?

Windows 10.

Versions

.Net Framework v4.7.2

Mention any other details that might be useful

                var source = new CommunicationUserIdentifier(callConfiguration.SourceIdentity);
                var target = new PhoneNumberIdentifier(targetPhoneNumber);
                var createCallOption = new CreateCallOptions(
                    new Uri(callConfiguration.AppCallbackUrl),
                    new List<MediaType> { MediaType.Audio },
                    new List<EventSubscriptionType> { EventSubscriptionType.ParticipantsUpdated, EventSubscriptionType.DtmfReceived }
                );
                createCallOption.AlternateCallerId = new PhoneNumberIdentifier(callConfiguration.SourcePhoneNumber);

                var call = await callClient.CreateCallConnectionAsync(source,
                    new List<CommunicationIdentifier>() { target },
                    createCallOption, reportCancellationToken)
                    .ConfigureAwait(false);

        private static async Task<CommunicationUserIdentifier> CreateUser(string connectionString)
        {
            var client = new CommunicationIdentityClient(connectionString);
            var user = await client.CreateUserAsync().ConfigureAwait(false);
            return user.Value;
        }

Repository communication-services-dotnet-quickstarts-main/CallAutomation_OutboundCalling.

Thanks! We'll be in touch soon.