Cannot Start Call from client app to teams user using ACS - c#

Using the guide here https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/get-started-teams-interop?pivots=platform-windows
I am able to join a team meeting from my client app.
Now trying to start a 1:1 call with a teams identity on the client, to another teams identity (on teams); I've tried to use the StartCallAsync method (instead of JoinAsync) from https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/get-started-with-voice-video-calling-custom-teams-client
This example is in node - I'm using C# and it looks like the most recent beta build of the SDK does NOT have the threadId property exposed.
Here is the JS code
call_ = await call_agent.startCall([{ microsoftTeamsUserId: calleeTeamsUserId.value.trim() }], { videoOptions: videoOptions, threadId: teamsThreadId });
and this link https://learn.microsoft.com/en-us/javascript/api/azure-communication-services/#azure/communication-calling/startcalloptions?view=azure-communication-services-js states that a threaded is required; however, no such threadId exists for c# SDK
The client goes from a connecting state to a disconnected state - the call never rings
Specific code to make the call
StartCallOptions startCallOptions = new StartCallOptions();
ICommunicationIdentifier[] callees = new ICommunicationIdentifier[1]
{
new MicrosoftTeamsUserIdentifier(*****)
};
call_ = await call_agent.StartCallAsync(callees, startCallOptions);

Azure Communication Services have multiple types of Teams interop, which are in different phases of development by today (1/31/2022). Your combination of interop and programming language is currently not supported. Interop scenarios:
Ability of ACS users to join Teams meeting is generally available for all JS, .net, iOS, Android.
Ability of Teams user manage Teams VoIP calls, Teams PSTN calls, and Teams meetings via ACS JavaScript calling SDK is in public preview. Android, iOS, and .net calling SDKs do not support Teams identities.
You can learn more about the support in the following documentation:
https://learn.microsoft.com/en-us/azure/communication-services/concepts/interop/teams-user-calling

Related

New-AzurePIMRequest as .net-function?

I want to initiate an Azure-PIM using c#/.net
I already found a PowerShell-Function to do this:
New-AzurePIMRequest ... inside the "PIMTools"-packages: https://www.powershellgallery.com/packages/PIMTools/0.4.0.0
This is working just fine and of course I could just execute a PS-Script containing this from within my C#-Application. But I would prefer to natively achieving the same using a NuGet-Package or a library from within my application.
Is there a package that allows me to achieve the same from within C#?
Those PIMTools are just wrapping some existing powershell modules.You can check the details here: https://github.com/janegilring/PIMTools/blob/main/functions/New-AzurePIMRequest.ps1
As you can see they mainly use the AzureADPreview module which is giving access to the Microsoft Graph Endpoint. Microsoft Graph is a RESTful web API that enables you to access Microsoft Cloud service resources.
You can find the Graph SDK here: https://github.com/microsoftgraph/msgraph-sdk-dotnet
With the SDK installed you can use something like this to issue a PIM Request:
var graphClient = new GraphServiceClient(new DefaultAzureCredential());
var privilegedRoleAssignmentRequest = new PrivilegedRoleAssignmentRequestObject
{
Duration = "2",
Reason = "DevWork",
AssignmentState = "Active",
RoleId = "b24988ac-6180-42a0-ab88-20f7382dd24c",
};
await graphClient.PrivilegedRoleAssignmentRequests
.Request()
.AddAsync(privilegedRoleAssignmentRequest);
Note: You might have to the use the /beta Endpoint of the SDK to get PIM working. However, APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Programmatically create service bus subscription using .net standard

My scenario: Website hosted on the cloud, where each instance creates a subscription to a Service Bus Topic for itself to listen for messages.
My question: How do I programmatically create subscriptions?
Microsoft.Azure.ServiceBus.3.1.0 allows to create a ManagementClient using the ConnectionString.
private async Task CreateTopicSubscriptions()
{
var client = new ManagementClient(ServiceBusConnectionString);
for (int i = 0; i < Subscriptions.Length; i++)
{
if (!await client.SubscriptionExistsAsync(TopicName, Subscriptions[i]))
{
await client.CreateSubscriptionAsync(new SubscriptionDescription(TopicName, Subscriptions[i]));
}
}
}
Original plan for the new Azure Service Bus client was not to include management plane at all and use Azure Active Directory route instead. This has proven to be too problematic, just like you've pointed out. Microsoft messaging team has put together a sample to demonstrate the basic operations.
Note that there's a pending PR to get it working with .NET Core 2.0
Moving forward, it was recognized that developers prefer to access Service Bass using a connection string like they used to over Azure Active Directory option. Management Operations issue is raised to track requests. Current plan is to provide a light weight management library for the .NET Standard client.
For now, the options are either to leverage the old client to create entities or use Microsoft.Azure.Management.ServiceBus (or Fluent) until the management package is available.
Update
Management operations were released as part of 3.1.0 version of the client.
Microsoft.Azure.ServiceBus has been deprecated. The new option is Azure.Messaging.ServiceBus and ManagementClient has been replaced by ServiceBusAdministrationClient.
string connectionString = "<connection_string>";
ServiceBusAdministrationClient client = new ServiceBusAdministrationClient(connectionString);
This new package also supports ManagedIdentity:
string fullyQualifiedNamespace = "yournamespace.servicebus.windows.net";
ServiceBusAdministrationClient client = new ServiceBusAdministrationClient(fullyQualifiedNamespace, new DefaultAzureCredential());
A little example:
var queueExists = await _administrationClient.QueueExistsAsync(queueName);
if(!queueExists)
await _administrationClient.CreateQueueAsync(queueName);
More info here.

Does Microsoft Teams have a way to update a user's status/presence?

Recent news says that Skype For Business is eventually going to be taken down and replaced by Microsoft Teams.
I have a few projects that rely on Skype For Business and I use the following code to update a user's presence on Skype For Business using the 2013 lync SDK.
public static void PublishPresence(ContactAvailability contactAvailability)
{
var publishData = new Dictionary<PublishableContactInformationType, object>
{
{PublishableContactInformationType.Availability, contactAvailability}
};
SendPublishRequest(publishData);
}
private static void SendPublishRequest(Dictionary<PublishableContactInformationType, object> publishData)
{
try
{
PublishContactInformation(publishData);
}
catch (Exception exception)
{
_logger.Error("Cannot publish presence to Lync. Error: " + exception);
}
}
public static void PublishContactInformation(Dictionary<PublishableContactInformationType, object> publishData)
{
LyncClient lyncClient = LyncClient.GetClient();
lyncClient.Self.BeginPublishContactInformation(publishData, ar => lyncClient.Self.EndPublishContactInformation(ar), null);
}
With that said we do plan on moving our projects to Microsoft Teams. However, we looked at the current Microsoft Teams SDK and we could not find any information about updating a user's presence.
Is something similar not listed on their documentation that allows myself to change my own status/presence?
I'm happy to help with the API's that exist in Production or Preview today but Stack Overflow isn't the right platform for long-term roadmap discussions. That is something best left to official channels to disclose when it's ready.
At the moment, you're correct in that the Microsoft Teams SDK doesn't include APIs for interacting with Presence. This is because Teams itself is mirroring Skype's presence using Skype's API. You can replicate this functionality within your application using the similar APIs.
A good place to start would be the Unified Communications Web API (UCWA). If you're simply looking to surface Presence (rather than manipulate it), you can retrieve contactPresence. For manipulating the current user's status, you can use presence.
To add some color to #MarcLaFleur-MSFT's answer...
All the calling/video/meeting functionality in Teams use Office-365 compliant instances of the Skype Consumer technology. It is a REST api, as #jeroen-mostert noticed, but it's not meant to be used by external developers. Besides the fact that it's not documented or supported, these endpoints require a special kind of access token.
The roadmap for Teams APIs definitely includes presence. But the API will be part of the Microsoft Graph API, not what you observe using Fiddler or the browser debugger today.

Lync Client SDK PSTN Calling

I am using Lync Client SDK 2013, to communicate with Skype for Business through a C# program.
However, I cannot find any reference in SDK documentation on how to make a PSTN call using the SDK.
Is this possible at all? A short C# code example would be useful.
You use the "tel:" URI to say want number you want to dial instead of the sip URI. The number you use depends on the dial plan setup of your Lync Server. If you want to avoid dial plan problems, stick with E164 formatted numbers and it will work with any number on any Lync Server anywhere.
Dialing with the Lync Client is the same as with a normal sip uri except you use a tel formatted uri instead:
var participantUri = new List<string> { "tel:+6491234567" };
var automation = LyncClient.GetAutomation();
automation.BeginStartConversation(AutomationModalities.Audio, participantUri, null, ar =>
{
automation.EndStartConversation(ar);
}, null);
Note: there is no error checking and the BeginStartConversation / EndStartConversation calling can be done in many different ways / styles.

Calling SpeechAPI for text to speech on Azure

I have the following very basic TTS code running on my local server
using System.Speech.Synthesis;
...
SpeechSynthesizer reader = new SpeechSynthesizer();
reader.Speak("This is a test");
This code has a dependency on System.Speech for which I have added a Reference in my VS 2015 project.
Works fine but from what I have read and from trying it I know this will not work when the code is hosted on Azure.
I have read several posts on SO querying if it is actually possible to do TTS on azure. Certainly 2 yrs ago it did not appear to be possible. How to get System.Speech on windows azure websites?
All roads seem to lead to the Microsoft Speech API
https://azure.microsoft.com/en-gb/marketplace/partners/speechapis/speechapis/
I have signed up and have gotten my private and sec keys for calling into this API.
However my question is this. How do I actually call the SpeechAPI? What do I have to change in the simple code example above so that this will work when running on azure?
The speech API you referred to at the Azure marketplace is part of an AI Microsoft project called ProjectOxford which offers an array of APIs for computer vision, speech and language.
These are all RESTful APIs, meaning that you will be constructing HTTP requests to send to a hosted online service in the cloud.
The speech-to-text documentation is available here and you can find sample code for various clients on github. Specifically for C# you can see some code in this sample project.
Please note that ProjectOxford is still in preview (Beta). Additional support for using these APIs can be found on the ProjectOxford MSDN forum.
But just to give you an idea of how your program will look like (taken from the above code sample on github):
AccessTokenInfo token;
// Note: Sign up at http://www.projectoxford.ai for the client credentials.
Authentication auth = new Authentication("Your ClientId goes here", "Your Client Secret goes here");
...
token = auth.GetAccessToken();
...
string requestUri = "https://speech.platform.bing.com/synthesize";
var cortana = new Synthesize(new Synthesize.InputOptions()
{
RequestUri = new Uri(requestUri),
// Text to be spoken.
Text = "Hi, how are you doing?",
VoiceType = Gender.Female,
// Refer to the documentation for complete list of supported locales.
Locale = "en-US",
// You can also customize the output voice. Refer to the documentation to view the different
// voices that the TTS service can output.
VoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)",
// Service can return audio in different output format.
OutputFormat = AudioOutputFormat.Riff16Khz16BitMonoPcm,
AuthorizationToken = "Bearer " + token.access_token,
});
cortana.OnAudioAvailable += PlayAudio;
cortana.OnError += ErrorHandler;
cortana.Speak(CancellationToken.None).Wait();

Categories

Resources