Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP use skype to call number

Tags:

call

skype

uwp

I want my c# UWP App to support calling numbers.

When I'm on W10 mobile I want it to use W10 PhoneCall API normal (this is working)

Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(number, name);

but on W10 Desktop/PC I won't have a GSM provider, so I thought, maybe use skype to call the number, the user pressed.

Is that possible via UWP? Maybe similar like opening websites:

await Windows.System.Launcher.LaunchUriAsync(new Uri(website));
like image 382
user3079834 Avatar asked Jan 13 '16 21:01

user3079834


People also ask

Can I use Skype to call a phone number?

Calling Skype contacts on Skype is always free - but to call a mobile phone or landline through Skype requires Skype Credit or a subscription.

Can I use Skype to make international calls?

Call Anyone Around the WorldYou can call landlines and mobile devices from anywhere in the world at great low rates using Skype Credit. Save even more if you call specific destinations using Skype subscriptions.


1 Answers

Yes, it's possible and you're right about using Launch the default app for a URI to open Skype from your app.

For the question what Uri can we use, you can refer to Skype development.

Here is the sample code, this will open "Skype" and call the "Echo/Sound Test Service":

private async void OnClick(object sender, RoutedEventArgs e)
{
    var uriSkype = new Uri(@"Skype:echo123?call");

    // Set the option to show a warning
    var promptOptions = new Windows.System.LauncherOptions();
    promptOptions.TreatAsUntrusted = true;

    // Launch the URI
    var success = await Windows.System.Launcher.LaunchUriAsync(uriSkype, promptOptions);

    if (success)
    {
        // URI launched
    }
    else
    {
        // URI launch failed
    }
}

If you want to call number, you can use:

var uriSkype = new Uri(@"Skype:(number)?call");

Or you can also call by the skype id:

var uriSkype = new Uri(@"Skype:(skype id)?call");

This solution works only when Skype is already installed on your PC. If system can not find Skype on your PC, it will open the Store and show the recommended apps which registered this protocol.

like image 163
Grace Feng Avatar answered Oct 20 '22 06:10

Grace Feng