3

I am working on a custom Phone dialer app for iOS. My idea is to create a good experience by being able to block No Caller ID phone call with Call Directory Extension. Currently on iOS there is no way to block unknown caller, except by turning on Do Not Desturb mode.

Is there a way to somehow programmatically identify and block caller that has no phone number identification or by blocking a label that says No Caller ID?

So far I have tried this in CallDirectoryHandler

private func addAllBlockingPhoneNumbers(to context: CXCallDirectoryExtensionContext) {

    /**
     Retrieve all phone numbers to block from data store. For optimal performance and memory usage
     when there are many phone numbers, consider only loading a subset of numbers at a given time
     and using autorelease pool(s) to release objects allocated during each batch of numbers
     which are loaded.

     Numbers must be provided in numerically ascending order.
    */
    let unknownCaller = CXCallDirectoryPhoneNumber()
    let unknownCaller1: CXCallDirectoryPhoneNumber = 0
    let unknownCaller2: CXCallDirectoryPhoneNumber = 00000000
    let caller381X: CXCallDirectoryPhoneNumber = 38161XXXXXXX

    context.addBlockingEntry(withNextSequentialPhoneNumber: unknownCaller)
    context.addBlockingEntry(withNextSequentialPhoneNumber: unknownCaller1)
    context.addBlockingEntry(withNextSequentialPhoneNumber: unknownCaller2)
    context.addBlockingEntry(withNextSequentialPhoneNumber: caller38161X)
}

And so far I have been able to block this regular phone number 38161XXXXXXX but, if that same number calls by hiding with prefix #31#, the call will go through.

Does anyone know if this is possible and is there a way to identify and block No Caller ID?

Sujatha Girijala
  • 1,141
  • 8
  • 20
Miki
  • 903
  • 7
  • 26

1 Answers1

4

No, a CallKit call blocking extension must specify the number(s) to be blocked. You cannot specify "no number" to be blocked.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • I see... Thanks for the response, even my carrier cannot block this incoming 'No Caller ID' phone call :S I thought I would've made something, but... – Miki Aug 08 '18 at 07:45
  • @Miki, carriers actually provide this ability to hide phone number, they make money this way. So, obviously, they don't want it to be blocked, otherwise everyone will do it and all operators will lose their income. – kelin Sep 03 '21 at 10:42
  • iOS now has an inbuilt switch that will silence unknown callers and send them directly to voicemail. – Paulw11 Sep 03 '21 at 11:49