Live Caller ID Extension - timeout connecting to PIRService

I've followed the instructions to configure and launch a live caller id test service (https://swiftpackageindex.com/apple/live-caller-id-lookup-example/main/documentation/pirservice/testinginstructions) i.e. I've constructed a database, built and installed the PIRService etc.

Additionally I have created a test app with a Live Caller ID Extension.

The problem I'm facing is when turning on the Live Caller ID feature on an iPhone (the Settings|Apps|Phone|Call Blocking & Identification|Live CallerID Lookup switch) with iOS 18 Beta 4 is the phone logs:

"The request timed out." UserInfo={NSLocalizedDescription=The request timed out., NSErrorFailingURLKey=http://MacBook-Pro.local:8080/.well-known/private-token-issuer-directory

The configuration notes say:

"When running things locally on your Mac, and your testing device is on the same network, then you can use mDNS to let the device find your Mac. Let’s assume that your Mac’s hostname is Tims-MacBook-Pro.local. Then we should use the following value for the URLs: http://Tims-Macbook-Pro.local:8080. Thanks to the mDNS protocol your device should be able to resolve your hostname to the actual IP address of your Mac and make the connection."

My Mac hostname is "MacBook-Pro" therefore the Live Caller ID Extension is configured as:

        LiveCallerIDLookupExtensionContext(
            serviceURL: URL(string: "http://MacBook-Pro.local:8080")!,
            tokenIssuerURL: URL(string: "http://MacBook-Pro.local:8080")!,
            userTierToken: Data(base64Encoded: "BBBB")!
        )

And the service-config.json is configured as:

{
  "issuerRequestUri": "http://MacBook-Pro.local:8080",
  "users": [
    <snip>

(I've also tried excluding the issuerRequestUri as the instructions say "This value can be omitted from the configuration. Setting this explicitly will not be required for devices using iOS 18.0 beta 4 or later.")

And the PIR Service is started on the Mac as:

PIRService --hostname 0.0.0.0 service-config.json

And it starts and runs.

The iPhone and Mac are on the same Wifi network and connected by usb cable.

As far as I can tell, everything has been set up in accordance with the Testing Live Caller ID instructions, yet I get the error when attempting to enable the extension on the iPhone.

Is there something missing/incorrectly configured?

Answered by Technology Evangelist in 797161022

Hi there! The issuerRequestUri field should also point to the /issue path. So, you can try changing:

"issuerRequestUri": "http://192.168.1.4:8080"

to include the endpoint, like so:

"issuerRequestUri": "http://192.168.1.4:8080/issue"

Thanks!

I changed the urls used from http://MacBook-Pro.local:8080 to the Mac's ip address:8080 and now get this error instead:

configure failed Error Domain=com.apple.CipherML Code=1100 "Unable to query status due to errors: failed to fetch token" UserInfo={NSLocalizedDescription=Unable to query status due to errors: failed to fetch token, NSUnderlyingError=0x9fc845ef0 {Error Domain=CipherML.AuthenticationError Code=3 "failed to fetch token" UserInfo={NSLocalizedDescription=failed to fetch token}}}

Presumably this has something to do with service-config.json contents:

{
  "issuerRequestUri": "http://192.168.1.4:8080",
  "users": [
    {
      "tier1": {}
    },
    [
      "AAAA"
    ],
    {
      "tier2": {}
    },
    [
      "BBBB",
      "CCCC"
    ]
  ],

The instructions for this say "For the userTierToken, please set it to one of the values that you added in the service configuration file in Running the service section. For example BBBB."

Hi there! The issuerRequestUri field should also point to the /issue path. So, you can try changing:

"issuerRequestUri": "http://192.168.1.4:8080"

to include the endpoint, like so:

"issuerRequestUri": "http://192.168.1.4:8080/issue"

Thanks!

Accepted Answer

Thank you

@Apple

I can now enable Live Caller ID in Settings and the OS isn't churning out any errors while doing so.

However when a call is made to the handset, I see see the OS is doing a lookup to the PIRService, but its timing out:

error = Error Domain=com.apple.CipherML Code=400 "Error Domain=com.apple.CipherML Code=401 "Unable to request data by keywords batch: The request timed out." UserInfo={NSLocalizedDescription=Unable to request data by keywords batch: The request timed out., NSUnderlyingError=0x8b4290a80 {Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSLocalizedDescription=The request timed out., NSErrorFailingURLKey=http://192.168.1.100:8080/.well-known/private-token-issuer-directory}}}: The request timed out." UserInfo={NSLocalizedDescription=Error Domain=com.apple.CipherML Code=401 "Unable to request data by keywords batch: The request timed out." UserInfo={NSLocalizedDescription=Unable to request data by keywords batch: The request timed out., NSUnderlyingError=0x8b4290a80 {Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSLocalizedDescription=The request timed out., NSErrorFailingURLKey=http://192.168.1.100:8080/.well-known/private-token-issuer-directory}}}: 

The service-config.json contains:

  "issuerRequestUri": "http://192.168.1.100:8080/issue",

And the extension contains:

     serviceURL: URL(string: "http://192.168.1.100:8080")!,
      tokenIssuerURL: URL(string: "http://192.168.1.100:8080")!,

Any suggestions what the issue might be?

I keep getting different results, without changing anything. Initially after changing issuerRequestUrl to "http://192.168.1.100:8080/issue"

I was able to enable Live Caller Id on the handset, then while making calls I can see PIRService logging activity such as:

024-07-26T10:35:03-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545dd2 [PIRService] usecase=["com.nothing.CallerID.block"], duration=51183.29405784607ms
2024-07-26T10:35:03-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545dd6 hb_method=POST hb_uri=/queries [Hummingbird] Request
2024-07-26T10:35:03-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545dd6 [PIRService] Authenticating request
2024-07-26T10:35:04-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545d76 [PIRService] usecase=["com.nothing.CallerID.identity"], duration=653737.5059127808ms
2024-07-26T10:35:08-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545dd5 [PIRService] usecase=["com.nothing.CallerID.block"], duration=51340.32905101776ms
2024-07-26T10:35:08-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545dd7 hb_method=POST hb_uri=/queries [Hummingbird] Request
2024-07-26T10:35:08-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545dd7 [PIRService] Authenticating request
2024-07-26T10:35:56-0700 info Hummingbird : hb_id=ced7ba3cf0ddf1039830976d93545dd3 [PIRService] usecase=["com.nothing.CallerID.block"], duration=104154.59704399109ms

Although call data wasn't actually getting displayed on the call screen.

However since then everything keeps timing out or producing a new error:

Error setting enabled to 1 for live lookup extension <IdentityLookup.LiveLookupDBExtension: 0x300e5a120> (entity: LiveLookupDBExtension; id: 0xb3f7121c8073bb90 <x-coredata://83D29F3B-ED40-4358-8373-633F259A6CC9/LiveLookupDBExtension/p1>; data: {
    blockingInfo = "<relationship fault: 0x302896960 'blockingInfo'>";
    identifier = "com.nothing.CallerID";
    identityInfo = "<relationship fault: 0x302897680 'identityInfo'>";
    isAppStoreVendable = 0;
    isEnabled = 0;
    isInstalled = 1;
    priority = 1;
    shouldRemove = 0;
}): Error Domain=com.apple.CipherML Code=1100 "Unable to query status due to errors: server error ({"error":{"message":"No token key found with key id: [33, 132, 101, 35, 168, 214, 114, 89, 42, 149, 166, 64, 68, 231, 87, 86, 9, 199, 206, 114, 53, 73, 202, 165, 60, 130, 43, 158, 239, 8, 247, 248]"}})" UserInfo={NSLocalizedDescription=Unable to query status due to errors: server error ({"error":{"message":"No token key found with key id: [33, 132, 101, 35, 168, 214, 114, 89, 42, 149, 166, 64, 6

Everything seems really unstable and random.

This is very infuriating, one minute there's no errors, then the next there is WITHOUT HAVING CHANGED ANYTHING. There's just no consistency to anything.

For example, out of nowhere new errors appearing when the OS performs a lookup when there's a call:

block request returned error: Error Domain=com.apple.CipherML Code=400 "Error Domain=com.apple.CipherML Code=401 "Unable to request data by keywords batch: server error ({"error":{"message":"Evaluation key not found"}})" UserInfo={NSLocalizedDescription=Unable to request data by keywords batch: server error ({"error":{"message":"Evaluation key not found"}}), NSUnderlyingError=0xa40374180 {Error Domain=CipherML.CipherMLError Code=5 "server error ({"error":{"message":"Evaluation key not found"}})" UserInfo={NSLocalizedDescription=server error ({"error":{"message":"Evaluation key not found"}})}}}: server error ({"error":{"message":"Evaluation key not found"}})" UserInfo={NSLocalizedDescription=Error Domain=com.apple.CipherML Code=401 "Unable to request data by keywords batch: server error ({"error":{"message":"Evaluation key not found"}})" UserInfo={NSLocalizedDescription=Unable to request data by keywords batch: server error ({"error":{"message":"Evaluation key not found"}}), NSUnderlyingError=0xa40374180 {Error Domain=CipherML.Cip

I was finally able to get things going. The testing documentation says this of the extension "For the userTierToken, please set it to one of the values that you added in the service configuration file in Running the service section. For example BBBB." I tried changing it to AAAA and then it started working even though BBBB is in there too:

  "users": [
    {
      "tier1": {}
    },
    [
      "AAAA"
    ],
    {
      "tier2": {}
    },
    [
      "BBBB",
      "CCCC"
    ]
  ],

Sorry about the frustration you experienced here! We've supplemented the docs with some more information about errors that may come up when using the example service. You can find this new doc here: https://swiftpackageindex.com/apple/live-caller-id-lookup-example/main/documentation/pirservice/commonerrors

Live Caller ID Extension - timeout connecting to PIRService
 
 
Q