Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added enhancements on top of Calling Server preview 1 #21686

Merged
merged 36 commits into from
Jun 21, 2021

Conversation

navali-msft
Copy link
Member

All SDK Contribution checklist:

This checklist is used to make sure that common guidelines for a pull request are followed.

  • Please open PR in Draft mode if it is:
    • Work in progress or not intended to be merged.
    • Encountering multiple pipeline failures and working on fixes.
  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • I have read the contribution guidelines.
  • The pull request does not introduce breaking changes.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code. (Track 2 only)
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK. Please double check nuget.org current release version.

Additional management plane SDK specific contribution checklist:

Note: Only applies to Microsoft.Azure.Management.[RP] or Azure.ResourceManager.[RP]

  • Include updated management metadata.
  • Update AzureRP.props to add/remove version info to maintain up to date API versions.

Management plane SDK Troubleshooting

  • If this is very first SDK for a services and you are adding new service folders directly under /SDK, please add new service label and/or contact assigned reviewer.

  • If the check fails at the Verify Code Generation step, please ensure:

    • Do not modify any code in generated folders.
    • Do not selectively include/remove generated files in the PR.
    • Do use generate.ps1/cmd to generate this PR instead of calling autorest directly.
      Please pay attention to the @microsoft.csharp version output after running generate.ps1. If it is lower than current released version (2.3.82), please run it again as it should pull down the latest version.

    Note: We have recently updated the PSH module called by generate.ps1 to emit additional data. This would help reduce/eliminate the Code Verification check error. Please run following command:

      `dotnet msbuild eng/mgmt.proj /t:Util /p:UtilityName=InstallPsModules`
    

Old outstanding PR cleanup

Please note:
If PRs (including draft) has been out for more than 60 days and there are no responses from our query or followups, they will be closed to maintain a concise list for our reviewers.

@ghost ghost added the Communication label Jun 8, 2021
@check-enforcer
Copy link

check-enforcer bot commented Jun 8, 2021

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them. In order to bootstrap pipelines for a new service, please perform following steps:

For data-plane/track 2 SDKs Issue the following command as a pull request comment:

/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run net - [service] - ci

For track 1 management-plane SDKs

Please open a separate PR and to your service SDK path in this file. Once that PR has been merged, you can re-run the pipeline to trigger the verification.

/// </summary>
/// <returns>The instrumented <see cref="CallClient" />.</returns>
protected CallClient CreateInstrumentedCallingServerClient()
/// <returns>The instrumented <see cref="CallConnection" />.</returns>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the return should be CallingServerClient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed.

@@ -4,13 +4,13 @@ This sample demonstrates how to make a call to a phone number recipient.

To get started you'll need a Communication Service Resource. See [README][README] for prerequisites and instructions.

## Creating an `ServerCallingClient`
## Creating an `CallingServerClient`
Copy link
Member

@ajaych-ms ajaych-ms Jun 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an

a #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see an?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still see "an" as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still see an :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more "an"

source: new CommunicationUserIdentifier("<source-identifier>"), // Your Azure Communication Resource Guid Id used to make a Call
targets: new List<CommunicationIdentifier>() { new PhoneNumberIdentifier("<targets-phone-number>") }, // E.164 formatted recipient phone number
options: createCallOption // The options for creating a call.
);
Console.WriteLine($"Call Leg id: {createCallResponse.CallLegId}");
Console.WriteLine($"Call connection id: {callConnection.Value.CallConnectionId}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.Value

why do we need .Value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apis are returning Response object which kind of wrapped http response object. The Value property contain the return value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then variable should be named differently - something like callConnectionResponse

zihzhan-msft and others added 2 commits June 8, 2021 23:16
* Clean up clients comments.

* Update Snippet and Export-API.
zihzhan-msft and others added 3 commits June 9, 2021 18:07
* Update Snippet and Export-API.

* remove calloption override in servercall client.

* Nit for params and arguments handling.

* Merge Downloader updates.

* Merge Downloader updates test cases.

* Update AutoGen Content.
@@ -46,9 +46,9 @@ protected async Task SleepIfNotInPlaybackModeAsync()
await Task.Delay(10000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a delay here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are few Tests in Record mode required human interaction(i.e. pick up the call to let the call in established state, so that further Api operations can be performed).
Alternative ways is using debug break point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍. You can renaming the method then to WaitToPickUpPhoneInPlaybackModeAsync to make it more clear

navali-msft and others added 8 commits June 10, 2021 15:11
* Update Snippet and Export-API.

* remove calloption override in servercall client.

* Nit for params and arguments handling.

* Merge Downloader updates.

* Merge Downloader updates test cases.

* Update AutoGen Content.

* Nit clean on Unit Tests.

* Updating and renaming.
InviteParticipants --> AddParticipant
InviteParticipantResultEvent --> AddParticipantResultEvent
CallModality --> MediaType
CommunicationParticipant --> CallParticipant
Id in PlayAudioResult & CancelAllMediaOperations is now called OperationId
CallConnectionState now has {incoming, connecting, connected, disconnecting, disconnected}
CallRecordingStateResult ---> CallRecording... by Naveed Ali
CallRecordingStateResult ---> CallRecordingProperties
…gger path (#21870)

* Added AddParticipantResult, Re-added communication error, updated swagger path

* Fixed unit tests

* Updated netstandard
* Update Snippet and Export-API.

* remove calloption override in servercall client.

* Nit for params and arguments handling.

* Merge Downloader updates.

* Merge Downloader updates test cases.

* Update AutoGen Content.

* Nit clean on Unit Tests.

* Updating and renaming.

* Test update.

* Add Call Connection Live Tests.

* Add ServerCall Live Tests

* Increase Test Coverage.

* Reenable sample tests.

* Address comments.

* Point to swagger file in master branch.
* Update Snippet and Export-API.

* remove calloption override in servercall client.

* Nit for params and arguments handling.

* Merge Downloader updates.

* Merge Downloader updates test cases.

* Update AutoGen Content.

* Nit clean on Unit Tests.

* Updating and renaming.

* Test update.

* Add Call Connection Live Tests.

* Add ServerCall Live Tests

* Increase Test Coverage.

* Reenable sample tests.

* Address comments.

* Point to swagger file in master branch.

* Nit fix.

* Nit changes based on Azure boarder review feedback.
/// Calling server model factory
/// </summary>
[CodeGenModel("AzureCommunicationServicesModelFactory")]
internal partial class CallingServerModelFactory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably should be moved to .Models namespace and also should it be public so developers can instantiate the models that do not have public constructor.
CC: @minnieliu

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, agreed, good catch Reza!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a pattern followed by other modalities? So, far we don't seem to have this need for apps

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>
This client library enables working with the Microsoft Azure Communication Service Calling Server APIs.
This client library enables working with the Microsoft Azure Communication CallingServer service.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename to Calling Server, two separate words?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer using "CallingServer" which was "Calling Server" to keep it consistent within SDK library and API

@@ -39,7 +39,7 @@ public enum ServiceVersion
/// The Beta of the CallingServer service.
/// </summary>
#pragma warning disable CA1707 // Identifiers should not contain underscores
V2021_04_15_Preview1 = 0
V2021_06_15_Preview = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the enum starting with 1 but the 2021_04_15 version is removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This number started from 1 was per Azure boarder team suggest, they seems reserve 0 for other usage. CC @navali-msft

"2021_04_15" was a "private review" version. There are plenty of major schema changes on the swagger and since we are not public preview yet, we decide to have "V2021_06_15_Preview" as our first public version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// <param name="identifier"> The communication identifier. </param>
/// <param name="participantId"> Participant Id. </param>
/// <param name="isMuted"> Is participant muted. </param>
public CallParticipant(CommunicationIdentifier identifier, string participantId, bool? isMuted)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should isMuted be nullable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this.

@@ -15,13 +15,18 @@ public class CallingServerTestEnvironment : CommunicationTestEnvironment
/// <summary>
/// The phone number associated with the source.
/// </summary>
public string SourcePhoneNumber => GetRecordedVariable(AzurePhoneNumber, options => options.IsSecret());
public string SourcePhoneNumber => GetRecordedVariable(AlternateCallerId, options => options.IsSecret());

/// <summary>
/// The phone number associated with the source.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be The phone number associated with the target.?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
Change it to:
/// The phone number required to make a pstn call.

@@ -15,13 +15,18 @@ public class CallingServerTestEnvironment : CommunicationTestEnvironment
/// <summary>
/// The phone number associated with the source.
/// </summary>
public string SourcePhoneNumber => GetRecordedVariable(AzurePhoneNumber, options => options.IsSecret());
public string SourcePhoneNumber => GetRecordedVariable(AlternateCallerId, options => options.IsSecret());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to change it to alternateCallerId, can we change the variable name as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to using the SourcePhoneNumber in comparasion with TargetPhoneNumber

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have target phone number, so here we have source phone number, considering later on, the source phone number could be a pstn number that is not from ACS resource, then we assign another number and differentiate it with the AlternateCallerId from ACS.

@@ -12,10 +12,12 @@ namespace Azure.Communication.CallingServer.Tests
/// </summary>
public class CallingServerTestEnvironment : CommunicationTestEnvironment
{
public const string AlternateCallerId = "ALTERNATE_CALLERID";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@minnieliu @RezaJooyandeh
Should we move this to CommunicationTestEnvironment.cs and create a Variable in the ACS Live Test KV?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually only add it to CommunicationTestEnvironment for variables that will be shared between all the Communication SDKs. I think it is fine to keep it in CallingServerTestEnvironment

namespace Azure.Communication.CallingServer
{
[CodeGenModel("CommunicationErrorResponse")]
public partial class CallingServerErrorResponse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is not currently used, correct? If you plan to convert low level exceptions to this, you should only add this class when the conversion code is added. Otherwise, it is confusing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@navali-msft could you please remove

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the public version. Keep the one generated by sdk.

@navali-msft navali-msft requested a review from benbp as a code owner June 18, 2021 23:54
zihzhan-msft and others added 6 commits June 18, 2021 17:17
…operties to readonly (#21980)

* Updated models definition based on new swagger, also fixed events to make properties readonly

* Update accessibility of internal models

* Update the file path in autorest
…o feature/callingServer-preview1-enhancement
SKIP_PHONENUMBER_LIVE_TESTS: TRUE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is SKIP_PHONENUMBER_LIVE_TESTS here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this flag is widely used in all the other communication SDK projects, even this flag is not used in them.


using Azure.Core;

namespace Azure.Communication.CallingServer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.Models

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved.

Copy link
Member

@RezaJooyandeh RezaJooyandeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left another couple of small comments, but feel free to merge once you address those and @minnieliu approve as well.

@minnieliu minnieliu merged commit 658dbd4 into main Jun 21, 2021
@minnieliu minnieliu deleted the feature/callingServer-preview1-enhancement branch June 21, 2021 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants