Lync Client SDK PSTN Calling - c#

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.

Related

Cannot Start Call from client app to teams user using ACS

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

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();

How do I send an email from a WinRT/Windows Store application?

I am developing a Windows Store Application (Windows 8).
I have a need to send emails based on data and address stored in the application data and without the need of the user to type it the data or the address.
What would be the right/easy way to implement it?
EitanB
You can try with
var mailto = new Uri("mailto:?to=recipient#example.com&subject=The subject of an email&body=Hello from a Windows 8 Metro app.");
await Windows.System.Launcher.LaunchUriAsync(mailto);
The correct way would be to use Sharing. Your app should create an HTML document or Text and share it. The user would select Mail from the Share charm and the HTML/Text would become the body of the email.
See here for more info...
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh973055.aspx
This is the correct syntax to use for a mailto: link (unlike the other examples above with a mailto: which are incorrect..)
var mailto = new Uri("mailto:yourname#email.com?subject=" + subject + "&body=" + body);
await Launcher.LaunchUriAsync(mailto);
The problem with the mailto: method is if the user has no client program associated with mailto: nothing will happen.
The most reliable method to use is a web service or WCF service of some sort. Using the Share Charm while considered the 'correct' way on Windows 8, is not neccessarily the best as the user may still have no email client installed, for example if they rely on gmail.com for their email.
If you are developping a Universal WinRT Windows Phone application, you could use the "Windows.ApplicationModel.Email.EmailMessage" namespace as the "Microsoft.Phone.Tasks.EmailComposeTask" namespace doesn't work on WinRT application.
Then, uses this code to create and launch a new email.
// Create your new email message.
var em = new EmailMessage() ;
// Add as much EmailRecipient in it as you need using the following method.
em.To.Add(new EmailRecipient("yourname#yourdomain.com"));
em.Subject = "Your Subject...";
em.Body = "Your email body...";
// You can add an attachment that way.
//em.Attachments.Add(new EmailAttachment(...);
// Show the email composer.
await EmailManager.ShowComposeNewEmailAsync(em);
I hope it will solve your (or other developers) problem.
Regards.
It's always possible to connect to an SMTP server and issue commands like HELO, MAIL, RCPT, etc. Of course you'll need an SMTP server to connect to. I use this on our corporate intranet to send emails.

How to connect the WiiMote internally in a C# app?

I want to connect a single wiiMote to my app using WiiMoteLib, but I want the connection done internally ie. the user has only to run the app (and should have no need to connect the wiiMote with windows wizard or bluesoleil). The app is in C# and the language cannot be changed.
Thanks!
Does 32feet.NET do the job?
BluetoothAddress addr = ... address from discovery or known address...
var dev = new BluetoothDeviceInfo(addr);
dev.SetServiceState(BluetoothService.HumanInterfaceDevice, true); // this line!
You may also need to handle pairing, perhaps using BluetoothWin32Authentication and handling its callback, see http://32feet.codeplex.com/wikipage?title=Bluetooth%20Security and http://32feet.codeplex.com/wikipage?title=BluetoothWin32Authentication
There is an example of how to do this here using the Microsoft Bluetooth API and the HID API:
http://www.richlynch.com/code/wiipair
It works quire well.
Its in C++, but its pretty easy to convert to C#.

Jabber-net integration

I'd like to ask your help regarding having a Google Talk Bot that will communicate with my code on my server.
I have downloaded Jabber-Net from code.google.com, but the examples there are not enough... I am new to these technologies, and have no clue about:
How will client arrive to my server? where should I change [if any] DNS to my server?
Which server side library should I use?
From the examples I understood that I need to have a Desktop-app running in the background constantly, which doesn't make sense to me.
Does anyone has an example of some better references to understand this better?
[Sorry for my ignorance...]
I'm not sure if I understand what you ask correctly. If you're asking how to connect to chosen server, console sample shows how to do it simply, you basically fill out JID class.
Sample from Jabber-Net
JabberClient jc = new JabberClient();
JID j = new JID(jid);
jc.User = j.User;
jc.Server = j.Server;
jc.NetworkHost = networkHost;
jc.Port = port;
jc.Resource = "Jabber.Net Console Client";
jc.Password = pass;
jc.AutoStartTLS = TLS;
jc.AutoPresence = initialPresence;
If you want to create your own server, there's a library (also running under .NET) called agsxmpp, it allows to create both, server and client, it's open source on MIT/GPL license afair. I don't know if jabber-net enables this feature. On the other hand, there are plenty of free jabber-server if you don't want to just use one of "public" ones, so it may be worth to consider just using something that is ready to be launched.
There's a console sample in the project, you don't need desktop-app (if this is what you were asking?), so you can write service, console app or anything else.
Here's a recent post that shows an example of replying to incoming messages on Gtalk using .NET

Categories

Resources