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

PhoneLineTransportDevice API no longer works on Windows 22H2 #26

Open
BestOwl opened this issue Mar 12, 2023 · 21 comments
Open

PhoneLineTransportDevice API no longer works on Windows 22H2 #26

BestOwl opened this issue Mar 12, 2023 · 21 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@BestOwl
Copy link
Owner

BestOwl commented Mar 12, 2023

Recently I discovered that starting Windows 11 22H2 (build 22621), PhoneLineTransportDevice API no longer works, which resulted in our app's Calling feature no longer working.

The Calling feature currently relies on the PhoneLineTransportDevice API. The following is a brief description of how to use this API:

  1. Enumerate a PhoneLineTransportDevice using either the DeviceWatcher or DeviceInformation.
  2. Call PhoneLineTransportDevice.RegisterApp() to register the app with Windows for the associated PhoneLineTransportDevice.
  3. Call PhoneLineTransportDevice.ConnectAsync().
  4. Use PhoneLineWatcher to enumerate PhoneLine, similar to the DeviceWatcher.
  5. Call PhoneLine.Dial()
    Note: Microsoft's Your Phone (now called Phone Link) uses the same mechanism to implement the Calling feature as of 2020, not sure for now.

However, after upgrading to Windows 11 22H2 (build 22621), calling PhoneLineTransportDevice.RegisterApp() either results in non-functional or throws a System.UnauthorizedAccessException, even though PhoneLineTransportDevice.RequestAccessAsync() returns "Allowed".

I tested Phone Link on my PC and verified that it works without any issues. Therefore, I am not sure why our app is experiencing this problem.

I am seeking assistance in resolving this issue. If the PhoneLineTransportDevice API is no longer usable, I am open to suggestions for alternative solutions.

@BestOwl BestOwl added bug Something isn't working help wanted Extra attention is needed labels Mar 12, 2023
@BestOwl BestOwl pinned this issue Mar 15, 2023
@BestOwl
Copy link
Owner Author

BestOwl commented Mar 17, 2023

Windows 10 22H2 also has this issue.

@BestOwl BestOwl changed the title PhoneLineTransportDevice API no longer works on Windows 11 22H2 PhoneLineTransportDevice API no longer works on Windows 22H2 Mar 17, 2023
@BestOwl
Copy link
Owner Author

BestOwl commented Mar 17, 2023

New discovery on Windows 11 22H2: In UWP apps, PhoneLineTransportDevice.RequestAccessAsync() now will always return "DeniedBySystem"

@BestOwl
Copy link
Owner Author

BestOwl commented Mar 17, 2023

I made a small UWP app to test this API.
https://github.com/BestOwl/MyPhone.CallingDiagnosis.Pltd

Here are the test results:

OS API status
Windows 11 22H2 PhoneLineTransportDevice.RequestAccessAsync() return DeniedBySystem
Windows 10 22H2 PhoneLineTransportDevice.ConnectAsync() return false, unable to connect
Windows 10 21H2
Windows LTSC 2021

@BestOwl
Copy link
Owner Author

BestOwl commented Mar 17, 2023

Found this method in YourPhone.Calling.Managed.dll from the latest PhoneLink app:

public static unsafe bool TryUnlockPhoneLineTransportDeviceAPIs(IObjectReference _obj)

Seems like Microsoft blocks this API on purpose🤔.

@abusaadp
Copy link

Has Microsoft made an official announcement that Bluetooth calling will not work in Windows 11? Or have they changed the API for Bluetooth calling?

@abusaadp
Copy link

abusaadp commented Apr 27, 2023

I contacted Microsoft and they said they were not aware of this issue. After checking they said there is some permission issue with this API in Windows 11 and they will resolve it soon. So we must wait for Microsoft to resolve this issue. Thats why this API is working for PhoneLink app as it may not have this permission issue.

@abusaadp
Copy link

abusaadp commented Nov 2, 2023

Recently I got an email from Microsoft saying that this issue has been resolved but still the app is not working for me. The windows version has been updated to 23H2. Also even in the previous version of Windows namely 22H2 the bluetooth calling was working for the following apps.

  1. Grid3 (https://thinksmartbox.com/product/grid-3/)
  2. CallCenter (https://www.justremotephone.com/) and
  3. Thy Phone (https://apps.microsoft.com/detail/thy-phone/9PKT9JS17KXZ?hl=en-us&gl=US)

So few of the apps bluetooth calling is working for 22H2 itself. Maybe there is some issue in our app.

@Manmenhongyi
Copy link

I have encountered such a problem. After compiling, packaging and installing, I can't make a phone call. When I press the dial key, the software will crash.😰

@Manmenhongyi
Copy link

I can't use the dial-up call function normally in Windows10 22H2 and Windows11 23H2.😩

@zhenbohuang
Copy link

zhenbohuang commented Jan 22, 2024

@BestOwl

I try CallCenter (https://www.justremotephone.com/) and Intel Unison in 22H2, and both them worked fine.

And i find that both them pair the phone in app, but not from OS.
And if you pair the phone from OS firstly,
you need pair from the app again, or unpair from OS then pair again from the app before you can add the phone to the app.

Maybe it is the reason of why PhoneLineTransportDevice.RegisterApp() throws a System.UnauthorizedAccessException,
because the phone is NOT pair by the app, so the app do not have enough permission to link it?

@BestOwl
Copy link
Owner Author

BestOwl commented Jan 23, 2024

@BestOwl

I try CallCenter (https://www.justremotephone.com/) and Intel Unison in 22H2, and both them worked fine.

And i find that both them pair the phone in app, but not from OS. And if you pair the phone from OS firstly, you need pair from the app again, or unpair from OS then pair again from the app before you can add the phone to the app.

Maybe it is the reason of why PhoneLineTransportDevice.RegisterApp() throws a System.UnauthorizedAccessException, because the phone is NOT pair by the app, so the app do not have enough permission to link it?

I tried paring the phone in-app, but still no luck.

@BestOwl
Copy link
Owner Author

BestOwl commented Jan 23, 2024

Recently I got an email from Microsoft saying that this issue has been resolved but still the app is not working for me. The windows version has been updated to 23H2. Also even in the previous version of Windows namely 22H2 the bluetooth calling was working for the following apps.

  1. Grid3 (https://thinksmartbox.com/product/grid-3/)
  2. CallCenter (https://www.justremotephone.com/) and
  3. Thy Phone (https://apps.microsoft.com/detail/thy-phone/9PKT9JS17KXZ?hl=en-us&gl=US)

So few of the apps bluetooth calling is working for 22H2 itself. Maybe there is some issue in our app.

It looks like Thy Phone uses the same PhoneLineTransportDevice API. I'm not sure how they manage to make it work.

@BestOwl
Copy link
Owner Author

BestOwl commented Jan 23, 2024

https://gist.github.com/ADeltaX/285e017a1fefb0723b526246066b9f43

Check this out

@BestOwl
Copy link
Owner Author

BestOwl commented Jan 23, 2024

https://gist.github.com/ADeltaX/285e017a1fefb0723b526246066b9f43

Check this out

Still no luck after trying this.

@Manmenhongyi
Copy link

Is there any alternative solution to this API? ? ?

@BestOwl
Copy link
Owner Author

BestOwl commented Feb 5, 2024

In the recent Windows 11 22H2 release Microsoft deprecated a number of APIs used for making phone calls. Previously Thy Phone had used these because they presented a standard Windows dialog for call handling (incoming and outgoing) and the experience was consistent with Your Phone / Phone Link.
https://inthehand.com/2022/10/26/thy-phone-for-windows-11/

Yes, there is a new API, but I can't find any documentation about this new API.

@BestOwl
Copy link
Owner Author

BestOwl commented Feb 25, 2024

Found an undocumented property System.Devices.PhoneLineTransportDevice.Connected
MicrosoftDocs/winrt-api#1715

@Thunder-Ray
Copy link

Thunder-Ray commented Aug 22, 2024

Did you try this? https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.activation.phonecallactivatedeventargs?view=winrt-22621

To use this API, your application needs to declare in its Package.appxmanifest file windows.phonecallactivation as a uap13:Extension category. Otherwise, the application won't be able to be activated to facilitate in-app call progress control UI.

@ohernandezv
Copy link

PhoneLineTransportDevice.RequestAccessAsync() now will always return "DeniedBySystem", Any solution?

@SibertJabbla
Copy link

Has there been any progress on this? I'm having the same issue. I contacted Microsoft to request an access token for the API (as done in a previously posted gist https://gist.github.com/ADeltaX/285e017a1fefb0723b526246066b9f43), their response was "I investigated and this the PhoneLineTransportDevice API was removed from the LAF list and does not require a token.". So the token thing is not relevant anymore.

@SibertJabbla
Copy link

SibertJabbla commented Oct 21, 2024

I have made some progress regarding this issue:

  1. The feature is locked behind LAF (limited access features), but this has been reverse engineerd (see this blog and the previously posted gist)
  2. After much, much debugging, I discovered the API searches for the following registry entry:
    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Bluetooth\Audio\Hfp\HandsFree\BypassRegistration, which doesn't appear to exist. When I created this entry and assigned value 1, in conjunction with unlocking the API, I got actual access to the API. RequestAccessAsync, RegisterApp and Connect all apear to work for me now (on Win11).
    Important to note is that I haven't got any functionality to work yet, but it's something I guess.

One alternative to the API is building a kernel driver which implements HFP. The protocol in itself is not that complicated, but the routing of the audio is. The signaling part of the protocol can be done outside the kernel, but the opening of the audio channels appears to be. I also understood that getting a kernel driver approved for Windows is not easy and may even be expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants